Fix for acocunts page with token-bridge supply and inexistent bridge contracts

pull/3168/head
Victor Baranov 4 years ago
parent f77ff79a36
commit 1f8bda8a37
  1. 19
      apps/explorer/lib/explorer/chain/supply/token_bridge.ex

@ -85,12 +85,6 @@ defmodule Explorer.Chain.Supply.TokenBridge do
|> Enum.map(fn {key, _value} -> key end)
|> List.first()
value =
case Reader.query_contract(address, abi, params) do
%{^method_name => {:ok, [result]}} -> result
_ -> 0
end
type =
abi
|> Enum.at(0)
@ -98,6 +92,19 @@ defmodule Explorer.Chain.Supply.TokenBridge do
|> Enum.at(0)
|> Map.get("type", "")
value =
case Reader.query_contract(address, abi, params) do
%{^method_name => {:ok, [result]}} ->
result
_ ->
case type do
"address" -> "0x0000000000000000000000000000000000000000"
"uint256" -> 0
_ -> 0
end
end
case type do
"address" ->
"0x" <> Base.encode16(value)

Loading…
Cancel
Save