-
Notifications
You must be signed in to change notification settings - Fork 11
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
Update locking formula #375
Conversation
Update locking formula
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
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.
great work (esp given deadline pressure!)
- i took some time to understand the new requirements and read through the rarible docs again as well
- reviewed the code changes
- reviewed the tests (although my review here wasn't as deep, so 2nd review should dig a bit deeper here)
- ran the tests locally
think @bowd should be final reviewer on this
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.
🚀
|
||
uint256 amountMultiplied = uint256(amount) * uint256(multiplier); | ||
lockAmount = uint96(amountMultiplied / (ST_FORMULA_DIVIDER)); | ||
lockAmount = uint96(amountMultiplied / (ST_FORMULA_BASIS)); | ||
require(lockAmount > 0, "voting power is 0"); |
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.
Not sure if this require
is really needed anymore unless both minCliffPeriod and minSlopePeriod are configured to 0, but it's probably good to have anyway
Description
Currently the voting power formula looks like this (slightly simplified):
We want to bring the system closer to the classical veCurve formula, by changing it to:
More details can be seen here #373
Since this formula sits in the core of the voting power calculations, reviews should be on a broader level. Please go through code changes, test calculations and more importantly how this may affect the whole locking mechanism.
Known issues:
Other changes
Updated the tests to use the exact amounts and not approximations
Removed unused imports
Tested
Fixed the tests related to change. Actual calculations are added as comments.
Some extra fuzz tests are WIP and will be added with a separate PR
Related issues