Staking Pools

Where the Staking Pool Registry holds information about the total staked and owed amounts per staking pool and which address the pools are located at, Staking Pool accounts hold the details of how much each stakeholder has staked.

The format of the data stored is shown below.

{
    "totalStaked": 300,
    "totalOwed": 20,
    "stakes": [
	  200,
        100,
        0,
        0,
        …
        0
    ]
}

This data represents Pool 0 (the first entry on the staking pool registry) account with address kjs976jgsjhgs7... and 300 AOVR staked and 20 AOVR owed. Inside there are 2 occupied staking slots and the remaining 98 are empty slots with value 0. The total staked represents the sum of all stakes from all slots, and total owed is what should be distributed to all slots.

As with the registry, the space for the staking pool data account must be reserved by initializing an empty array and paying for the rent exemption. This will be done through a RegisterAovrStakingPool function on the ovr-program. For now, let’s assume that the 3 staking pools have already been initialized.

How do we know the balance of a particular slot? At the current state of the example data, there are amounts owing to all 3 stake pools. If no new stakes are made, and no withdrawals are processed, it is not imperative that the owed amounts be distributed (rebalanced) as the balance of each slot can be calculated. For example, looking at Staking Pool 0 and the first staking slot within (at index 0), we see that the pool has 300 AOVR staked, and that it is owed 20 AOVR. Slot 0 holds 200 AOVR, meaning their stake is 66.66% of the total 300 AOVR staked. Pool 0 is therefore owed 66.66% of the 20 AOVR, hence the balance of Slot 0 is 200 + 13.33 = 213.33 AOVR.

However, if new stakes or withdrawals need to be made, rebalancing of owed AOVR in the pool affected must be made to maintain the data integrity.

Last updated