Closed 3esmit closed 4 weeks ago
when user stakes, bonusMP should be generated from APY(balance, secondsLocked)
This is happening here: https://github.com/vacp2p/staking-reward-streamer/blob/286bfd2ff43732b395682917c9d81f24fa81cf2f/src/RewardsStreamerMP.sol#L83-L88
when user unstakes, bonusMP should be recalculated based on new APY(balance, secondsLocked)
Currently "bonusMP" are just an increase in the userMP
, so when you unstake, userMP
gets reduced accordingly, so doespotentialMP
. This is happening here:
https://github.com/vacp2p/staking-reward-streamer/blob/286bfd2ff43732b395682917c9d81f24fa81cf2f/src/RewardsStreamerMP.sol#L122-L124
and if it was locked before, the bonus would be lost
This indeed is not taken into account atm.
when considering MAX_MULTIPLIER, the bonusMP should not be taken in account, otherwise, a user that locked for MAX_LOCKUP_PERIOD would get no (or almost none) increase in MPs.
Not sure what you mean by that. When MPs are calculated, it's done based on thestakedAmount
(which is the same as initialMP
without lock). This can be seen here:
@3esmit so it turns out the bonusMP are reduced correctly.
I've added test cases for this here: https://github.com/vacp2p/staking-reward-streamer/pull/48
Test for this have landed in #48 Closing this.
The definition of the MP logic states that:
APY(balance, secondsLocked)
APY(balance, secondsLocked
) - and if it was locked before, the bonus would be lost