Dynamic fee hook on Base

Uniswap v4 Hook Contract 0xce8daffb3dba81d9ad85a2e4f8b4cd27cf4060ec on Base · Dynamic fee

Volume (24h)
$35.64K
Value locked (TVL)
$13
All-time volume
$35.64K
Pools using this hook
7
Swaps (24h)
582 (26 traders)
Total swaps
582

What it does

A dynamic-fee hook that lets a privileged launcher set a per-pool swap fee and accrues a fee share on swaps that can be collected later.

How it works step by step

  • Stores a per-pool fee (uint24) readable via feeOf and settable by the launcher via setFee, bounded by MAX_FEE
  • Applies the stored fee in beforeSwap and records accrued fees per pool and currency in afterSwap
  • Takes currency from the PoolManager via take and unlock callbacks to hold accrued fees
  • Lets the launcher collect accrued fees for a given pool and recipient
  • Validates pool initialization so only pools with the dynamic fee configuration are accepted
Swap behaviour
beforeSwap applies the stored pool fee and afterSwap accrues fees into the hook's per-pool accounting, with return-delta permissions allowing the hook to take a share of the swap.
Liquidity behaviour
beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity are present as view-dispatched selectors; no state-changing liquidity logic was identified beyond the standard hook surface.
Fee behaviour
Per-pool fee stored in mapping slot 0 (uint24), readable via feeOf(bytes32) and settable via setFee with a MAX_FEE bound and InvalidFee revert; beforeSwap reads the stored fee and afterSwap accrues fees into a per-pool, per-currency accounting mapping in slot 1, which can be collected by the launcher via collect.
Owner & admin controls
A launcher address (immutable/readable via launcher()) is referenced; setFee is callable by a privileged caller that sets per-pool fees bounded by MAX_FEE and InvalidFee checks. Exact authorization checks (NotLauncher revert) suggest only the launcher can call privileged functions such as setFee and collect. No upgrade or pause function found in the dispatch table.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeSwap, afterSwap, beforeDonate, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize validates pool fee configuration (LPFeeMustBeZero suggests the pool must use dynamic fee flag); beforeSwap and afterSwap apply the custom fee and account fees; beforeSwapReturnDelta and afterSwapReturnDelta let the hook take a share of swap amounts as return deltas; beforeDonate, beforeAddLiquidity, beforeRemoveLiquidity and the after-liquidity callbacks are enabled by permission flags but appear to be pass-through.

Security & trust assessment

Risk level: medium (decoded bytecode, medium confidence).

Who controls it: The launcher (privileged caller) can set pool fees up to MAX_FEE and collect accrued fees, so changing fees affects all swappers in pools using this hook.

Risk to user funds: The hook takes a portion of swap currency via return deltas and holds accrued fees in its own balance until the launcher calls collect, so user swap proceeds and accrued fees are exposed to the hook's logic and the launcher's collection rights.

Security findings

  • [medium] Return-delta swap accounting: Permission flags include beforeSwapReturnDelta and afterSwapReturnDelta, meaning the hook can alter the amounts a swap settles for and take currency from the pool.
  • [medium] Privileged fee setter: setFee is callable by the launcher role and bounded by MAX_FEE; a compromised launcher could raise fees up to the cap on any pool using this hook.
  • [medium] Hook moves currency: Bytecode calls take and unlock on the PoolManager (self-unlock), so the hook moves pool currency to itself to accrue and collect fees.
  • [info] Access control inferred from error selector: Access control on privileged functions is implied by NotLauncher error selector; exact checks were not fully decoded.

Contract details

Verified source
No
Bytecode size
5,571 bytes
Upgradeable proxy
No
Detected patterns
moves-currency, return-delta, self-unlock

Pools using Dynamic fee hook