Dynamic fee hook on Base

Uniswap v4 Hook Contract 0x6c4374ec0fbdc8f1bd5c54d46074aa82114740c4 on Base · Dynamic fee

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

What it does

A Uniswap v4 hook that applies owner-configurable swap fees and can take a share of swap output through return deltas, with an owner pause and withdrawal function.

How it works step by step

  • beforeSwap reads the paused flag and packed fee tiers from storage and can block or price the swap.
  • afterSwap updates a per-address accounting mapping and returns a delta, letting the hook capture part of the output.
  • Fee configuration is set through a nonpayable setter that writes packed uint24 and uint16 slots.
  • An owner-controlled address mapping gates some behaviour, possibly an allowlist.
  • The owner can withdraw tokens the hook holds and transfer ownership.
Swap behaviour
beforeSwap and afterSwap are both active. beforeSwap reads paused state and fee configuration; afterSwap updates per-address accounting and can return a delta that takes a portion of the swap output.
Liquidity behaviour
beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity are dispatched but no state-changing logic is clearly attributable to them from the decoded data. Likely pass-through or view-only checks.
Fee behaviour
Fee tiers and fee parameters are stored in packed uint24 and uint16 slots and read during beforeSwap and afterSwap, indicating a dynamic fee and/or swap-based fee logic. The exact fee formula cannot be determined without source.
Owner & admin controls
Owner (slot 0) can transfer ownership, pause and unpause the hook via setPaused, update fee and parameter configuration via the nonpayable setter 0x9261be9a (writes slots 1-3), set a bool/uint32 parameter via 0xa253156e, and withdraw tokens via withdraw(address,address,uint256). An address-keyed mapping (slot 4) is written by 0x36e666c5 and read in the swap path, likely an allowlist controlled by the owner.

Enabled Uniswap v4 callbacks

beforeSwap, afterSwap, afterSwapReturnDelta

beforeSwap: reads fee configuration and paused state to compute or gate swap fees. afterSwap: updates per-address accounting (slot 6) and can return a delta (afterSwapReturnDelta), so it can take a share of swap output. beforeInitialize, afterInitialize, liquidity and donate callbacks are present as stubs or checks.

Security & trust assessment

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

Who controls it: The owner can pause all swaps, change fee parameters at will, redirect ownership, and withdraw tokens held by the hook, so a compromised key could drain hook balances or block trading.

Risk to user funds: The hook can take a share of swap output through afterSwap return deltas and can hold tokens that the owner can withdraw. Pausing can block swaps, but funds are not locked by the pause alone.

Security findings

  • [medium] Owner pause control: Owner can call setPaused to halt swaps, which blocks trading for the pool while paused.
  • [medium] Owner-adjustable fees: Fee parameters are writable by the owner through 0x9261be9a, so swap fees can be raised substantially without user consent.
  • [medium] Return-delta fee extraction: The hook returns deltas from afterSwap, so it can take a portion of user swap output; the proportion is set by owner-controlled storage.
  • [medium] Owner withdrawal of hook funds: The withdraw function lets the owner move tokens held by the hook contract.
  • [low] Single-step ownership transfer: Ownership can be transferred with a single transferOwnership call, with no two-step confirmation visible in the selectors.

Contract details

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

Pools using Dynamic fee hook