Use APY and protection helpers to preview how a market allocates yield and how a proposed deposit changes Senior protection.
Current APY
const underlyingApy = 0.10; // 10%
const seniorApy = market.calculateSeniorApy(underlyingApy);
const juniorApy = market.calculateJuniorApy(underlyingApy);
console.log("Senior APY:", seniorApy);
console.log("Junior APY:", juniorApy);
| Function | Parameters | Returns | Description |
|---|
calculateSeniorApy(underlyingApy) | underlyingApy: number | number | Current marginal APY for Senior LPs |
calculateJuniorApy(underlyingApy) | underlyingApy: number | number | Current marginal APY for Junior LPs |
underlyingApy is a decimal rate. Use 0.10 for 10%.
APY after deposit
import { TrancheSide } from "@exponent-labs/exponent-sdk/client/tranching";
const seniorApyAfterDeposit = market.calculateSeniorApyAfterDeposit({
trancheSide: TrancheSide.Senior,
amountIn: 1_000_000_000n, // raw SY units for the proposed deposit
underlyingApy: 0.10, // 10% underlying APY
});
const juniorApyAfterDeposit = market.calculateJuniorApyAfterDeposit({
trancheSide: TrancheSide.Junior,
amountIn: 1_000_000_000n, // raw SY units for the proposed deposit
underlyingApy: 0.10, // 10% underlying APY
});
| Parameter | Type | Description |
|---|
trancheSide | TrancheSide | Tranche receiving the proposed deposit |
amountIn | bigint | Proposed SY amount for the preview, in raw SY token units |
underlyingApy | number | Underlying APY as a decimal rate |
syExchangeRate | number | string | Optional decimal exchange-rate override. 1.05 means 1.05 NAV per raw SY unit |
syExchangeRateRaw | bigint | Optional raw fixed-point exchange-rate override. 1_000_000_000_000n means 1.0 |
The preview converts amountIn with the SY exchange rate into raw fixed-point NAV. It does not apply token mint decimals for display.
Senior protection after deposit
const protection = market.calculateSeniorProtectionAfterDeposit({
trancheSide: TrancheSide.Junior,
amountIn: 1_000_000_000n, // raw SY units for the proposed deposit
});
console.log("Protected-until price:", protection.protectionPerBaseToken);
console.log("Max drawdown before Senior loss:", protection.maxDrawdownBeforeSeniorLossPct);
| Return field | Description |
|---|
protectionPerBaseToken | Price floor per base token implied by current Junior protection |
maxDrawdownBeforeSeniorLossPct | Percent market drawdown Junior can absorb before Senior starts losing NAV |
These helpers preview local math. They do not submit a transaction or reserve capacity.