Skip to content

Conversation

@philbow61
Copy link

@philbow61 philbow61 commented Dec 18, 2025

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 😉

Copy link

@bowd bowd left a 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.

@philbow61 philbow61 merged commit 68558a2 into feat/mento-v3 Jan 17, 2026
7 checks passed
@philbow61 philbow61 deleted the feat/support-fixed-redemptions-for-rebalancing branch January 17, 2026 16:43
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants