Stake Account
The process of updating registry and pool balances as described above does not describe how an account holder claims ownership of a pool slot and reading the pool data shows only an array of staked amounts.
How do we know which slot belongs to which account? One option would be to record the address of the stakeholder on the pool slot, however that would mean an additional storage of 3.2KB of data (an address is 32 bytes, and there 100 slots) that must be paid for by the account registering a staking pool and could cause some privacy concerns as it would allow visibility into account balances. Additionally, a single account could occupy/block several (or all) slots across several pools, as there would be no on-chain way to check all pools whether that address already occupies a slot.
Instead, the process of staking utilizes another small data account which is created the first time an account creates a stake. This account is created by the ovr-program with a PDA generated with 2 prefixes: ALLOVR_AOVR_STAKE and the stakeholder account address. If this account does not exist, it will be created, and 4 pieces of data will be stored inside:
Pool Index: an 8-bit unsigned integer that stores a value between 0 and 99 representing the index in the array of pools in the Staking Pool Registry
Slot Index: an 8-bit unsigned integer that stores a value between 0 and 99 representing the index in the array of stakes (slot) in the Staking Pool
Withdrawal Request: 64-bit unsigned integer representing the amount the stakeholder would like to withdraw
Withdrawal Request Date: The date the withdrawal request was made, used to enforce minimum stake time (see below)
As this is PDA includes the stake holder’s address, it is proof that they are the holder of the slot specified within (operations such as stake and withdraw of course require signing)
Caveat: there is a possibility, though unlikely, that the PDA can be generated off-chain for a specific account, and a small amount of SOL can be deposited to it, blocking that account from being able to stake as the account is already created with inadequate size.
Last updated