The staking math allows users to freely deposit tokens, and once every N hours (less than X hours always) a snapshot is taken, which will account for the total amount staked at a given point in time.
- Those who staked between `snapshotN` and `snapshotN+1` are eligible to claim their share of the rewards allocated for that period of time.
- Allocation of rewards are done at the ending of the staking period —in this case at the moment of `snapshotN+1` )
Rewards are distributed between stakers whereby users will receive the same percentage of the rewards with percentages dictated by the amount staked as a percentage of the total staked at the time of the snapshot.
Assume user staked `S` tokens between 2 snapshots, and total staked was `TS` , where `TS >= S` strictly, user will get `S/TS * REWARDS_POOL`
Example: Alice stakes 100 tokens, Bob stakes 300 tokens, and Mark stakes 600 tokens for a total of 1000 tokens staked between two snapshots.
Rewards pool is 200 tokens so the distribution will be as follows:
Alice : 100/1000 * 200, Bob : 300/1000 * 200 , Mark : 600/1000 * 200 or 20, 60 and 120 tokens respectively earned.