Dynamic fees

A swap pays a base fee plus surcharges for pushing the price away from the centre or chopping, and new markets add a decaying launch premium, all capped at half the fee basis.

Updated Nov 11, 2026

A swap pays the Dusk fees below and, for Token-2022 mints, a transfer fee the token program charges on its own.

ComponentWhen it appliesBudget
Base feeEvery swapThe market's swap fee, 30 bps by default
Divergence surchargeTrades that push the price outward from the centre, evaluated over the whole trade pathIts own cap
Volatility surchargeRepeated chop; priced from decayed prior state, and a filled trade updates the signalIts own cap
Launch premiumNew markets, above the base fee, decaying by time or by price milestonesAt most 50% at start

The fee step

The components come off in a fixed order. With fees taken on the input, the fee basis GG is the reserve credit after any input transfer fee. Write bb for the base rate in force, launch premium included, and vˉ\bar v and dˉ\bar d for the volatility and divergence caps. Amounts are floored to the token atom, and the three budgets are V=⌊Gvˉ⌋V = \lfloor G\bar v \rfloor, D=⌊Gdˉ⌋D = \lfloor G\bar d \rfloor and H=⌊G/2⌋H = \lfloor G/2 \rfloor:

Fb=⌊G b⌋Fv=min⁡(⌊(G−Fb) rv⌋, V, H−Fb)Fd=min⁡(Φ(u1)−Φ(u0), D, H−Fb−Fv)\begin{aligned} F_b &= \lfloor G\,b \rfloor \\ F_v &= \min\big(\lfloor (G - F_b)\,r_v \rfloor,\ V,\ H - F_b\big) \\ F_d &= \min\big(\Phi(u_1) - \Phi(u_0),\ D,\ H - F_b - F_v\big) \end{aligned}

The curve then trades G−Fb−Fv−FdG - F_b - F_v - F_d. Here rvr_v is the volatility rate and Φ\Phi the divergence potential, both defined below. The divergence path covers the input left after the base fee and the volatility surcharge, u1=u0+G−Fb−Fvu_1 = u_0 + G - F_b - F_v.

With fees on the output asset, the curve takes all of GG and the same steps run on the gross output OO: the base fee on OO, the volatility surcharge on O−FbO - F_b, then the divergence surcharge on O−Fb−FvO - F_b - F_v at the rate Fd/GF_d/G, where FdF_d is the input-path charge above with u1=u0+Gu_1 = u_0 + G. Each is limited by its cap on OO, and the total by ⌊O/2⌋\lfloor O/2 \rfloor.

The divergence surcharge

The charge depends on how far a trade pushes the input reserve past q0q_0, the input reserve the current curve would hold at the sticky centre. With uu that excess, zero when the reserve is below q0q_0, the program charges the change in a potential

Φ(u)=4 kd u33 q0 (q0+u)\Phi(u) = \frac{4\,k_d\,u^3}{3\,q_0\,(q_0 + u)}

where kdk_d is the divergence coefficient. Its slope is the marginal surcharge rate, close to 4kd(u/q0)24k_d(u/q_0)^2 near the centre:

Φ′(u)=4kd3⋅ϕ2(3−ϕ)1−ϕ,ϕ=uq0+u\Phi'(u) = \frac{4k_d}{3}\cdot\frac{\phi^2(3 - \phi)}{1 - \phi}, \qquad \phi = \frac{u}{q_0 + u}

Once the slope reaches dˉ/(1−dˉ)\bar d/(1 - \bar d), the cap restated as a toll on the input that remains after the fee, the potential continues as a straight line at that slope. Flow that moves the input reserve back toward q0q_0 pays nothing, and a trade that crosses q0q_0 pays only for the part beyond it. Each charge is a difference of one potential, so splitting a trade into consecutive pieces leaves the uncapped total unchanged.

The volatility surcharge

Each market keeps one volatility accumulator vv. It decays at its own half-life HvH_v, and every filled trade adds its own price move μ\mu, capped per trade by the shock cap sˉ\bar s and in total by the accumulator cap vmax⁡v_{\max}:

v←v⋅2−Δt/Hvv←min⁡(v+min⁡(μ,sˉ), vmax⁡)\begin{aligned} v &\leftarrow v \cdot 2^{-\Delta t/H_v} \\ v &\leftarrow \min\big(v + \min(\mu, \bar s),\ v_{\max}\big) \end{aligned}

The move is μ=max⁡(p0,p1)/min⁡(p0,p1)−1\mu = \max(p_0, p_1)/\min(p_0, p_1) - 1, rounded up, from the trade's start price to its final executable price. The fee reads the decayed accumulator from before the trade and maps it to a rate that stays below 100%:

rv=kv v1+kv vr_v = \frac{k_v\,v}{1 + k_v\,v}

with kvk_v the volatility coefficient. Only a successful trade commits its move. On an oracle-guided market a new feed price that moves the curve counts as a move too.

Worked example

A market collects fees on the input at a 30 bps base rate. Its accumulator has decayed to v=0.02v = 0.02 with kv=0.25k_v = 0.25, the divergence coefficient is kd=1k_d = 1, and both surcharge caps are 100 bps. A trader pays in G=50,000G = 50{,}000 USDC of quote while the quote reserve sits 20,000 USDC past its balanced level q0=1,000,000q_0 = 1{,}000{,}000.

StepValue
Base fee, 30 bps of GG150.00
Volatility rate, 0.005/1.0050.005/1.0050.4975%
Volatility surcharge on 49,850.00248.01
Divergence path, u0u_0 to u1u_120,000.00 to 69,601.99
Potential at each end10.46 and 356.01
Divergence surcharge345.55
Total fee743.56, or 1.49% of GG
Input the curve trades49,256.44

