Repository navigation
feat: let deployers choose critical and initial reserve ratios - #63
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Zahnentferner
left a comment
There was a problem hiding this comment.
Remember to always check whether AI's comments and docs make sense.
| - each beta fee coefficient is at most `1e18` | ||
| - the per-second volume retention multiplier is at most `1e18` | ||
| - the critical reserve ratio is at least `1e18` and below the upper reserve ratio | ||
| - the critical reserve ratio is between `1e18` and `15e17` (100%–150%), inclusive |
There was a problem hiding this comment.
I don't see anything in the solidity code requiring the critical reserve ratio to be between 100% and 150%. And that's fine. This comment in the readme appears to be wrong.
There was a problem hiding this comment.
What is necessary is that:
- the critical reserve ratio
cneeds to be such thatc > 1andc < 2. - the initial reserve ratio
ineeds to be such thatc < i < 2.
Both c and i should be chosen by the deployer.
The frontend should recommend a c between 101% and 105%. But this recommended range does not need to be enforced by the contract.
There was a problem hiding this comment.
understood bruno, i will remove the 150% limit and let deployers choose both ratios, with 100% < critical < initial < 200%. i will update the README and add the 101%–105% recommendation to the frontend.
| - the pegged asset name and symbol are not empty | ||
| - the Proton name and symbol are not empty | ||
|
|
||
| The 150% maximum matches the creation form and leaves room below the 200% upper |
There was a problem hiding this comment.
This entire paragraph seems to be wrong and misplaced, because this repo is only about the contract. References to the frontend's creation form are out of place.
Addressed Issues:
No related issue — follows the review request to let deployers choose both reserve-ratio settings without a 150% cap.
Screenshots/Recordings:
Not applicable. This PR changes contracts, tests and documentation.
Additional Notes:
The critical ratio must be strictly above 100% and below 200%. The deployer also chooses an initial seed-issuance ratio strictly above the critical ratio and below 200%.
The factory passes the chosen initial ratio to the one-time
initialFissioncall. The fixed 150% target is removed. No additional storage variable is needed.Existing fee treatment is preserved. Retained fission fees and rounding can increase the actual initialized ratio above the selected issuance ratio, so initialization also rejects an actual ratio at or below the critical ratio or at or above 200%.
The README describes these rules and removes the previous 150% restriction and creation-form justification.
Tests cover strict boundaries, successful deployment above 150%, deployer-selected initial ratios, invalid settings, retained fees and rollback. Existing fixtures use valid settings under the new strict bounds.
Validation completed locally:
git diff --checkFactory runtime: 23,597 bytes, leaving 979 bytes below the deployment limit under the tested settings.
This replaces the earlier 150% cap proposal. It does not change peg-adjustment steps or claim recovery for every narrow operating range.
The factory deployment function gains an initial-ratio argument, and
initialFissiongains the corresponding argument. The frontend ABI and creation form require a matching update. The 101%–105% critical-ratio recommendation belongs in that frontend update and is not enforced by the contract.This PR does not deploy contracts. Existing deployments are unchanged.
AI Usage Disclosure:
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.
Check one of the checkboxes below:
Checklist