Staking Pool Registry

To minimize the number of accounts that need to be passed into the inflation run function, a single, ovr-program controlled data account is created with a known PDA generated by the ovr-program. The address has the prefix of ALLOVR_AOVR_STAKING_POOL_REGISTRY.

The account must be created through a function on the ovr-program, and hence will be created if it does not exist by the inflation run function, which can be cranked by anyone willing to pay the transaction and account rent exemption fees. While creating the account, appropriate space must be reserved to hold the address and staked amounts of all staking pools (discussed below). However, there is a limit to how many entries can be stored in the registry driven by Solana’s computation limits and the need for this execution to be atomic. There are 100 registry entries for 100 staking pools, and each staking pool will have 100 staking slots. This allows for 10 000 stakeholders at any one time.

The Staking Pool Registry account will hold data in the following format (whole numbers are for simplicity, in reality the smallest fraction of AOVR will be stored i.e., 100 AOVR = 100 000 000 000.

{
    "totalStaked": 900,
    "totalOwed": 100,
    "pools": [
        {
            "poolAddress": "kjs976jgsjhgs7...",
            "staked": 200,
            "owed": 0
        },
        {
            "poolAddress": "gd63hdhduyus77...",
            "staked": 400,
            "owed": 50
        },
        {
            "poolAddress": "8uye63yehdyt7e...",
            "staked": 300,
            "owed": 50
        }
    ]
}

The space for the Staking Pool Registry account must be reserved and rent exemption must be paid at account creation, hence initially the array will be filled with 100 empty placeholders: 00000… , 0, 0.

The process of updating the values on the registry during an inflation run is as follows:

  • Weekly inflation run function is called (by any payer) with the following accounts: ALLOVR DAO AOVR Treasury, Staking Treasury, Staking Pool Registry, AOVR Mint, Payer.

  • If the schedule for the run is correct (not run for 1 week) an amount x of new AOVR is minted as a function of the total supply (the details of these amounts is described elsewhere). In this example let’s assume 200 AOVR are minted, 50% is to go to the treasury and 50% to AOVR stakeholders.

  • Data from Staking Pool Registry is read, and the totalStaked and totalOwed are summed up to get the total value of AOVR invested. In the case of the example above, 1000 AOVR.

  • There are 100 AOVR to distribute to stakeholders (50% of the minted 200 AOVR). The ovr-program now loops through each of the 100 pools in the array and based on the invested amount in each pool, the profits are shared out. In the example data above:

    • Pool 0: 200 staked + 0 owed = 200 AOVR. 200 as percentage of total 1000 AOVR is 20%. 20 AOVR is allocated to that pool and added to the owed field.

    • Pool 1: 400 staked + 50 owed = 450 AOVR. 450 as percentage of total 1000 AOVR is 45%. 45 AOVR is allocated to that pool and added to the owed field.

    • Pool 2: 300 staked + 50 owed = 350 AOVR. 350 as percentage of total 1000 AOVR is 35%. 35 AOVR is allocated to that pool and added to the owed field.

  • The Staking Pool Registry totalOwed value is updated with the new owed value, 100 + 100 = 200.

  • 100 AOVR are sent to the Staking Treasury

  • 100 AOVR are sent to the ALLOVR DAO AOVR Treasury

Let’s recap. No AOVR has been sent to the accounts that have staked AOVR. Rather, a registry of staking pools has been updated atomically. The staking rewards have been sent to an AOVR token account owned by the ovr-program, the Staking Treasury. The data stored in the Staking Pool Registry account now looks like.

{
    "totalStaked": 1000,
    "totalOwed": 200,
    "pools": [
        {
            "poolAddress": "kjs976jgsjhgs7...",
            "staked": 300,
            "owed": 20
        },
        {
            "poolAddress": "gd63hdhduyus77...",
            "staked": 400,
            "owed": 95
        },
        {
            "poolAddress": "8uye63yehdyt7e...",
            "staked": 300,
            "owed": 85
        }
    ]
}

Last updated