Dynamic fee hook on Base

Uniswap v4 Hook Contract 0xa2d523d2da40f34c5bb58f528218e9cb7f4a40c4 on Base · Dynamic fee

Volume (24h)
$0.46
Value locked (TVL)
$154
All-time volume
$36.55M
Pools using this hook
12
Swaps (24h)
2 (2 traders)
Total swaps
85,465

What it does

A Uniswap v4 hook that applies owner-configurable tiered dynamic fees to swaps and takes a share of swap flow that the owner can withdraw.

How it works step by step

  • Sets swap fees dynamically in beforeSwap using tier and default fee values.
  • Supports per-pool fee overrides that the owner can set or clear.
  • Tracks swap counts per pool to drive fee tier logic.
  • Takes a token amount via afterSwap return delta.
  • Lets the owner withdraw accumulated tokens from the hook.
  • Exposes an owner-adjustable gas threshold.
Swap behaviour
beforeSwap sets a dynamic fee based on tiers, per-pool overrides and swap count; afterSwap can return a delta that takes tokens from the swap.
Liquidity behaviour
Liquidity add, remove and donate callbacks exist as view-style selectors (beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity, afterRemoveLiquidity, beforeDonate, afterDonate) but the permission flags do not enable them, so they are not invoked by the pool manager.
Fee behaviour
Fees are set dynamically in beforeSwap from tiered fee levels (tierOneFee, tierTwoFee, tierThreeFee) with a per-pool override mapping and a default fee; the swap count per pool (swapCount) appears to drive tier selection, and a gas threshold is involved. Fee cap MAX_FEE and a FeeTooHigh error suggest bounds on owner-set fees. Exact tier logic is not confirmed without source.
Owner & admin controls
Owner (slot 0) with two-step transfer (transferOwnership/pendingOwner/acceptOwnership) can set the default fee (setDefaultFee), set tier fees (uint24,uint24,uint24,uint24,uint16,uint16,uint16,uint256 setter), set gas threshold (setGasThreshold), set per-pool fee overrides via a bool,uint16 / uint256,uint24 setter, clear pool fee overrides (clearPoolFeeOverride), and withdraw tokens (withdraw(address,address,uint256)). Ownership appears to be on a single key with no timelock visible.

Enabled Uniswap v4 callbacks

beforeSwap, afterSwap, afterSwapReturnDelta

beforeSwap: sets a dynamic fee override for the swap. afterSwap: runs post-swap bookkeeping and can return a delta (afterSwapReturnDelta), meaning it can take or give a token amount from the swap outcome, which the take(address,address,uint256) and transfer selectors suggest it does. beforeInitialize/afterInitialize are not enabled here for initialisation logic beyond the afterInitialize selector being present.

Security & trust assessment

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

Who controls it: A single owner can change all fee tiers, default fee, per-pool overrides and gas threshold, and can withdraw tokens held by the hook. A compromised owner key could redirect fees or drain accrued balances.

Risk to user funds: The hook can take tokens through afterSwap return deltas and holds accrued balances that the owner can withdraw. Swaps can be affected by owner-set fees. It does not appear to block swaps outright from the decoded selectors.

Security findings

  • [high] Owner can withdraw hook-held tokens: withdraw(address,address,uint256) is callable by the owner and moves tokens held by the hook contract.
  • [medium] Hook takes tokens via return delta: afterSwap returns a delta, so the hook can take a portion of each swap's output and the owner can later withdraw it.
  • [medium] Owner-adjustable swap fees: Owner can change tier fees and default fee; bounded by MAX_FEE and FeeTooHigh, but the bound may still be high enough to extract large value from swappers.
  • [info] Two-step ownership without timelock: Ownership uses a two-step transfer pattern, which reduces accidental transfer risk, but no timelock or multisig requirement is visible in the bytecode.
  • [info] Unverified source: Contract is not verified and behaviour was inferred from selectors and storage, so exact logic may differ.

Contract details

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

Pools using Dynamic fee hook