Dynamic fee hook on Base

Uniswap v4 Hook Contract 0x2e402312c363b7969f42269bdd9bd778d50129cc on Base · Dynamic fee

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

What it does

An owner-controlled, upgradeable dynamic-fee hook that charges traders an owner-set fee with no visible cap and can change swap amounts; because it runs on liquidity removal, LPs must trust the owner not to block withdrawals.

How it works step by step

  • Sets a per-pool swap fee when a pool is created, and the owner can change it later.
  • Keeps an owner-set dynamic fee value and a gas limit that are read during swaps.
  • Counts swaps per pool, with a maximum swap count constant and an owner function that can reset or modify the counter.
  • Runs checks when LPs add liquidity and runs code after LPs remove liquidity.
  • Runs behind an upgradeable proxy controlled by an owner, so the logic can be replaced.
Swap behaviour
Before each swap the hook reads the pool's swap counter, the dynamic fee and a gas limit, and it may apply a fee or restriction. Because swap return deltas are enabled, the hook can change swap input or output amounts, and the exact amounts cannot be confirmed from bytecode.
Liquidity behaviour
The hook runs a check when liquidity is added, and that check reads the owner, so adding liquidity may be gated. It also runs after liquidity is removed, so the current or a future implementation could make withdrawals revert, although liquidity return deltas are disabled and it cannot take LP tokens that way.
Fee behaviour
Each pool gets a swap fee set at creation, and the owner can update it through setSwapFee and setDynamicFee. No maximum fee cap could be confirmed from the bytecode, and the fee recipient is unknown.
Owner & admin controls
The owner can set per-pool swap fees, the dynamic fee, the gas limit, a 'mid' address, per-address values and swap counters, with no visible caps. The owner can also upgrade the proxy implementation.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeAddLiquidity, afterRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize: records the pool's starting swap fee; beforeAddLiquidity: checks or gates new liquidity; afterRemoveLiquidity: runs after withdrawals and could revert them; beforeSwap: applies the fee, counter and gas checks; afterSwap: post-swap logic; beforeSwapReturnDelta and afterSwapReturnDelta: can adjust swap amounts.

Security & trust assessment

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

Who controls it: A single owner controls fees, the gas limit, swap counters and proxy upgrades. At worst the owner could set very high fees, take swap tokens through new logic, or block LP withdrawals.

Risk to user funds: Trader swap amounts can be changed through return deltas, with no verifiable fee cap. LP principal is not taken through liquidity deltas, but withdrawals could be blocked through the remove-liquidity callback.

Security findings

  • [high] Upgradeable proxy with swap return deltas: The owner can swap in new logic that uses the enabled swap return deltas to take tokens from trades.
  • [high] Withdrawal callback could trap LPs: afterRemoveLiquidity is enabled, so an upgraded or misconfigured implementation could make LP withdrawals revert.
  • [medium] Uncapped owner-set fees: setSwapFee and setDynamicFee take arbitrary values, and no cap is visible in the bytecode.
  • [medium] Possible liquidity gating: beforeAddLiquidity reads the owner address, which suggests that adding liquidity may be restricted.

Contract details

Verified source
No
Bytecode size
2,345 bytes
Upgradeable proxy
Yes
Detected patterns
dynamic-fee, ownable, return-delta, upgradeable

Pools using Dynamic fee hook