Skip to main content
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);
FunctionParametersReturnsDescription
calculateSeniorApy(underlyingApy)underlyingApy: numbernumberCurrent marginal APY for Senior LPs
calculateJuniorApy(underlyingApy)underlyingApy: numbernumberCurrent 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
});
ParameterTypeDescription
trancheSideTrancheSideTranche receiving the proposed deposit
amountInbigintProposed SY amount for the preview, in raw SY token units
underlyingApynumberUnderlying APY as a decimal rate
syExchangeRatenumber | stringOptional decimal exchange-rate override. 1.05 means 1.05 NAV per raw SY unit
syExchangeRateRawbigintOptional 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 fieldDescription
protectionPerBaseTokenPrice floor per base token implied by current Junior protection
maxDrawdownBeforeSeniorLossPctPercent market drawdown Junior can absorb before Senior starts losing NAV
These helpers preview local math. They do not submit a transaction or reserve capacity.