Dynamic fees
The hook resolves every swap fee from the market clock, volatility and drift, clamped between a floor and a cap.
The PoolManager calls beforeSwap on the lonemi hook for every swap. The hook returns a fee with Uniswap's override flag, and that fee applies to that swap only. The fee accrues to liquidity active at the traded prices.
1. Market clock
Equity markets carry the NYSE calendar on chain: regular hours 09:30 to 16:00 New York time, US daylight saving rules, full-day holidays and 13:00 early closes. The hook sorts every second into one of three sessions.
| Session | When | Equities | Index ETFs | ETF pairs |
|---|---|---|---|---|
| Opening bell | 09:30, decaying over the ramp | 0.60% over 30 min | 0.30% over 20 min | 0.15% over 15 min |
| Regular session | After the ramp until the close | 0.10% | 0.05% | 0.03% |
| Overnight | Weekday nights between two trading days | 0.08% | 0.04% | 0.03% |
| Closed | Friday close to Monday open, holidays | 0.03% | 0.02% | 0.01% |
ETH/USDG trades around the clock, so it skips the calendar and starts from a flat 0.07%.
2. Volatility
After each swap the hook updates an exponentially weighted variance of tick moves with a one-hour half-life. One tick equals one basis point of price, so the hook reads annualised volatility straight from ticks. Above the market's knee, each percentage point of volatility adds a slope to the fee: equities start at a 45% knee and add 0.004% per point.
3. Drift
A keeper posts a reference price for each market, valid for 15 minutes. When the pool trades away from it, a swap that pushes the price further pays the drift slope per basis point of gap. A swap that moves the pool back toward the reference pays no drift charge. Arbitrage that repairs the pool stays cheap, and flow that picks off stale quotes pays for it.
Resolution and bounds
fee = clamp(session + volatility + drift, floor, cap). Every market has its own floor and cap. The bytecode rejects any cap above 5%. A keeper can post a temporary override for up to six hours, and it must also sit inside the floor and cap. A guardian can clear it early.
The website runs a TypeScript copy of the same maths. It matches 114 calendar vectors and 4 volatility sequences generated from the contract, so the fee you see on a market page is the fee the hook returns. Try it in any market's fee simulator.