diff --git a/apps/explorer/lib/explorer/staking/contract_state.ex b/apps/explorer/lib/explorer/staking/contract_state.ex index 1941c82374..b717706f40 100644 --- a/apps/explorer/lib/explorer/staking/contract_state.ex +++ b/apps/explorer/lib/explorer/staking/contract_state.ex @@ -65,8 +65,14 @@ defmodule Explorer.Staking.ContractState do staking_contract_address = Application.get_env(:explorer, __MODULE__)[:staking_contract_address] - %{"validatorSetContract" => {:ok, [validator_set_contract_address]}} = - Reader.query_contract(staking_contract_address, staking_abi, %{"validatorSetContract" => []}) + %{ + "validatorSetContract" => {:ok, [validator_set_contract_address]}, + "erc20TokenContract" => {:ok, [token_contract_address]} + } = + Reader.query_contract(staking_contract_address, staking_abi, %{ + "validatorSetContract" => [], + "erc20TokenContract" => [] + }) %{"blockRewardContract" => {:ok, [block_reward_contract_address]}} = Reader.query_contract(validator_set_contract_address, validator_set_abi, %{"blockRewardContract" => []}) @@ -84,7 +90,9 @@ defmodule Explorer.Staking.ContractState do :ets.insert(@table_name, staking_contract: %{abi: staking_abi, address: staking_contract_address}, validator_set_contract: %{abi: validator_set_abi, address: validator_set_contract_address}, - block_reward_contract: %{abi: block_reward_abi, address: block_reward_contract_address} + block_reward_contract: %{abi: block_reward_abi, address: block_reward_contract_address}, + token_contract_address: token_contract_address, + token: get_token(token_contract_address) ) {:ok, state, {:continue, []}} diff --git a/apps/explorer/test/explorer/staking/contract_state_test.exs b/apps/explorer/test/explorer/staking/contract_state_test.exs index 96bd39b051..578cf7795f 100644 --- a/apps/explorer/test/explorer/staking/contract_state_test.exs +++ b/apps/explorer/test/explorer/staking/contract_state_test.exs @@ -56,8 +56,13 @@ defmodule Explorer.Staking.ContractStateTest do EthereumJSONRPC.Mox, :json_rpc, fn requests, _opts -> - assert length(requests) == 1 - {:ok, format_responses(["0x0000000000000000000000001000000000000000000000000000000000000001"])} + assert length(requests) == 2 + + {:ok, + format_responses([ + "0x0000000000000000000000001000000000000000000000000000000000000001", + "0x0000000000000000000000006f7a73c96bd56f8b0debc795511eda135e105ea3" + ])} end )