Dynamic fee hook on Ethereum

Uniswap v4 Hook Contract 0x1110a89be5f3656025f35514a173137b111128cc on Ethereum · Dynamic fee

Volume (24h)
$0
Value locked (TVL)
$6.00
All-time volume
$12
Pools using this hook
19
Swaps (24h)
0 (0 traders)
Total swaps
43

What it does

A dynamic-fee hook for Uniswap v4 pools that sets swap fees per pool and direction, exempts selected addresses, and uses return deltas to take or credit currency during swaps.

How it works step by step

  • Sets a per-pool, per-direction swap fee using currentFeeBps, bounded by MAX_FEE_BPS and LP_FEE constants
  • Applies a separate exemption list (setExempt/isExempt) to certain addresses
  • Takes or credits currency during swaps via beforeSwapReturnDelta and afterSwapReturnDelta
  • Tracks pool setup in beforeInitialize and afterInitialize and resolves pools via getPool
  • Supports a referral fee share capped by MAX_REFERRAL_BPS
  • Is owned and configurable by a single owner key that cannot renounce ownership
Swap behaviour
beforeSwap and afterSwap run on every swap; they compute a fee via currentFeeBps, may apply an exemption, and use return deltas to adjust the amounts settled with the pool manager.
Liquidity behaviour
beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity are dispatched; the hook appears to observe or gate liquidity changes, but the details are not determinable without source.
Fee behaviour
Fees are set per pool and direction via currentFeeBps(bytes32,bool) with MAX_FEE_BPS and LP_FEE constants, and a referral basis-point cap (MAX_REFERRAL_BPS); exempt addresses appear to receive different treatment. The exact fee formula cannot be determined from bytecode alone.
Owner & admin controls
Owner (slot 0) can call setExempt(address,bool) to exempt addresses and transferOwnership(address); renounceOwnership is present but reverts (RenounceDisabled), so ownership cannot be dropped. Owner can also call 0xff16bef7 (uint256,uint16,uint16), which writes to the pool mapping in slot 1 and likely sets fee parameters; the exact effect is unconfirmed without source.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeAddLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize and afterInitialize record or validate pool setup; beforeAddLiquidity and afterAddLiquidity gate or track LP actions; beforeSwap and afterSwap set fees and adjust balances for swappers; beforeSwapReturnDelta and afterSwapReturnDelta let the hook take or give back currency deltas during swaps; beforeDonate and afterDonate are dispatched but their effect is unknown.

Security & trust assessment

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

Who controls it: The owner can exempt addresses from hook logic, transfer ownership, and call the parameter-setting function at 0xff16bef7 that writes pool configuration. A compromised owner key could change fees on pools using this hook or redirect ownership to an attacker.

Risk to user funds: The hook can take or return currency deltas during swaps and pull funds through the pool manager, so user swap amounts and pool balances are exposed to its logic. It is not evident that it can block swaps outright, but without source this cannot be ruled out.

Security findings

  • [medium] Hook takes currency via return deltas: Hook uses beforeSwapReturnDelta and afterSwapReturnDelta, so it can take or credit currency during swaps and bytecode includes a take(address,address,uint256) call to the pool manager.
  • [medium] Owner can alter pool parameters: An owner-only function at selector 0xff16bef7 writes to pool-keyed storage (slot 1) and is reachable by the owner key; the bounds on the values it sets are not verified in source.
  • [low] Owner-controlled exemption list: The owner can exempt addresses via setExempt, changing how those addresses are treated by the hook's fee or swap logic.
  • [info] Ownership cannot be renounced: Ownership can be transferred but renouncement reverts with RenounceDisabled, so the owner role is permanent in the contract as deployed.

Contract details

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

Pools using Dynamic fee hook