From 1f8bda8a377035592d71d696603f42c1399261e4 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 29 Jun 2020 11:22:02 +0300 Subject: [PATCH 1/2] Fix for acocunts page with token-bridge supply and inexistent bridge contracts --- .../lib/explorer/chain/supply/token_bridge.ex | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) 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) From 5cdaa75ac9540901e0c9fc6088493815252aad6c Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 29 Jun 2020 11:28:48 +0300 Subject: [PATCH 2/2] Add Changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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