Likely dynamic fee hook on Ethereum

Uniswap v4 Hook Contract 0x704be9dcc8459f4e5f270ca47a3e7e3b303d80c0 on Ethereum · Dynamic fee

Volume (24h)
$0
Value locked (TVL)
$33.11K
All-time volume
$16.37K
Pools using this hook
1
Swaps (24h)
0 (0 traders)
Total swaps
65

What it does

A Uniswap v4 hook with owner-adjustable swap fees and an optional auto-rebalance step that runs after swaps, intended to let the pool operator tune fees for traders.

How it works step by step

  • Applies a dynamic swap fee via beforeSwap using owner-configured fee values
  • Tracks rebalance state in storage and updates it in afterSwap
  • Optionally triggers auto-rebalancing when enabled and conditions are met
  • Exposes setFees so the owner can change normal and rebalance fees
  • Restricts callbacks to the PoolManager via OnlyPoolManager
  • Liquidity and donate callbacks are present but appear to be no-ops
Swap behaviour
beforeSwap applies a fee derived from owner-set normalFee and rebalanceFee values; afterSwap updates internal state and may trigger rebalancing logic when autoRebalanceEnabled is true and shouldRebalance returns true.
Liquidity behaviour
Liquidity add and remove callbacks (beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity, afterRemoveLiquidity) exist in the dispatch table but appear to be stubs returning selectors only, so they do not appear to alter liquidity.
Fee behaviour
Fees are set by owner-controlled storage values via setFees(uint24,uint24); normalFee and rebalanceFee are stored as uint24 values and read during swap logic, so the hook appears to apply a dynamic fee that can differ between normal swaps and rebalance swaps. Exact fee application logic cannot be confirmed without source.
Owner & admin controls
Owner (Ownable: owner, transferOwnership, renounceOwnership) can call setFees(uint24,uint24), setRebalancer(address) and the bool/uint32/uint16 setter (0xe0c2cc3b) that writes autoRebalance and rebalance-related parameters. Owner can also revoke ownership entirely. No pause or upgrade mechanism was identified.

Enabled Uniswap v4 callbacks

beforeSwap, afterSwap

beforeSwap is used to read fee parameters and compute the swap fee override. afterSwap is used to update state (rebalance tracking, storage slot 1 and slot 2 writes) after each swap and may trigger auto rebalancing based on shouldRebalance().

Security & trust assessment

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

Who controls it: The owner controls fee levels via setFees and the rebalancer address via setRebalancer. A malicious or compromised owner could set very high fees to extract value from swappers, or redirect rebalancing to an address of their choosing.

Risk to user funds: The hook does not appear to custody tokens directly, and liquidity callbacks are stubs. Risk to users comes from owner-controlled fees that could be raised to extract value on swaps and from rebalance behaviour that could move pool state. Exact token-flow behaviour (return deltas) cannot be verified without source.

Security findings

  • [high] Owner-settable fee with no visible bound: setFees accepts arbitrary uint24 values; with no visible cap in the decoded interface, the owner could set a fee near 100 percent, causing swaps to be economically blocked or drained.
  • [medium] Owner can designate rebalancer: setRebalancer lets the owner assign the address that drives rebalancing, which can influence pool state changes triggered after swaps.
  • [medium] Single-key ownership: Ownable pattern with transferOwnership and renounceOwnership; control is held by a single EOA or contract with no timelock detected in the bytecode.
  • [info] Callbacks gated to PoolManager: Dispatch shows OnlyPoolManager and HookNotImplemented errors, indicating the hook correctly restricts callbacks to the PoolManager.

Contract details

Verified source
No
Bytecode size
4,700 bytes
Upgradeable proxy
No
Detected patterns
ownable

Pools using Likely dynamic fee hook