Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

mart1n-xyz
Copy link
Collaborator

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:

  • Added natspec comments?
  • Ran forge snapshot?
  • Ran pnpm lint?
  • Ran forge test?

@mart1n-xyz
Copy link
Collaborator Author

Here, I am not sure the iEpoch.expMPsToBeMinted can be accessed from mintMultiplier function.

@mart1n-xyz mart1n-xyz requested a review from 3esmit October 9, 2023 09:47
Copy link
Collaborator

@0x-r4bbit 0x-r4bbit left a 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
Copy link
Collaborator

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

Copy link
Collaborator Author

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;
Copy link
Collaborator

@0x-r4bbit 0x-r4bbit Oct 9, 2023

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.

Copy link
Collaborator Author

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

@0x-r4bbit
Copy link
Collaborator

@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?

@mart1n-xyz
Copy link
Collaborator Author

Yes, feel free to close. Me and @3esmit discussed the points in question and Ricardo's next iteration should address this.

@0x-r4bbit
Copy link
Collaborator

Thank you for the update!

@0x-r4bbit 0x-r4bbit closed this Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants