Dynamic Fees
After graduation, swaps through the primary pool pay a fee collected by the hook. The rate falls as the pool deepens, so successful tokens get cheaper to trade.
Fee tiers
The tier is chosen from the approximate native depth of the pool, derived from live liquidity and price:
native_in_pool ≈ liquidity * 2^96 / sqrtPriceX96
| Tier | Rate | Base | BSC | Polygon | Robinhood |
|---|---|---|---|---|---|
| Tier 1 | 120 bps (1.2%) | < 12 ETH | < 36 BNB | < 288,000 POL | < 12 ETH |
| Tier 2 | 80 bps (0.8%) | 12 ETH – 24 ETH | 36 BNB – 72 BNB | 288,000 POL – 576,000 POL | 12 ETH – 24 ETH |
| Tier 3 | 40 bps (0.4%) | > 24 ETH | > 72 BNB | > 576,000 POL | > 24 ETH |
Uniswap V3 pools carry a static fee chosen at creation. LP24 uses the 1% tier on Gnosis, and there is no dynamic tiering — the fee is a property of the pool, not of a hook callback.
Computed live, never cached
The tier is recomputed from pool state on every swap. There is no cached tier and no refresh function — a cache would let the charged fee drift from the pool's real depth, and the MEV cap derives its size from the same live read (see MEV Protection). Reading it fresh in the same call is what makes flash-deepening the pool self-defeating: it lowers the tier and shrinks the cap in lockstep.
How fees are collected
| Direction | Callback | Taken from |
|---|---|---|
| Buy (native → token) | beforeSwap | The specified input amount |
| Sell (token → native) | afterSwap | The native output delta |
In both cases the hook calls take() for the native fee and returns a matching delta so the pool's accounting nets to zero. Fees land in pendingFees[token] — or straight into protocolBalance when the token is $LP24, which has no deployer cut.
beforeSwap asserts amountSpecified < 0 for buys. Fee-on-input has no coherent meaning when the caller specifies the output, so exact-output swaps in that direction revert rather than being charged something arbitrary.
Fee-free internal swaps
When the hook swaps on its own pool for reinvestment or buy-and-burn, it sets a transient flag using EIP-1153. Both callbacks check it and skip fee collection, so fees are not charged on the spending of fees.
Transient storage costs 100 gas to read against 2,100 for a cold SLOAD, and auto-clears at end of transaction, so there is no cleanup write.
Unregistered tokens
Both callbacks check tokenInfo[token].deployer != 0 before charging anything. A pool key that happens to reference this hook but was never registered through graduation collects no fee — the callback returns a zero delta and the swap proceeds untaxed.