Comment on page

# Maths

The staking mechanics incorporate different components in order to fulfil the following purposes:
• Reward long-term stakers without hard locking the assets for longer periods of time than the mandatory 90 days lock.
• Discourage gaming the distributions and reduce volatility (both in pool share and floor price) created by actors trying to do so.
• Converge all long-term stakers shares toward the same nominal value per lizard, over successive distributions, to guarantee a fair distribution process.
Note: This section describes the basic mathematics behind the staking solution. In order to be programmed in Solidity, adjustments will be applied, keeping the same principles.

### Rebase

In order to both reward long-term stakers and discourage gaming distribution, staking is calculated through compounding rewards.
When a lizard is staked, a base weight of 1 is assigned. This weight will then compound at a rate of 0.5% per day.
$W(t)=(1+r)^t$
W(t) = lizard weight t = time staked r = compounding rate

### Distribution

A lizard's share of the pool at a fixed distribution date is then calculated by dividing its weight by the sum of all weights in the pool.
$S=W/P$
S = the lizard's share of the pool W = the lizard's weight at the distribution time P = the sum of all weights in the pool at the distribution time
Since every lizard's staked follow the same rule, if no other lizards are added to the pool, each lizard's share of the pool remains constant in time. A lizard being staked at a later date will have a smaller share of the pool than the others, hence providing an advantage to long-term stakers.

### Reset

Since the pool size inflates over time due to the rebasing, if no other mechanism were introduced, a late staker would never be able to catch up to long-term stakers and reach their nominal share of the pool per lizard (1/number of lizards in the pool).
To reward later participants for staking long-term, the inflation of the pool is partially reset every time a distribution has occurred, hence reducing the difference in share per lizard between the early stakers and late stakers that have been through one or more distributions.

### Examples

This compound inflation will reset every rewards distribution cycle.
Each user is assigned a weight of 100 "shares", rebased at an additional 0.5% daily.
A global total of all shares is maintained and updated each time the stake or un-stake function is called, and whenever a new rewards "pool" is opened up.
A pool is created to represent a reset of inflated shares and additional rewards being claimable. A reset occurring means a user's inflated shares are slashed by 80%. User's inflated shares are calculated as:
$(currentShares - 100)$
However, a user's rewards will still be calculated off their pre-reset values for the corresponding pool created. Only future pools will take into account their reset shares. Users will also have different rewards based on which pool's rewards are being claimed.
Here is an example of this mechanism in action:
1. 1.
User A stakes 10 lizards on day 3 of the staking pool.
2. 2.
The existing staking pool had 1000 deposits on the start day, then another 1000 on day 2.
1. 1.
The existing global shares of day 1 would be 100,500.
2. 2.
The existing global shares of day 2 would be 201,502.5.
3. 3.
Day 3 ended and with User A, 490 more lizards were staked.
1. 1.
User A has a share of 1,005, with the global shares being 252,760.012.
2. 2.
User A has a weight of 0.3976%.
4. 4.
Before day 4 ends, 100,000 USDC is deposited into the pool. An additional 200 lizards were also deposited.
1. 1.
The current global shares are 272,760.012.
2. 2.
User A has a weight of 0.3685%.
3. 3.
User A's reward for pool 1 would be 368.5 USDC.
4. 4.
A reset occurs. The current inflated shares are 2760.012, and after the reset, will be 552.0024. Prior to the reset, the global shares will be 270,552.0024.