feat(rebalancer): basket-funded redemptions (Section 3)#19
Merged
Conversation
Large redemptions previously reverted in settle when they exceeded idle + deposit inflow, because the value sat in the basket, not USDC. The rebalancer now raises USDC from the basket to fund them before settle pays. - Vault: redemptionFundingNeeded() (pending redeem value exceeds the buffer) and rebalanceReserveUsd() (the full redemption value to hold back as USDC; since NAV already includes the buffer, the basket only sells the shortfall). - Rebalancer: a pending redemption the buffer cannot cover is a first-class trigger, so the keeper may open an epoch regardless of drift or cadence. The reserve is grossed up by max slippage and held back, so targets sum to NAV - reserve, the basket is overweight and sold to USDC, and settle pays the redemption from the topped-up buffer. The reserve is zero when the buffer already covers redemptions, so a pure reweight is unchanged and no existing tests churn. 4 new tests including a full end-to-end where a 150k redemption against a zero buffer is funded by selling the basket. 166 total green.
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
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.
Closes the liquidity gap where a redemption larger than the buffer reverted in
settle, because the value sat in the basket, not USDC. The rebalancer now raises USDC from the basket to fund such a redemption before settle pays it.What changed
redemptionFundingNeeded()(the current epoch's pending redemption value exceeds the idle buffer) andrebalanceReserveUsd()(the full redemption value to hold back as USDC; since NAV already includes the buffer, the basket only sells the shortfall down to reach it).NAV - reserve, the basket becomes overweight and is sold to USDC, andsettlepays the redemption from the topped-up buffer.The reserve is zero whenever the buffer already covers redemptions, so a pure reweight is unchanged and no existing tests churn.
Tests
4 new tests in
test/BasketFundedRedemption.t.sol: the funding-needed view, the funding-triggered epoch opening below the drift gate (keeper-gated), the reserve held back in the targets, and a full end-to-end where a $150k redemption against a zero buffer is funded by selling the basket and paid at settle. 166 total, all green,forge fmtclean.