Units and Display Values
The examples in this section use normalized values when they say so. The program and SDK operate on raw values.| Term | Raw dimension | Display guidance |
|---|---|---|
amountBase, minBaseOut | Base token smallest units | Divide by the base token mint decimals |
amountIn, amountInSY, amountOutSY, seniorSyAmount, juniorSyAmount | SY token smallest units | Divide by the SY mint decimals |
lpAmountIn, grossLpOut, netLpOut, totalLpSupply, pending fee shares | Selected-tranche LP mint units | Divide by the LP mint decimals. LP mints are initialized with the SY mint decimals |
syExchangeRate | Number fixed-point exchange rate applied to raw SY units | 1_000_000_000_000 means 1.0 |
NAV values, valueAllocated, lpPrice, capacity helpers | Number fixed-point values with 1_000_000_000_000 as one unit | Convert the fixed-point scale, then apply the relevant token-decimal display rule |
Fee rates, utilization, coverage, beta, return shares | Number fixed-point ratios | 1_000_000_000_000 means 1.0; display as decimals or percentages |
tranchingFromNumber removes the fixed-point scale only. It does not divide by token decimals. For example, if a 9-decimal SY amount is valued at an exchange rate of 1.0, the raw NAV for 1 displayed SY is 1_000_000_000 * 1_000_000_000_000. After fixed-point conversion, it is still 1_000_000_000 raw token units and should be divided by 10^9 for UI display.
Fee Scope
Deposit and withdrawal previews apply transfer fees only. Market-update fees such assrProtocolFee, jrProtocolFee, and juniorReturnProtocolFee are charged during market sync, converted into pending protocol LP shares, and reflected in the market state before the deposit or withdrawal quote is calculated.
Do not subtract market-update fees again in an integration preview. Reload the market, use the current effective NAV and LP supply, then apply only the selected deposit or withdrawal fee.
All fee fields are Number fixed-point rates. After tranchingNumberToRaw, a raw fee rate of 2_000_000_000 means 0.002, or 0.20%.
| Flow | Fee field used in the preview | Fee base |
|---|---|---|
| Senior deposit | seniorDepositProtocolFee | grossLpOut |
| Junior deposit | juniorDepositProtocolFee | grossLpOut |
| Senior withdrawal | seniorWithdrawProtocolFee | lpAmountIn |
| Junior withdrawal | juniorWithdrawProtocolFee | lpAmountIn |
1.0. If rounding makes the user’s net LP output or asset output zero, the transaction fails its minimum-output check.
Market-Update Fees
Market-update fees use NAV bases before they become LP shares: The*FeeNAV values are raw fixed-point NAV values. The program converts each tranche’s NAV fee into pending raw LP shares:
These market-update fees accrue only when the resulting market state is Active. The Junior gain fee is skipped when the net Junior gain is at or below jrNetAssetDustTolerance, and Senior return fees are skipped when the distributable Senior gain is at or below srNetAssetDustTolerance.
For deposit and withdrawal transfer-fee formulas, see Deposit Previews and Withdrawal Previews.