Dynamic fee hook on Base

Uniswap v4 Hook Contract 0xea8cb7d2c686ff531d3cbc7249e7ab3ff75600c4 on Base · Dynamic fee

Volume (24h)
$0
Value locked (TVL)
$0
All-time volume
$7.75M
Pools using this hook
1
Swaps (24h)
0 (0 traders)
Total swaps
19,280

What it does

A Uniswap v4 hook that applies tiered dynamic swap fees with owner-configurable parameters, pause control and a return-delta on swaps.

How it works step by step

  • Sets swap fees dynamically from tierOneFee, tierTwoFee, tierThreeFee and defaultFee values
  • Tracks swap counts per pool in a mapping keyed by pool id
  • Uses a gas threshold parameter in the fee logic
  • Can be paused by the owner to stop swap processing
  • Allows the owner to withdraw tokens held by the hook
  • Returns a delta after swaps via afterSwapReturnDelta
Swap behaviour
beforeSwap computes a tiered fee and afterSwap updates a per-pool swap counter and may return a delta through afterSwapReturnDelta.
Liquidity behaviour
beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity are present as selectors but their implementations are not evidenced as having side effects; treat as likely pass-through.
Fee behaviour
Fees are tiered: tierOneFee, tierTwoFee and tierThreeFee are read during swaps along with defaultFee, a fee configuration struct and gas threshold; the owner can update the fee configuration through selector 0xca14a65b. The exact tier selection logic cannot be fully determined from decoded bytecode alone.
Owner & admin controls
Owner (slot 0) can transfer ownership, pause and unpause via setPaused, set the gas threshold via setGasThreshold, update the fee configuration through the function with selector 0xca14a65b (writes slots 0, 1 and 2), withdraw tokens via withdraw(address,address,uint256), and toggle a boolean flag via selector 0xf3fb9437 (slot 3).

Enabled Uniswap v4 callbacks

beforeSwap, afterSwap, afterSwapReturnDelta

beforeSwap adjusts the swap fee for the pool; afterSwap records per-pool swap counts (mapping in slot 4) and may return a delta via afterSwapReturnDelta; afterInitialize and beforeInitialize are present but not clearly used beyond bookkeeping.

Security & trust assessment

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

Who controls it: The owner can pause swaps, change fee tiers and the fee configuration, change the gas threshold, withdraw tokens held by the hook, and transfer ownership. A compromised owner key could redirect fees or drain tokens accumulated in the hook.

Risk to user funds: The hook can hold tokens and the owner can withdraw them; afterSwapReturnDelta lets the hook alter balances of swap settlements; pausing can block swaps. Users' pool liquidity is not directly controlled, but swap flows are subject to owner intervention.

Security findings

  • [high] Owner withdrawal of hook-held tokens: Owner can call withdraw(address,address,uint256) to move tokens held by the hook contract.
  • [medium] Return-delta token capture controlled by owner: afterSwapReturnDelta is enabled, so the hook can take or give tokens from swaps, and the owner controls the parameters that determine this.
  • [medium] Owner pause can block swaps: setPaused lets the owner halt swap processing, which can block trading on pools using this hook.
  • [medium] Mutable fee parameters without timelock: Fee tiers and the fee configuration are mutable by the owner via selector 0xca14a65b, so fees can be raised without a timelock.
  • [info] Unverified source: No verified source is available, so the exact behaviour of the functions is inferred from selectors and storage writes.

Contract details

Verified source
No
Bytecode size
8,678 bytes
Upgradeable proxy
No
Detected patterns
ownable, pausable, return-delta

Pools using Dynamic fee hook