The following pattern shows the state reads that are useful before routing a user into a tranche or accepting tranching LP tokens in another protocol.
tranchingFromNumber only converts Exponent Tranching Number fixed-point values. It does not divide token amounts by mint decimals. Balance, NAV, and transaction amount displays usually also need the SY, base, and LP mint decimals.Transaction Builders
A transaction can then be built with the instruction that matches the user’s input and desired output:| User starts with | User wants | SDK method |
|---|---|---|
| Base asset | LP tokens | ixWrapperDeposit |
| SY | LP tokens | ixDeposit |
| LP tokens | SY | ixWithdraw |
| LP tokens | Base asset | ixWrapperWithdraw |
| Method | Output guard |
|---|---|
ixWrapperDeposit | minLpOut |
ixDeposit | minLpOut |
ixWithdraw | minAmountOut |
ixWrapperWithdraw | minBaseOut |
Integration Sequence
Most integrations follow this sequence:TranchingMarket.load(...)creates the market context.market.reload()refreshes state before pricing or transaction construction.market.lpMint(trancheSide)identifies the selected LP mint.getSrLpPriceNetAsset()orgetJrLpPriceNetAsset()provides the effective-NAV price input.state.marketState,state.statusFlags, utilization, and recovery timestamps describe the current lifecycle and risk state.- Capacity Helpers provide remaining Senior or Junior room.
- APY and Protection helpers can show expected Senior/Junior return and Senior drawdown protection.
- SDK instruction builders construct the deposit or withdrawal transaction, with
minLpOut,minAmountOut, orminBaseOutas output guards. - Lending integrations usually treat
FixedTermRecoveryas a Senior redemption lock and apply conservative collateral factors to Junior LP because Junior absorbs first losses.
Related SDK Pages
Read Functions
SDK getters for market state, LP prices, capacity, APY, and token accounts.
TypeScript Instructions
SDK builders for deposits, withdrawals, and wrappers.