Dynamic fee hook on Base

Uniswap v4 Hook Contract 0xb44b5efef0c69f2cefa98a940b5802270298a9cc on Base · Dynamic fee

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

What it does

This upgradeable, owner-controlled hook applies owner-set per-pool and dynamic swap fees and counts swaps, and it can change swap amounts. Fee caps are unverified, so any swapper could pay more than expected, and an upgrade could take swap funds or block LP withdrawals.

How it works step by step

  • Sets a per-pool swap fee when a pool is created and lets the owner change it later.
  • Keeps a global dynamic fee value and a per-pool swap counter, apparently with a maximum swap count setting.
  • Runs checks before liquidity is added that read the owner address, so adding liquidity may be restricted to the owner.
  • Runs on swaps with return-delta permissions, so it can adjust swap amounts, for example to take a fee.
  • Sits behind an upgradeable proxy controlled by an owner.
Swap behaviour
Before and after each swap the hook reads the pool's fee settings and swap counter, and it can change the amounts swapped through return deltas. The exact fee size and any swap-count limit cannot be confirmed from bytecode alone.
Liquidity behaviour
Adding liquidity goes through a check that reads the owner address, which may block non-owners. The hook also runs after liquidity is removed, and because the contract is upgradeable, a future version could make withdrawals revert.
Fee behaviour
Each pool has a swap fee, and there is a separately settable dynamic fee and a default fee. No maximum fee cap could be confirmed from the bytecode, and it is not clear who receives any fees the hook takes.
Owner & admin controls
The owner can set per-pool swap fees, the dynamic fee, a gas limit, and an external 'mid' address, and can write per-address values and per-pool counters. The owner can also upgrade the implementation. No caps on any of these settings are visible.

Enabled Uniswap v4 callbacks

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

beforeInitialize records the pool's starting swap fee; beforeAddLiquidity gates or checks deposits; afterRemoveLiquidity runs after every withdrawal; beforeSwap applies the fee logic and swap counting; afterSwap does post-swap processing; beforeSwapReturnDelta and afterSwapReturnDelta let the hook change swap input and output amounts.

Security & trust assessment

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

Who controls it: A single owner controls fees and settings and can upgrade the hook's code. In the worst case an upgrade could take swap tokens through return deltas or block LP withdrawals.

Risk to user funds: Swap input and output amounts can be changed by the hook, with no verified fee cap. LP principal could be locked by an upgrade, because the hook runs after every withdrawal.

Security findings

  • [high] Upgradeable proxy with swap return deltas: The owner can swap in new code, and the hook address allows return deltas on swaps, so a new version could take tokens from swaps.
  • [high] Withdrawal callback can be changed: afterRemoveLiquidity is enabled, so an upgraded implementation could make withdrawals revert and trap LP funds.
  • [medium] Fees set by owner with no visible cap: The setSwapFee and setDynamicFee functions are owner-controlled, and no maximum could be verified from bytecode.
  • [low] Liquidity deposits may be gated: beforeAddLiquidity reads the owner address, which suggests only the owner may be allowed to add liquidity.

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