Skip to main content
Withdrawals burn LP shares and return SY through ixWithdraw, or return base assets through ixWrapperWithdraw. For raw/display units and fee-rate scale, see Units and Fees.

Withdrawal Preview Math

Withdrawal fees are charged before the redemption claim is calculated: withdrawFeeLpShares=lpAmountIn×withdrawFeeRate\text{withdrawFeeLpShares} = \left\lceil \text{lpAmountIn} \times \text{withdrawFeeRate} \right\rceil redeemLpShares=lpAmountInwithdrawFeeLpShares\text{redeemLpShares} = \text{lpAmountIn} - \text{withdrawFeeLpShares} Only redeemLpShares back the user’s asset claim: totalLpSupplynext=currentLpSupplyredeemLpShares\text{totalLpSupply}_{\text{next}} = \text{currentLpSupply} - \text{redeemLpShares} The full lpAmountIn is burned from the user. The fee portion remains as pending protocol LP shares and is minted later through mintProtocolFeeShares. In the simple case where the selected tranche only claims its own SY side, the SY output is: amountOutSY=trancheSyAmount×redeemLpSharestotalLpSupply+1\text{amountOutSY} = \left\lfloor \frac{\text{trancheSyAmount} \times \text{redeemLpShares}} {\text{totalLpSupply} + 1} \right\rfloor When the market has cross-tranche claims from loss or recovery accounting, the program first decomposes the selected tranche’s effective NAV into Senior-source and Junior-source SY claims, scales each claim by redeemLpShares / (totalLpSupply + 1), then sums the resulting SY amounts. See Loss and Gain Waterfalls. lpAmountIn, withdrawFeeLpShares, and redeemLpShares are raw LP units. amountOutSY is raw SY units. If the integration uses ixWrapperWithdraw, minBaseOut is raw base token units after the SY redemption step.

Senior Self-Liquidation Bonus

This branch applies only to Senior withdrawals. It is triggered when the market utilization has reached the configured liquidation threshold: state.financials.utilizationstate.riskConfig.liquidationUtilization\text{state.financials.utilization} \ge \text{state.riskConfig.liquidationUtilization} Read state.financials.utilization, state.riskConfig.liquidationUtilization, and state.riskConfig.srSelfLiquidationBonus. The bonus is based on the Senior user’s claim after withdrawal fees and before the bonus is added. The program first computes the desired bonus in raw fixed-point NAV: desiredBonusNAV=baseClaimNAV×srSelfLiquidationBonus\text{desiredBonusNAV} = \left\lfloor \text{baseClaimNAV} \times \text{srSelfLiquidationBonus} \right\rfloor Then it caps the result: nominalBonusNAV=min(desiredBonusNAV,jrEffectiveNAV,maxUtilizationNeutralBonusNAV)\text{nominalBonusNAV} = \min( \text{desiredBonusNAV}, \text{jrEffectiveNAV}, \text{maxUtilizationNeutralBonusNAV} ) maxUtilizationNeutralBonusNAV is the internal cap that prevents the bonus from increasing post-withdraw utilization. With: E=srRawNAV+ceilFixed(jrRawNAV×β)E = \text{srRawNAV} + \operatorname{ceilFixed}(\text{jrRawNAV} \times \beta) W=seniorClaimFromSeniorNAV+seniorClaimFromJuniorNAV×βW = \text{seniorClaimFromSeniorNAV} + \left\lfloor \text{seniorClaimFromJuniorNAV} \times \beta \right\rfloor Cs=juniorClaimOnSeniorRawNAVC_s = \text{juniorClaimOnSeniorRawNAV} the first cap is: seniorSourceCap=W×jrEffectiveNAVEjrEffectiveNAV\text{seniorSourceCap} = \left\lfloor \frac{W \times \text{jrEffectiveNAV}} {E - \text{jrEffectiveNAV}} \right\rfloor If seniorSourceCap <= C_s, the program uses seniorSourceCap. Otherwise it uses the mixed-source cap: mixedSourceCap=(W+Cs×(1β))×jrEffectiveNAVEjrEffectiveNAV×β\text{mixedSourceCap} = \left\lfloor \frac{ \left(W + \left\lfloor C_s \times (1 - \beta) \right\rfloor\right) \times \text{jrEffectiveNAV} } {E - \left\lfloor \text{jrEffectiveNAV} \times \beta \right\rfloor} \right\rfloor If either cap denominator is zero, the program treats that cap as zero. After the cap is selected, the bonus NAV is converted back into raw SY units with floor rounding: bonusSeniorSY=min(nominalBonusNAV,Cs)syExchangeRate\text{bonusSeniorSY} = \left\lfloor \frac{\min(\text{nominalBonusNAV}, C_s)} {\text{syExchangeRate}} \right\rfloor bonusJuniorSY=nominalBonusNAVmin(nominalBonusNAV,Cs)syExchangeRate\text{bonusJuniorSY} = \left\lfloor \frac{\text{nominalBonusNAV} - \min(\text{nominalBonusNAV}, C_s)} {\text{syExchangeRate}} \right\rfloor The Senior withdrawal output becomes: amountOutSY=baseAmountOutSY+bonusSeniorSY+bonusJuniorSY\text{amountOutSY} = \text{baseAmountOutSY} + \text{bonusSeniorSY} + \text{bonusJuniorSY}

Withdrawal Example

Assume a Junior withdrawal in a market with no cross-tranche claims:
InputValue
lpAmountIn1,000 Junior LP
juniorWithdrawProtocolFee0.10%
totalJuniorLpSupply10,000 Junior LP
juniorSyAmount10,000 SY
Then: withdrawFeeLpShares=1,000×0.001=1\text{withdrawFeeLpShares} = \left\lceil 1{,}000 \times 0.001 \right\rceil = 1 redeemLpShares=1,0001=999\text{redeemLpShares} = 1{,}000 - 1 = 999 amountOutSY=10,000×99910,000+1=998\text{amountOutSY} = \left\lfloor \frac{10{,}000 \times 999}{10{,}000 + 1} \right\rfloor = 998 The user burns 1,000 Junior LP and receives 998 SY before any wrapper redemption into the base asset. Market accounting total Junior LP supply decreases by 999, from 10,000 to 9,001, and 1 Junior LP share is added to pending withdrawal protocol fees. If using ixWrapperWithdraw, the SY is redeemed through the linked SY program after the tranching withdrawal.
Senior withdrawals can include a self-liquidation bonus when utilization is at or above liquidationUtilization. Do not approximate this path for liquidation or lending logic from the simplified formula alone. Read state.financials.utilization, state.riskConfig.liquidationUtilization, and use conservative minAmountOut or minBaseOut bounds.