Merge pull request #3168 from poanetwork/vb-token-bridge-accounnts-fix

Fix for accounts page with token-bridge supply
pull/3171/head
Victor Baranov 4 years ago committed by GitHub
commit 335aebe181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 19
      apps/explorer/lib/explorer/chain/supply/token_bridge.ex

@ -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

@ -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