I'm thinking which events/calls (or whatever) should I take into account to get a number of staked in the protocol? I did this exercise for Reef protocol (but this should be similar for all Substrate protocols) based on 'Staking.Bonded' and 'Staking.Withdrawn' events, but my number does not match with a presented on the reef protocol subscan - 6.2B . I would like to be able to calculate this metric on a wallet level in the future incl. historical values that's why I'm trying to do it based on events.

In other words, which events are responsible for increasing a number of staked tokens and which ones decrease this value?

1 Answer 1


When a nominator has chosen the reward destination as Staked (see here), when staking rewards are paid out, it increases the nominator stake without a Bonded event. Refer code note here and the payout code here. This is the value you might be missing. There is no easy way to take it into account with just reading events.

I believe the best way to do this is to add on every Rewarded event, the rewarded amount if the nominator has set their reward destination Staked which you can know by reading the Payee storage item.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.