diff --git a/CHANGELOG.md b/CHANGELOG.md index 177901e0ed..64e56137dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - [#3157](https://github.com/poanetwork/blockscout/pull/3157) - Read methods of implementation on proxy contract ### Fixes +- [#3168](https://github.com/poanetwork/blockscout/pull/3168) - Eliminate internal server error at /accounts page with token-bridge type of supply and inexistent bridge contracts ### Chore diff --git a/apps/explorer/lib/explorer/chain/supply/token_bridge.ex b/apps/explorer/lib/explorer/chain/supply/token_bridge.ex index 14e7a0a6e1..42ed6c2201 100644 --- a/apps/explorer/lib/explorer/chain/supply/token_bridge.ex +++ b/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)