Staking
With all the concepts above covered, it is now possible to walk through the process of staking AOVR. For this example, we will assume that there is an available slot in a pool, and that there are no amounts owing to that pool (no rebalancing required).
The stake function on the ovr-program is called with the following parameters
Stakeholder account (payer)
AOVR Staking Pool Treasury account
Staking Pool Registry account
Staking Pool account
Staking Account
Amount of AOVR to stake
Index of staking pool
Index of slot
Whether to rebalance (default to false)
By reading the Staking Registry data, the ovr-program checks that the Staking Pool at the staking pool index provided is registered and that the address stored on the registry matches the staking pool account address passed in
The staking pool data is read next, and the ovr-program checks that the slot at the provided slot index is free, meaning the balance is 0
The stake account PDA as described above in the Stake Account section is generated, and checked against what is passed into the function
If account does not exist it is created, and the appropriate values are stored inside
If the account does exist, the pool and slot indexes are compared, and if they match execution can proceed
The specified amount of AOVR is withdrawn from the stakeholder’s account and sent to the AOVR Staking Pool Treasury
The pool account totals, and slot balance are updated
The pool registry account totals and pool balance are updated
Last updated