-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set blockscout to work with staking app in POSDAO network #1709
Comments
@saneery can you please describe in more details what is |
@ayrat555 there is POSDAO white paper, but I think it's unnecessary to describe POSDAO essence in details here. For us, |
Description
POSDAO
There are some new essences in the staking app:
Every validator and candidate has mining address and pool address (staking address). Delegators can stake on these pools. When a user makes a stake on himself, he becomes a candidate.
Users make stakes during an epoch, at the end epoch new validators set will be elected from active pools.
Rules of POSDAO
Goals
The interface is drawn here https://projects.invisionapp.com/share/YPQNPDTW4ZB#/screens/348397338
from #1476
The POSDAO contracts' methods: https://poanetwork.github.io/posdao-contracts/docs/
Description of updates
Database changes
There are new tables in the DB
staking_pools
All this fields get from contracts' methods ( isValidator, validatorCounter, isValidatorBanned, bannedUntil, banCounter, isPoolActive, poolDelegators, stakeAmountTotalMinusOrderedWithdraw, stakeAmountMinusOrderedWithdraw)
staking_pools_delegators
This table will be filling, when pools fetched from the blockchain.
For every pool, there will fetch current list of delegators and replace the previous list from the DB by a new.
Modules
Fetchers
There is one fetcher
Fetcher.StakingPools
. It fetches current list of pools and list of delegators for every pool from the network on the per block and sends them to import runner.It runs by block fetcher:
https://github.com/poanetwork/blockscout/blob/master/apps/indexer/lib/indexer/block/fetcher.ex#L285
It fetches pools by call
Explorer.Staking.PoolsReader.get_pools/0
and fetches additional data by call
Explorer.Staking.PoolsReader.pool_data/1
Modules
Explorer.Staking.PoolsReader
is a module that calls contract methods. There are two base contracts: staking_contract and validator_contract.The module has two base functions:
get_pools/0
- calls getPools and getPoolsInactive. This two methods return a list ofstaking_address
pool_data/1
- receivesstaking_address
and calls miningByStakingAddress to getmining address
bystaking address
, after that calls this list of methods: isValidator, validatorCounter, isValidatorBanned, bannedUntil, banCounter fromvalidator_contract
and isPoolActive, poolDelegators, stakeAmountTotalMinusOrderedWithdraw, stakeAmountMinusOrderedWithdraw fromstaking_contract
. In the future will one method that returns all data about pool.Importer
There is two importers
Explorer.Chain.Import.Runner.StakingPools
andExplorer.Chain.Import.Runner.StakingPoolsDelegators
they just insert a list of entries to the database.Config
To run blockscout with the POSDAO you need to set following envs:
If there no POS_VALIDATOR_CONTRACT and POS_STAKING_CONTRACT fetchers are not run
What is added
What is pending
What is to be done
Fetcher
Test setup
To run the test setup you need to:
config/node1.toml
to access websocket connection:npm run all
iex -S mix phx.server
You can use some test accounts from
posdao-test-setup/accounts/keystore
, the password istestnetpoa
. Accounts with test coins are prefixed withUTC
.The text was updated successfully, but these errors were encountered: