yield-amm is an AMM purpose-built for trading a principal token (PT) against
its underlying. The invariant makes prices converge to 1:1 as
time-to-maturity approaches 0.
Accounts
Pool
["pool", market].
| Field | Type | Notes |
|---|---|---|
market | Pubkey | Paired split-engine market |
underlying_mint | Pubkey | Vault share mint |
pt_mint | Pubkey | PT mint |
lp_mint | Pubkey | LP share mint |
underlying_reserve_account | Pubkey | Vault share token account |
pt_reserve_account | Pubkey | PT token account |
underlying_reserves, pt_reserves | u64 | Mirrors token accounts |
total_lp | u64 | LP supply |
maturity | i64 | unix |
total_duration | i64 | seconds (maturity − creation) |
Pool methods
time_factor(now) = clamp((maturity - now) / total_duration, 0, 1).compute_k(t) = underlying_reserves × pt_reserves^t.get_pt_out(underlying_in, t), solvek / (x + amount_in)for the exponent .get_underlying_out(pt_in, t), inverse.
Instructions
| Instruction | Purpose |
|---|---|
create_pool | Seed reserves, set maturity and total_duration |
swap | Underlying ↔ PT with 30 bps fee, slippage-protected |
add_liquidity | Balanced add, mint LP |
remove_liquidity | Burn LP, withdraw proportional reserves |
t < 0.001 of maturity to avoid exponent blow-up. At
that point PT is essentially at par, just call redeem_pt on the split engine.
Math helpers (kimia-math)
pow_frac(base, exponent),exp(exponent × ln(base))via range-reduced Taylor series. Error < 0.05%.mul_fp,div_fp, u128-intermediate fixed-point ops, always rounds down.
Errors
SwapDisabledNearMaturity, SlippageExceeded, InsufficientLiquidity,
MathOverflow, AlreadyMatured.
Read next
Yield-AMM concept
Full derivation of the invariant and fees.
Math reference
pow_frac, ln, exp.

