Fix stake_snapshotting.ex

pull/3712/head
POA 4 years ago
parent 8faa85a4b4
commit 0bbf4cc526
  1. 2
      .dialyzer-ignore
  2. 12
      apps/explorer/lib/explorer/staking/stake_snapshotting.ex

@ -25,4 +25,4 @@ lib/explorer/exchange_rates/source.ex:113
lib/explorer/smart_contract/verifier.ex:89
lib/block_scout_web/templates/address_contract/index.html.eex:118
lib/explorer/staking/stake_snapshotting.ex:15: Function do_snapshotting/7 has no local return
lib/explorer/staking/stake_snapshotting.ex:214
lib/explorer/staking/stake_snapshotting.ex:216

@ -46,6 +46,8 @@ defmodule Explorer.Staking.StakeSnapshotting do
|> Enum.zip(pool_staking_addresses)
|> Map.new()
abi = abi_clarify_signatures(abi, new_signatures)
# get snapshotted amounts and active delegator list for the pool for each
# pending validator by their pool id.
# use `cached_pool_staking_responses` when possible
@ -229,6 +231,16 @@ defmodule Explorer.Staking.StakeSnapshotting do
Publisher.broadcast(:stake_snapshotting_finished)
end
defp abi_clarify_signatures(abi, new_signatures) do
if new_signatures do
abi
else
Jason.decode!(
~s([{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"stakeAmountTotal","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"stakeAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"poolDelegators","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"validatorShare","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"delegatorShare","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}])
)
end
end
defp address_bytes_to_string(hash), do: "0x" <> Base.encode16(hash, case: :lower)
defp snapshotted_pool_amounts_requests(pool_id, pool_staking_address, block_number, new_signatures) do

Loading…
Cancel
Save