ClankerHookDynamicFeeV2 on Base

Uniswap v4 Hook Contract 0xd60d6b218116cfd801e28f78d011a203d2b068cc on Base · Dynamic fee · Verified contract

Volume (24h)
$11.60K
Value locked (TVL)
$398.12K
All-time volume
$135.44M
Pools using this hook
362,639
Swaps (24h)
1,851 (150 traders)
Total swaps
1.7M

What it does

Clanker's v4 hook sets a volatility-based dynamic LP fee on each swap, takes a protocol fee equal to 20% of that LP fee in the paired token, and runs an anti-sniper MEV module for the first 2 minutes after pool creation.

How it works step by step

  • Before each swap it simulates the swap to estimate the end tick, measures the distance from a reference tick, and sets the LP fee as baseFee plus a quadratic volatility term, capped at maxLpFee (at most 10%). The fee decays over time through reset and filter periods.
  • Takes a protocol fee of 20% of the LP fee, always in the paired (non-Clanker) token. It uses beforeSwap and afterSwap return deltas, mints the amount as ERC-6909 claims to the hook, and sends it to the factory on the next swap.
  • Only the factory can create full pools through initializePool. Anyone can create a limited pool through initializePoolOpen, which has no locker, MEV module or extension. Direct pool manager initialization is blocked.
  • For factory pools, an MEV module can raise the swap fee up to 80% during the first 2 minutes after creation. Liquidity adds are blocked while the module is active.
  • On each swap it triggers the LP locker to collect rewards without unlocking, and calls an optional allowlisted pool extension after swaps. Extension failures are caught and do not revert the swap.
Swap behaviour
beforeSwap updates the dynamic LP fee from simulated tick movement, claims accrued hook fees to the factory, triggers the LP locker's reward collection, runs the MEV module (which may raise the fee), and for swaps where the swapper pays the paired token (exact-input buying Clanker, or exact-output selling Clanker) reduces or increases the specified amount to take the protocol fee up front. afterSwap takes the protocol fee from the unspecified amount in the other two cases, adjusts the reported delta, and calls the pool extension if one is set and the sender is not the locker.
Liquidity behaviour
beforeAddLiquidity reverts with MevModuleEnabled while the pool's MEV module is operational (the first 2 minutes after creation). Other liquidity actions are not hooked.
Fee behaviour
The LP fee is dynamic. It equals baseFee plus feeControlNumerator times the squared volatility accumulator divided by 1e10, capped at maxLpFee (at most 100000, i.e. 10%). baseFee must be at least 2500 (0.25%). The MEV module can temporarily push the fee up to 800000 (80%) in the first 2 minutes. The hook takes a protocol fee of 20% of the current LP fee in the paired token and forwards it to the factory.
Owner & admin controls
The hook has no owner, pause or upgrade function in the shown source. The factory address is immutable and alone can call initializePool and initializeMevModule, and it receives the claimed protocol fees. Per-pool parameters (base fee, max fee, filters, MEV module, locker, extension) are fixed at pool creation by the factory. The MEV module assigned to a pool can raise that pool's fee during the first 2 minutes. The pool extension allowlist is an external contract and its governance is not visible here.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeAddLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize reverts so pools can only be created through the hook's own initialize functions. beforeAddLiquidity blocks liquidity adds while the MEV module is active. beforeSwap sets the dynamic fee, claims fees, runs the MEV module and takes the protocol fee on some swap types. afterSwap takes the protocol fee on the remaining swap types and runs the pool extension. beforeSwapReturnDelta lets the hook adjust the specified amount to take the fee. afterSwapReturnDelta lets the hook take part of the unspecified amount as the fee.

Security & trust assessment

Risk level: medium (verified source, high confidence).

Who controls it: The factory sets each pool's configuration, locker, MEV module and extension at creation and receives all protocol fees. A factory-assigned MEV module or locker can affect swaps for its pool, including a high fee in the first 2 minutes or reverts. There is no hook owner or upgrade path in the source.

Risk to user funds: The hook holds the protocol fee only briefly as pool manager ERC-6909 claims, and sends it to the factory at the next swap's beforeSwap. It does not custody LP principal. Funds could be indirectly affected if a locker or MEV module makes swaps revert, or if the MEV module sets a high fee during the first 2 minutes.

Security findings

  • [info] Hook takes a protocol fee through return deltas: beforeSwap and afterSwap mint claims to the hook and adjust swapper deltas, so swappers pay an extra 20% of the LP fee in the paired token, which goes to the factory. The fee is disclosed in the constants.
  • [medium] MEV module can set an 80% fee for 2 minutes: mevModuleSetFee lets the pool's assigned module raise the LP fee up to 800000 (80%) while the pool is under 2 minutes old. Swaps in that window can be very expensive, and liquidity adds are blocked.
  • [medium] Swaps depend on external contracts: Every swap calls the LP locker's collectRewardsWithoutUnlock and the MEV module's beforeSwap without try/catch. A faulty or malicious locker or module set by the factory could revert swaps for that pool. The pool extension call is wrapped in try/catch.
  • [low] Swap simulation by revert: Each swap runs an internal simulated swap via a self-call that reverts with TickReturned to read the end tick. This adds gas and complexity, and the estimated tick can differ from the real result, so the fee can be slightly off.
  • [low] Open pools use the same hook with weaker setup: initializePoolOpen lets anyone create pools with caller-chosen fee config (bounded by MIN_BASE_FEE and MAX_LP_FEE) and no locker or MEV module. Those pools still pay the 20% protocol fee to the factory.

Contract details

Verified source
Yes (ClankerHookDynamicFeeV2)
Compiler
solc 0.8.28+commit.7893614a
Bytecode size
20,230 bytes
Upgradeable proxy
No
Detected patterns
access-control, dynamic-fee, launchpad, mev-protection, return-delta

Pools using ClankerHookDynamicFeeV2