A volatility-adaptive StableSwap on Solana. The curve shape and fees respond to on-chain price action in real time — no oracles, no governance, no keeper keys. Two permissionless cranks drive the brain.
Newton-Raphson solver for the D invariant. Amplification A starts at Amax and ramps toward a target driven by realized volatility. Tight in calm markets, protective when things get rough.
Exponentively weighted moving average of price jumps. λ=0.95 on a 15-minute ring buffer, plus a 1-hour window. σ is annualized to feed fee and A targets.
Piecewise smoothstep from 5 to 100 bps based on σ. EMA smoothed (α=0.9) and rate-limited to 10 bps per slot. No jumps, no arb windows.
StableSwap blends constant-sum and constant-product via a single parameter A. The D invariant stays constant across swaps. Volatility tightens the curve and raises fees; calm relaxes both.
4A(x + y) + D = 4AD + D³ / (4xy)
A(σ) = A_max · exp(−k·σ)
≈ A_max · (1 − k·σ/100)
fee(σ) = 5 bps if σ ≤ 15%
= 5 + 25·S((σ−15%)/60%) bps if 15% < σ < 75%
= 30 + 70·S((σ−75%)/45%) bps if 75% ≤ σ < 120%
= 100 bps if σ ≥ 120%
σ(returns) = √(EWMA) · √(SECONDS_PER_YEAR / BUCKET_SECONDS)
EWMA_t = λ · EWMA_{t-1} + (1−λ) · return_t² with λ = 0.95
A_ramp = linear interp over 9000 slots (~1h)
when |target − A| / A > 10%Sixteen pages. The math, the on-chain design, the adaptive-fee results — written up, not blogged.
Read the paper→A Solana AMM whose bonding curve morphs in response to realized volatility. StableSwap, EWMA σ, and dynamic fees — end to end.