Skip to main content

Every deposit or withdrawal syncs the market against the current SY exchange rate before validation. An integration preview can become stale if the SY exchange rate, return model, or market state changes before execution. For the lifecycle model, see Market State Model. For utilization math, see Utilization. Utilization and threshold fields are Number fixed-point ratios onchain. A displayed 1.0 is stored as 1_000_000_000_000.

Shared Checks

CheckSourceRaw dimension
Market must not be pausedstate.statusFlags; see Status FlagsBitmask
Deposit amount must meet minDepositAmountstate.riskConfig.minDepositAmount; see TranchingRiskConfigRaw SY units after any wrapper mint
Output must satisfy minLpOut, minAmountOut, or minBaseOutSDK instruction parametersRaw LP, SY, or base token units
LP supply cap must not be exceededmax_senior_lp_supply, max_junior_lp_supply; see TrancheSupplyStateRaw LP mint units
Capacity and utilization must remain validCapacity Helpers, UtilizationCapacity helpers return raw NAV or raw LP depending on helper; utilization is a Number ratio

Senior Deposit

Senior deposits are allowed in Active or FixedTermRecovery, but only when both Senior and Junior impermanent loss balances are zero. The post-deposit utilization must not exceed 1.0: Upost1U_{\text{post}} \le 1 The program compares U_post to UNIT, where UNIT = 1_000_000_000_000. Use getSrRemainingCapacityNetAssetValue() or getSyncedSrRemainingCapacityNetAssetValue() to check remaining Senior room. Senior capacity can be lower than the configured max supply because it is also constrained by available Junior coverage.

Junior Deposit

Junior deposits are allowed only in Active. They are blocked while Senior has unrecovered impermanent loss. Junior deposits increase Junior effective NAV and usually reduce utilization. They are still subject to maxJuniorLpSupply when that cap is non-zero. Use getJrRemainingCapacityNetAssetValue() or getSyncedJrRemainingCapacityNetAssetValue() to check configured Junior capacity.

Senior Withdrawal

Senior withdrawals are allowed only in Active. During the Recovery Period, Senior withdrawals are paused. The recovery window is the market’s fixed-term observation period:
FieldMeaningRaw dimension
state.riskConfig.fixedTermDurationSecDuration of the observation period. 0 disables fixed-term recoverySeconds
state.financials.fixedTermEndTsEnd timestamp for the current recovery periodUnix timestamp seconds
For wallet and lending integrations, treat FixedTermRecovery as a Senior withdrawal lock. You can still transfer Senior LP tokens, but the market will not redeem them until the state returns to Active.

Junior Withdrawal

Junior withdrawals are allowed in Active and FixedTermRecovery, but they cannot reduce protection below the market’s required level. The transaction fails if post-withdraw utilization exceeds 1.0: Upost1U_{\text{post}} \le 1 The program compares U_post to UNIT, where UNIT = 1_000_000_000_000. For integrations that allow Junior LP as collateral, this check is important. A Junior LP balance can be transferable and still fail redemption if withdrawing it would leave Senior under-protected.

Risk Integration Checklist

AreaWhat to check
Senior collateralTreat FixedTermRecovery as a redemption lock
Junior collateralAccount for first-loss exposure and post-withdraw utilization checks
CapacityUse synced capacity helpers when the SY exchange rate may have moved
Slippage protectionSet minLpOut, minAmountOut, or minBaseOut
Observation periodRead fixedTermDurationSec and fixedTermEndTs before assuming redemption timing
For SDK code that reads these values, see SDK Preflight.