forked from liquity/bold
-
Notifications
You must be signed in to change notification settings - Fork 15
feat: add redemption with fixed fee #31
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
Merged
philbow61
merged 3 commits into
feat/mento-v3
from
feat/support-fixed-redemptions-for-rebalancing
Jan 17, 2026
Merged
feat: add redemption with fixed fee #31
philbow61
merged 3 commits into
feat/mento-v3
from
feat/support-fixed-redemptions-for-rebalancing
Jan 17, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
baroooo
reviewed
Dec 19, 2025
bowd
approved these changes
Jan 14, 2026
bowd
left a comment
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.
LGTM, the fee as a parameter is the one thing that felt a bit off and “code smell”-ish, but I don’t see a better way to do that now especially given that we don’t know how the economics will play and and we’ll want to tweak these.
nvtaveras
approved these changes
Jan 17, 2026
bowd
added a commit
to mento-protocol/mento-core
that referenced
this pull request
Jan 19, 2026
### Description This Pr adds rebalancing to the thresholds defined in the fpmm. This meant changing the formulas for the target amounts: PoolPrice larger thresholds: Everything after the arrow can be ignored 😁 <img width="687" height="622" alt="image" src="https://github.com/user-attachments/assets/c2e1051c-d3a4-4fe0-9e28-3f02c44788fd" /> PoolPrice smaller thresholds: <img width="552" height="589" alt="image" src="https://github.com/user-attachments/assets/db41356c-15a8-4363-91ab-e2afc89b3ed5" /> This Pr also integrated the new fixed fee redemption mechanism in the bold repo mento-protocol/bold#31. You need to checkout this branch from the lib/bold folder in order to build the repo until it is merged. There is still some precision loss on the contraction side of the CDPLiquidityStrategy that I wasn't able to fully erase: My current theory is that it is caused by: 1. The incentives being in bps and the redemption fee in 18dec 2. The redemption potentially hitting multiple troves vs the strategy calculating the collReturned in a single calculation 3. Since we deduct the protocol incentive from the amount we want to redeem and apply the redemptionFee on that reduced amount, we need to calculate the redemptionFee such that the redemptionFee matches the incentive in bps we configured: `if (protocolIncentiveBpsContraction > 0 && liquiditySourceIncentiveBpsContraction > 0) { redemptionFee = (protocolIncentiveBpsContraction * BPS_DENOMINATOR * BPS_TO_FEE_SCALER) / (BPS_DENOMINATOR - liquiditySourceIncentiveBpsContraction); }` Currently, this diff is solved by a small wiggle room I added to the _rebalanceCheck(), allowing up to 10 wei diff on the amountIn which is not great. I also added a check for when the redemption returns more collateral than what we expected: In that case, we transfer that access collateral to the protocolFeeRecipient again, not great (These amounts are at max aroun 2000wei range on large rebalances and are most likely also caused by the redemptionFee calculation vs LiquiditySourceIncentiveBps ) What's missing: - slither ### Other changes ### Tested ### Related issues ### Backwards compatibility ### Documentation --------- Co-authored-by: bowd <dumbogdan@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pr adds a redemption function with a fixed redemption fee to better support rebalancing.
Still missing:
Unit tests for this new function in the collateral registry. Logic is mostly a reduced version of the existing redemption function but tests should still be added 😉