Skip to main content
Kimia’s yield-AMM (yield-amm) is purpose-built for trading a PT against its underlying. A classic constant-product AMM wouldn’t work here: PT is contractually worth 1 underlying at maturity, so price must approach par as time runs out.

The yield-space invariant

Instead of xy=kx \cdot y = k, Kimia uses: xyt=kx \cdot y^{t} = k where:
  • xx = reserves of underlying (vault shares),
  • yy = reserves of PT,
  • tt = fraction of time remaining to maturity, in [0, 1].
At pool creation, t=1t = 1, and the curve behaves like a softened constant-product curve. At maturity, t=0t = 0, so yt=1y^t = 1 and the invariant becomes x=kx = k, PT trades 1:1 with underlying. The pool’s curve literally decays into a fixed peg.

Time factor

t=clamp ⁣(maturitynowtotal_duration,  0,  1)t = \text{clamp}\!\left(\frac{\text{maturity} - \text{now}}{\text{total\_duration}},\; 0,\; 1\right)
  • New pool: `now ≈ creation → t ≈ 1 → slippage tolerant**
  • Near maturity: `t → 0 → pool behaves like a 1:1 swap**
Swaps with t < 0.001 are disabled to avoid numerical blow-up in the exponent.

Swap math

Given x, y, t, the pool maintains k = x · y^t through any swap. Underlying → PT k=xyt,ynew=(kx+amount_in)1/t,pt_out=yynewk = x \cdot y^{t}, \qquad y_{\text{new}} = \left(\frac{k}{x + \text{amount\_in}}\right)^{1/t}, \qquad \text{pt\_out} = y - y_{\text{new}} PT → underlying xnew=kynewt,under_out=xxnewx_{\text{new}} = \frac{k}{y_{\text{new}}^{\,t}}, \qquad \text{under\_out} = x - x_{\text{new}} The exponentiation uses kimia-math::pow_frac(base, exponent), which implements exp(exponent · ln(base)) with range-reduced Taylor series. Precision is verified at < 0.05% error across the whole operating range.

Fees

  • Swap fee: 30 bps (0.3%) deducted from the input.
  • LP fee share: All fees stay in the pool, growing k for every LP.

LP mechanics

add_liquidity / remove_liquidity take balanced deposits, the pool won’t accept a single-sided add because that would break the invariant without compensating the other side.
  • First LP: lp_out = geometric_mean(underlying, pt).
  • Subsequent LPs: lp_out = min(underlying_amt / x, pt_amt / y) · total_lp.

Pricing intuition

  • PT discount = fixed rate. If PT trades at 0.98 underlying with 30 days left, the annualized rate is (1/0.98)^(365/30) − 1 ≈ 28%.
  • YT price = 1 − PT price (by conservation). YT is cheap early, expensive as yield accrues.

yield-amm reference

Instructions and account layout.

Fixed-rate intents

How the router uses the AMM to prove an achieved APY.

Math library

pow_frac, ln, exp, how we stay precise under 9-decimal fixed point.