Fix encoding of address output if function input exists

pull/3264/head
Victor Baranov 4 years ago
parent 47ccce9df1
commit b8841d9aa8
  1. 1
      CHANGELOG.md
  2. 8
      apps/explorer/lib/explorer/smart_contract/reader.ex

@ -4,6 +4,7 @@
- [#3261](https://github.com/poanetwork/blockscout/pull/3261) - Bridged tokens table - [#3261](https://github.com/poanetwork/blockscout/pull/3261) - Bridged tokens table
### Fixes ### Fixes
- [#3264](https://github.com/poanetwork/blockscout/pull/3264) - Fix encoding of address output if function input exists
- [#3259](https://github.com/poanetwork/blockscout/pull/3259) - Contract interaction: array input type parsing fix - [#3259](https://github.com/poanetwork/blockscout/pull/3259) - Contract interaction: array input type parsing fix
- [#3257](https://github.com/poanetwork/blockscout/pull/3257) - Contracts read/write: method_id instead function_name as a key - [#3257](https://github.com/poanetwork/blockscout/pull/3257) - Contracts read/write: method_id instead function_name as a key
- [#3256](https://github.com/poanetwork/blockscout/pull/3256) - Fix for invisible validator address at block page and wrong alert text color at xDai - [#3256](https://github.com/poanetwork/blockscout/pull/3256) - Fix for invisible validator address at block page and wrong alert text color at xDai

@ -418,10 +418,18 @@ defmodule Explorer.SmartContract.Reader do
Map.put_new(output, "value", bytes_to_string(value)) Map.put_new(output, "value", bytes_to_string(value))
end end
defp new_value(%{"type" => :address} = output, [value], _index) do
Map.put_new(output, "value", bytes_to_string(value))
end
defp new_value(%{"type" => "address"} = output, values, index) do defp new_value(%{"type" => "address"} = output, values, index) do
Map.put_new(output, "value", bytes_to_string(Enum.at(values, index))) Map.put_new(output, "value", bytes_to_string(Enum.at(values, index)))
end end
defp new_value(%{"type" => :address} = output, values, index) do
Map.put_new(output, "value", bytes_to_string(Enum.at(values, index)))
end
defp new_value(%{"type" => "bytes" <> number_rest} = output, values, index) do defp new_value(%{"type" => "bytes" <> number_rest} = output, values, index) do
if String.contains?(number_rest, "[]") do if String.contains?(number_rest, "[]") do
values_array = Enum.at(values, index) values_array = Enum.at(values, index)

Loading…
Cancel
Save