vacp2p / staking-reward-streamer

MIT License
0 stars 0 forks source link

XPToken: add a mint function and make calculate balances summing storage balance + external balance #53

Closed gravityblast closed 4 weeks ago

gravityblast commented 1 month ago

XP balance for any given account is whatever MP the account has in the staking contract + whatever XP has been allocated to that account, if any.

Some admin can mint/allocate XP to accounts if there's any available. The allowance is always stakingContract.totalMP * 3

some examples:

Staking contract has 300 totalMP, 3 stakers, 100 MP each. balanceOf(staker) will give 100 + allocatedBalance for each staker 300 * 3 XP are available for allocation

Also, when stakers unstake, totalMP decreases, meaning mintAllowance decreases as well. Already allocated XP stay unaffected.

Example:

User stakes 100 SNT, generates 100 MP 300 XP are now available for allocation Admin allocats 250 XP to some address A User unstakes 100 SNT, resulting in totalMP = 0 Address A still owns 250 XP

--> totalSupply: 250, mintAllowance: 0