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