Dynamic fee hook on Ethereum

Uniswap v4 Hook Contract 0x4a482172c76e141a53af9bfafe6e986e3ff1e58b on Ethereum · Dynamic fee

Volume (24h)
$0
Value locked (TVL)
$0.02
All-time volume
$0
Pools using this hook
1
Swaps (24h)
1 (1 traders)
Total swaps
1

What it does

This hook sets a configurable fee on pool swaps and takes a share of swap and liquidity amounts to a fee receiver chosen by its owner, though the exact fee rate and which trades pay more could not be confirmed from the decoded bytecode.

How it works step by step

  • Sets a per-pool fee value in storage during beforeInitialize, based on the owner-configured uint16 parameters stored in slots 0 and 2
  • Enforces fee-related state through two uint16 setters (selectors 0x534eb4cf and 0xcb9442e2) callable by the owner
  • Accumulates debt-like balances per (uint256, address) key in slot 1 when liquidity callbacks run, and exposes them through debtOf
  • Uses beforeSwap and return-delta permissions, meaning it can take a share of swap amounts and settle it to a fee receiver via take()
  • Settles liquidity-change deltas in afterAddLiquidity and afterRemoveLiquidity, using return-delta permissions to move currency
  • Forwards collected value to feeReceiver, which is set by the owner through setFeeReceiver
Swap behaviour
beforeSwap is implemented and can return a delta, so swaps may have a hook-determined amount taken from the swap; the exact fee direction and rate cannot be confirmed from decoded bytecode alone.
Liquidity behaviour
afterAddLiquidity and afterRemoveLiquidity are implemented with return-delta permissions; they update the mapping in slot 1 and can move currency to or from the hook during liquidity changes.
Fee behaviour
Fees appear to be set via uint16 parameters stored by the owner and applied through the dynamic-fee path; the precise formula and which trades pay more or less could not be determined from decoded bytecode.
Owner & admin controls
The owner (slot 2) can transfer or renounce ownership, change feeReceiver, and call the uint16 setters that adjust fee parameters.

Enabled Uniswap v4 callbacks

beforeInitialize, afterAddLiquidity, afterRemoveLiquidity, beforeSwap, beforeSwapReturnDelta, afterAddLiquidityReturnDelta, afterRemoveLiquidityReturnDelta

beforeInitialize sets initial pool parameters; beforeSwap applies the dynamic fee and may return a swap delta; beforeSwapReturnDelta lets it take a share of the swap; afterAddLiquidity and afterRemoveLiquidity record balances; afterAddLiquidityReturnDelta and afterRemoveLiquidityReturnDelta let the hook settle currency on liquidity changes.

Security & trust assessment

Risk level: high, estimated (decoded bytecode, low confidence).

Who controls it: A single owner key can change fee parameters, redirect the fee receiver, and transfer or renounce ownership, which directly affects every swap and liquidity action in pools using this hook.

Risk to user funds: The hook has return-delta permissions and calls take() on the pool, so it can hold or move token amounts during swaps and liquidity changes; funds are routed to feeReceiver.

Security findings

  • [medium] Owner-adjustable fee parameters: Two uint16 setters write to slots 0 and 2 without visible bounds in decoded form; the owner could set fees to extreme values affecting all swaps in pools using this hook.
  • [high] Return-delta currency movement: beforeSwapReturnDelta and liquidity return-delta permissions let the hook take tokens from swaps and liquidity operations and send them via take() to feeReceiver, so user funds flow through hook logic.
  • [medium] Owner-controlled fee receiver: setFeeReceiver lets the owner redirect all collected value to any address.
  • [medium] Unverified source: No verified source is available; behaviour is inferred from bytecode, so exact math and edge-case handling cannot be audited.

Contract details

Verified source
No
Bytecode size
13,403 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, moves-currency, ownable, return-delta

Pools using Dynamic fee hook