Guest User

Untitled

a guest
Feb 18th, 2026
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. Constant product AMM (k = rx * ry) with triple EMA volatility-adaptive fees.
  2. Track three EMAs of price change magnitude in storage:
  3. - Ultra-fast: alpha=800/1000, fee scale=80
  4. - Fast: alpha=300/1000, fee scale=130
  5. - Slow: alpha=80/1000, fee scale=140
  6. Fee = max(all three: base + vol_ema * scale / 10_000_000)
  7. Base fee: 18bps, max fee cap: 2000bps, warmup: 2 trades at 30bps default
  8. Price change = |rx*last_ry - ry*last_rx| / (ry*last_rx) scaled by 1e9
  9. afterSwap layout: [tag:1][side:1][input:8][output:8][rx:8][ry:8][step:8][storage:1024]
  10.  
Advertisement
Add Comment
Please, Sign In to add comment