ClankerHookDynamicFee on Base

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

Volume (24h)
$243
Value locked (TVL)
$93.49K
All-time volume
$72.34M
Pools using this hook
23,283
Swaps (24h)
81 (41 traders)
Total swaps
587,662

What it does

A Clanker-branded Uniswap v4 hook that sets a volatility-based dynamic LP fee for Clanker token pools and skims a protocol fee (about 20% of the LP fee) from swaps into the hook, forwarding it to the Clanker factory.

How it works step by step

  • Initializes Clanker pools through the factory or an open initializer, with a base fee of at least 0.25% and a maximum LP fee capped at 30%.
  • On every swap, estimates the post-swap tick by reverting a simulated swap and reading the returned tick, then computes a volatility accumulator from the tick difference against a reference tick.
  • Converts the volatility accumulator into an LP fee: baseFee plus feeControlNumerator times the square of the accumulator, capped at maxLpFee, then pushes it to the pool with updateDynamicLPFee.
  • Takes a protocol fee of roughly 20% of the LP fee by minting ERC-6909 claims to the hook on the paired-token side, then burns and transfers accumulated claims to the factory on subsequent swaps.
  • Optionally triggers claims on an LP locker and runs an MEV module during the first two minutes after pool creation, and blocks liquidity additions while that module is active.
Swap behaviour
Before each swap the hook updates the dynamic LP fee and sets the protocol fee, then takes a small protocol fee via beforeSwap delta (exact-input paired-in, exact-output paired-out) or afterSwap unspecified delta (exact-input paired-out, exact-output paired-in). It also claims any accumulated hook fees to the factory and may run the MEV module.
Liquidity behaviour
Adding liquidity is blocked while the MEV module is enabled and the pool is younger than 2 minutes. Removing liquidity has no hook callback.
Fee behaviour
The LP fee is dynamic: it rises with the square of a volatility accumulator derived from recent tick movement (with decay and reset logic), bounded by baseFee at the bottom and maxLpFee (at most 30%) at the top. The protocol fee is set to 20% of the current LP fee and is collected by the hook as ERC-6909 claims, then sent to the factory.
Owner & admin controls
The owner (Ownable, initially the deployer) can renounce or transfer ownership, but the functions shown in this contract do not expose owner-gated parameter changes. Fee parameters and the baseFee/maxLpFee/decay settings are set per pool by the factory at initialization and are not changeable afterward in the visible code. Pool initialization and MEV module activation are restricted to the factory. The hook is not upgradeable (no proxy visible). Parameters of the factory and locker, which control pool creation and fee routing, are outside this contract's scope.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeAddLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize reverts so pools can only be created through the hook's own initializers. beforeAddLiquidity blocks liquidity adds during the MEV module window. beforeSwap sets the dynamic fee, claims fees, runs the MEV module and takes the protocol fee via delta. afterSwap takes the protocol fee on the unspecified side via return delta. beforeSwapReturnDelta and afterSwapReturnDelta are needed for those fee deltas.

Security & trust assessment

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

Who controls it: The owner key has no visible power over pools, fees, or user funds in this code; the factory controls pool creation and the MEV module, and the protocol fee recipient is the factory. Users are exposed to the factory and MEV module operator rather than to a single owner key on this contract.

Risk to user funds: The hook does not custody LP positions. It holds protocol fee claims in the pool manager as ERC-6909 balances and can take those through the pool manager. Swaps pass through the hook's delta logic, so a buggy or malicious factory or MEV module could affect swap outcomes, and the hook can block swaps through simulation reverts.

Security findings

  • [info] Protocol fee is forwarded to a factory address: Accumulated protocol fees are burned from the hook's ERC-6909 balance and transferred to the immutable factory address. Fee recipients therefore depend entirely on the factory contract, which is not part of this hook's code.
  • [medium] Swap simulation relies on revert-based tick extraction: _getTicks calls simulateSwap through this.call and parses the TickReturned revert data via assembly. A swap that does not revert with the expected selector causes the whole swap to revert, so an unusual pool state or a changed pool manager behaviour can block trading. The simulation also executes a real poolManager.swap from within the hook, consuming gas on every swap.
  • [medium] Dynamic fee depends on manipulable pool tick: The volatility accumulator uses the pool tick before and after a simulated swap. Large trades or manipulation of the reference tick within the filter windows can raise the LP fee to its 30% cap, which affects traders' execution costs.
  • [low] MEV module can disable liquidity adds and enforce fees for early swaps: During the first two minutes after creation, an enabled MEV module is called on every swap and can disable itself. While enabled, beforeAddLiquidity reverts with MevModuleEnabled, so LPs cannot add liquidity until the module disables itself or the window passes.
  • [low] Hook fee accounting uses unchecked int casts: Protocol fee and delta calculations cast between int24, int128 and uint24 without explicit overflow checks; the protocolFee cap (30% of 20%) keeps practical ranges small, but the arithmetic is not bounded explicitly in the code shown.

Contract details

Verified source
Yes (ClankerHookDynamicFee)
Compiler
solc 0.8.28+commit.7893614a
Bytecode size
16,816 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, launchpad, mev-protection, ownable, return-delta

Pools using ClankerHookDynamicFee