-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introducing the Aggeregate MP Estimation Logic #32
Conversation
Here, I am not sure the iEpoch.expMPsToBeMinted can be accessed from mintMultiplier function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mart1n-xyz iEpoch
does indeed not exist there. You need to know which user epoch you're operating on.
@@ -195,6 +200,7 @@ contract StakeManager is Ownable { | |||
uint256 increasedMultiplier = calcMaxMultiplierIncrease( | |||
account.balance * (MP_APY * deltaTime), | |||
account.multiplier); | |||
iEpoch.expMPsToBeMinted += account.balance * (MP_APY * deltaTime)-increasedMultiplier //TODO:this might need to be returned and done in the loop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iEpoch
does not exist inside this function.
Inside processAccount()
it's created for every iteration: https://github.com/logos-co/staking/pull/32/files#diff-7c9d8f98d816b0c54f20f2c5790ef649167479fd4f527d3f4bf4b0c6c220f028R180
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I assumed this would be an issue. I need to think about how to circumvent this.
@@ -164,6 +166,8 @@ contract StakeManager is Ownable { | |||
//create new epoch | |||
currentEpoch++; | |||
epochs[currentEpoch].startTime = block.timestamp; | |||
epochs[currentEpoch].expMPsToBeMinted = stakeSupply*MP_APY/52; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this 52
coming from? Is this for 52 weeks?
If yes, then let's introduce a constant for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, 52 weeks = 1 year
@mart1n-xyz I believe we can close this PR. There has been some changes in this part in #47 and AFAIK @3esmit is working on updating the MP estimation logic right now. Can you please give me a ping here if this is okay to be closed? |
Yes, feel free to close. Me and @3esmit discussed the points in question and Ricardo's next iteration should address this. |
Thank you for the update! |
Description
The expected number of MPs generated in an epoch is estimated when it is started. This is used to distribute rewards. If users are not able to mint all. expected MPs due to the limit, the estimated is reduced by this amount and subsequent claimants are served with a more accurate estimate.
Checklist
Ensure you completed all of the steps below before submitting your pull request:
forge snapshot
?pnpm lint
?forge test
?