Skip to content
Solana
FEEIn the programBit 1

Dynamic fees

The fee rises with how far a swap pushes the price. Pushing it back is free.

Where it runs

Fee

Sets or adds to what the swap pays.

Status on reel

In the program

In the reel program: bit 1 of PoolParams.blocks, frozen at PoolInit (PROGRAM.md §5).

Set by

You, at launch

Frozen in PoolParams at PoolInit; nobody can change it after.

What it does

A reference price trails the market. A swap moving price away from it pays an extra LP fee that grows with the square of the distance, averaged over the swap's own path so splitting a trade saves nothing, up to a ceiling. Moving back toward the reference is free. Without a counted move the reference steps toward the price, then joins it after a reset.

How it works on reel

dyn_ref steps every dyn_window_secs keeping dyn_carry_bps of the gap (at most 64 steps) and joins the price after dyn_reset_secs with no counted move. Moving away pays min(span, sens·(d0² + d0·d1 + d1²)/3,300) pips, d the bps distance from the reference (capped at 20,000), d0 = 0 when the swap crosses it. A move counts when |Δp| ≥ dyn_move_bps and X ≥ dyn_ref_liq (opening depth ÷ divisor). Exact-out swaps pay the span. The protocol share applies above the base fee.

Settings · 7

SettingMinDefaultMaxWhat it does
Fee ceiling
dyn_max_pips
See rule2.3%60%The most a swap pays in base plus dynamic fee. The default is the base fee + 20,000.From the base fee + 1 up to 600,000; it includes the base fee.
Sensitivity
dyn_sens
1510How fast the fee climbs: a swap leaving the reference pays sens·d²/3,300 pips for a move of d bps, up to the ceiling.
Step every
dyn_window_secs
12 s30 s5 minEach window, the reference keeps the carry share of its gap to the price.
Reset after
dyn_reset_secs
30 s2 min30 minWith no counted move for this long, the reference joins the price.At least twice the step.
Gap kept per step
dyn_carry_bps
0%75%95%Share of the gap between reference and price kept at each step.
Counted move
dyn_move_bps
0.5%2%20%A move counts when the price moves at least this far and the swap is at least the reference liquidity.
Liquidity divisor
dyn_divisor
210010,000Reference liquidity = the pool's quote depth at open ÷ this. A push with no size behind it doesn't raise the next buyer's fee.

Fees and who's paid

Paid to

LPs, after reel's share of the part above the base fee.

Protocol share

reel's protocol share s (20–50%, fixed at launch) comes off each charge first.

Requires and can't be combined with

Requires

No other block.

Can't be combined with

Worked example

Base 0.3%, ceiling 2.3%, sensitivity 5: a 1 SOL buy that moves price 10% from the reference pays 5·1,000²/3,300 ≈ 1,515 pips, about 0.15% above the base fee: 0.0015 SOL, of which 0.0003 SOL goes to reel at a 20% share.

Solana notes

The counted move is in bps (200 = 2%) rather than ticks.

On hookr: Core block · Live

Other blocks in Fees