astar-apps icon indicating copy to clipboard operation
astar-apps copied to clipboard

Upgrade Dapps Staking indexer to aggregate total ASTR and SDN staked

Open bobo-k2 opened this issue 2 years ago • 0 comments

Motivation It would be very useful to have historical information about staked amounts on the portal dashboard page. This is first ticket in series of tickets related to adding total staked ASTR/SDN on the dashboard page.

Suggested Solution Upgrade Dapps Staking indexer project to support TVL and total tokens staked. Indexing for Astar and Shiden should be supported.

TVL indexer already exists in separate project and it should be moved to Dapp Staking indexer project.

Total staked is a new feature which should be added to the project. Staked value should be aggregated on daily basis. To achieve that BondAndStake, Withdrawn and WithdrawFromUnregistered events should be listened. The formula for calculating ASTR staked should be something like:

staked = balance_bonded - balance_withdrawn - balance_withdrawn_from_unreg

Alternatives Not at the moment. Any ideas are welcome.

Additional Information Please comment if ticket is not clear enough.

bobo-k2 avatar Apr 24 '23 18:04 bobo-k2