Dynamic fee hook on Base

Uniswap v4 Hook Contract 0xf54473f4c554baa8411c0a7dac7df735f34d00c4 on Base · Dynamic fee

Volume (24h)
$0
Value locked (TVL)
<$0.01
All-time volume
$3.42M
Pools using this hook
23
Swaps (24h)
0 (0 traders)
Total swaps
46,445

What it does

A dynamic-fee hook that sets swap fees per pool based on tiers, activity counts and owner-configured overrides, and can take a share of swap output as its own fee.

How it works step by step

  • Applies a dynamic LP fee on each swap via beforeSwap, using default, per-pool, or tiered fees
  • Tracks swap counts per pool to select between tier one, two and three fee levels
  • Supports owner-configured discount toggling and a gas threshold parameter
  • Takes a portion of swap output through afterSwapReturnDelta and the take() call
  • Lets the owner withdraw tokens the hook has accumulated
Swap behaviour
beforeSwap sets a dynamic LP fee override from the default, per-pool override or tier fee, optionally discounted. afterSwap updates swap counters and can take a return delta from the swap output for the hook.
Liquidity behaviour
No liquidity callbacks are enabled in the permissions, so the hook does not gate or alter liquidity add/remove; the selectors present are standard interface stubs.
Fee behaviour
Fees are dynamic: the hook returns an override fee from beforeSwap based on a default fee, per-pool fee overrides, tiered fees by swap activity (tierOne/Two/Three fees keyed to swapCount) and an optional discount. A MAX_FEE cap and FeeTooHigh error bound the fee. The pool's dynamic fee flag is checked (NotDynamicFeePool error).
Owner & admin controls
Owner (Ownable2Step: transferOwnership then acceptOwnership) can set the default fee (setDefaultFee), set per-pool fee overrides (setPoolFeeOverride via selector 0x9c14f085, clearPoolFeeOverride), set tier fees (0x330adf21 with MAX_FEE bound), set gas threshold (setGasThreshold), toggle discounts (setDiscount), and withdraw tokens held by the hook (withdraw). No upgrade proxy pattern was observed.

Enabled Uniswap v4 callbacks

beforeSwap, afterSwap, afterSwapReturnDelta

beforeSwap: sets the dynamic LP fee override per swap based on tier, discount and pool overrides. afterSwap: updates per-pool swap counters and tracks the swap-direction flags, and can return a delta (afterSwapReturnDelta) that lets the hook take a portion of the swap output as a fee.

Security & trust assessment

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

Who controls it: The owner controls the fee schedule for every pool (up to MAX_FEE), can override fees per pool, and can withdraw any tokens the hook holds. A malicious or compromised owner could set fees to the cap to extract value from traders, or drain accrued hook balances.

Risk to user funds: The hook can hold tokens taken via the return delta from swaps and can transfer them out through withdraw. It does not hold LP principal because liquidity callbacks are disabled, but fee skimming and owner withdrawal of accrued balances put swap value at the owner's discretion.

Security findings

  • [medium] Owner-controlled swap fees: Owner can set the default fee and per-pool overrides up to MAX_FEE, so swappers can be charged the maximum fee at any time.
  • [medium] Return-delta fee capture: afterSwapReturnDelta is enabled and the hook calls take(), so it can retain a portion of swap output as a hook fee, shifting value from the pool to the hook.
  • [medium] Owner withdrawal of hook balances: The withdraw function lets the owner move tokens held by the hook contract to any address.
  • [info] Two-step ownership transfer: Ownership transfer uses a two-step pending owner pattern, which reduces the risk of accidental transfer to a wrong address.

Contract details

Verified source
No
Bytecode size
7,905 bytes
Upgradeable proxy
No
Detected patterns
moves-currency, ownable, return-delta

Pools using Dynamic fee hook