Neither surcharge reaches its 500 USDC budget. The divergence slope reaches its limit of 1.0101% at u=51,970.87u = 51{,}970.87, so the last 17,631.12 of the path is charged at that flat rate. The same trade starting 50,000 USDC below q0q_0 would end below it and pay no divergence surcharge, and a 10,000 USDC trade starting at q0q_0 pays 1.29.

The cap

The fee basis is the input asset, base only or quote only, as the creator chose. When fees are taken from the input, the budget is measured on the reserve credit after the token transfer fee; when taken from the output, on the gross curve output.

Dusk fees together are capped at half of that basis, rounded down. Token transfer fees and price impact are outside the cap.

Each component also has its own ceiling. The base rate in force, the divergence cap and the volatility cap are each at most 50%, and so is their sum (InvalidSwapFeeBps), checked when a fee profile is admitted and again on every swap with the launch premium included. A swap fails with InsufficientOutputAmount when the fees leave nothing for the curve or the curve pays nothing, and with SlippageExceeded when its output, after any output transfer fee, is below the trader's minimum. preview_swap returns every component of a quote, and the SwapExecuted event records them.

Launch schedules

A launch premium starts the base rate at b0b_0 and brings it back to bb within a duration DD of up to 30 days from the market's start time. Time decay is linear, or exponential over sixteen periods, and both round up:

blin(t)=b+⌈(b0−b)(D−t)/D⌉bexp(t)=b+⌈(b0−b)/2k⌉k=min⁡(⌊16t/D⌋, 15)\begin{aligned} b_{\text{lin}}(t) &= b + \big\lceil (b_0 - b)(D - t)/D \big\rceil \\ b_{\text{exp}}(t) &= b + \big\lceil (b_0 - b)/2^{k} \big\rceil \\ k &= \min(\lfloor 16t/D \rfloor,\ 15) \end{aligned}

For b0=10%b_0 = 10\%, b=30b = 30 bps and a 24-hour duration:

Hours since start136121824
Linear, bps96087975851527330
Exponential, bps1,00027391343130

A price-milestone schedule lowers the rate as the launch asset's price climbs past its reference, which is fixed at launch. Each full step of a set percentage above the reference counts one period, up to 64 periods, and each period takes a fixed number of basis points off the start rate or cuts it by a fixed fraction, rounding up. The rate never drops below bb, the duration still ends the premium, and the schedule needs fees collected in base only or quote only.

A size premium can apply on top while the launch limiter runs, for up to 30 days. A swap that buys the launch asset pays min⁡(bs+(⌈G′/R⌉−1) ι, bmax⁡)\min\big(b_s + (\lceil G'/R \rceil - 1)\,\iota,\ b_{\max}\big), where bsb_s is the scheduled rate, G′G' the input in nine-decimal token units, rounded up, RR the reference size in the same units and ι\iota the increment per reference. With bs=273b_s = 273 bps, R=1,000R = 1{,}000, ι=50\iota = 50 bps and bmax⁡=15%b_{\max} = 15\%, a 3,500-unit buy pays 423 bps and a 20,000-unit buy pays 1,223 bps.

The size premium keeps no state between transactions, so splitting a buy across transactions lowers it. While the limiter runs, the program refuses a buy of the launch asset in a transaction that holds more than one swap-like instruction on the same market (LaunchRateLimitSplitTransaction): a swap, a leverage open, increase, decrease or close, an emergency_liquidation, or a settle_flash_liquidation that trades through both reserve vaults. Launch settings cannot change once trading has started (LaunchSettingsImmutable).

Parameters

SettingAllowed values
Base fee bb0 to 50%, and at least 1 bps on a concentrated curve (ConcentratedSwapFeeBelowMinimum), with b+dˉ+vˉb + \bar d + \bar v at most 50%
Divergence cap dˉ\bar d, volatility cap vˉ\bar v0 to 50% each; zero switches the surcharge off
Divergence coefficient kdk_d, volatility coefficient kvk_v0 to 100
Shock cap sˉ\bar s, accumulator cap vmax⁡v_{\max}Both zero, or 0<sˉ≤vmax⁡≤100 < \bar s \le v_{\max} \le 10; kv>0k_v > 0 needs them set
Volatility half-life HvH_vOne minute to twelve hours
Fee assetInput, base only or quote only
Compounding share0 to 100% of the LP-owned fee
Launch start rate, size premium capAbove bb, with the size premium cap at least the start rate; each plus both surcharge caps at most 50%

The creator sets the whole fee profile at initialize_market. The operator or manager can replace it later as one fee-family update after the full notice, with the launch settings fixed once trading has started. The replacement is checked as a whole (InvalidSwapFeeBps, InvalidMarketConfig, InvalidHalfLife and, on a concentrated curve, ConcentratedSwapFeeBelowMinimum), and executing it drops any stored centre target.

Where the fees go

The protocol takes its share of the base fee first, the global swap share of 20% by default, and takes nothing from the surcharges. The LP-owned rest of the base fee and any distributed surcharge then divide by the market's compounding share: that part enters reserve principal and lifts the value of every srLP, and the remainder is claimable yield, held in custody outside the executable reserves and paid out through growth indexes. Realized borrow interest follows its own distribution path.

A swap's divergence and volatility surcharges are retained or distributed together. A market at exact constant product always distributes them. A concentrated market retains them while its centre controller's funding target is stale or short of its requirement, and every swap and reserve change marks that target stale, so a concentrated market's surcharges normally go to the protected bucket ZZ. Retained surcharge stays in the reserve vault but outside executable reserves, srLP value and every withdrawal claim, and nobody can claim or trade it until a funded centre move deploys it as principal. Setting the market back to exact constant product releases it to the LPs.

Yield eligibility is measured at the right transition boundary, so a trade cannot assign its fee to shares that did not exist when it began.