Dynamic fee hook on Ethereum

Uniswap v4 Hook Contract 0xce7684c102347f0fda098cf60da37ad9e04bc088 on Ethereum · Dynamic fee

Volume (24h)
<$0.01
Value locked (TVL)
$0.73
All-time volume
<$0.01
Pools using this hook
14
Swaps (24h)
3 (2 traders)
Total swaps
25

What it does

A dynamic-fee hook for Uniswap v4 pools that sets swap fees through a configurable per-pool fee and can take a share of swap amounts via return deltas, with an owner-managed pool registry and token withdrawal function.

How it works step by step

  • Registers pools with a per-pool enabled flag and fee configuration (setPoolEnabled, setPoolFee, getPoolConfig).
  • Runs logic in beforeSwap that can adjust the swap fee for registered pools, updating the LP fee through the pool manager.
  • Uses beforeSwapReturnDelta, so beforeSwap can return a delta that changes the amounts settled for the swap, which means the hook can take a portion of the swap currency.
  • Exposes a swap-related function that performs swaps or settlements on behalf of the caller using a backend price value and an executor address.
  • Includes a withdrawToken function that moves tokens held by the hook out to a recipient.
  • Enforces a maximum LP fee and maximum hook fee in basis points, and an owner-gated configuration surface.
Swap behaviour
beforeSwap runs for every swap on registered pools; it can set a dynamic fee and return a delta that alters settlement amounts, so the hook may skim currency from swaps. Exact fee formula cannot be confirmed without source.
Liquidity behaviour
beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity selectors are present and dispatched, but their bodies cannot be characterised from the decoded input; they appear to be permissive pass-throughs.
Fee behaviour
Fees are set per pool by owner-level functions (setPoolFee, setPoolEnabled, a fee update path) and dynamically in beforeSwap, bounded by MAX_LP_FEE and MAX_HOOK_FEE_BPS. A hook fee in basis points may be taken from swaps via return deltas.
Owner & admin controls
An owner (owner() selector present) can enable or disable pools, set pool fees, configure the executor, and withdraw tokens held by the hook via withdrawToken. Pausing and upgrade capability are not evident from the decoded functions; no proxy pattern was detected.

Enabled Uniswap v4 callbacks

beforeSwap, beforeSwapReturnDelta

beforeSwap: sets the dynamic swap fee and computes the swap-time fee logic. beforeSwapReturnDelta: lets the hook return a delta that changes amounts settled, enabling it to take a cut of swap currency.

Security & trust assessment

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

Who controls it: The owner key controls pool enablement, fee levels, executor configuration and token withdrawals from the hook, so a compromised or malicious owner could extract accumulated funds or raise fees on pools using this hook.

Risk to user funds: The hook can hold tokens (via return-delta fee capture and settlement), and the owner can withdraw them with withdrawToken. It can also affect the amounts of user swaps through return deltas. It does not appear to block user withdrawals of liquidity from the decoded surface, but this cannot be fully confirmed.

Security findings

  • [medium] Owner can withdraw hook-held tokens: withdrawToken(address,address,uint256) is a nonpayable owner-reachable function that can transfer tokens the hook holds, including fees accumulated from swaps. Recipient restrictions could not be verified.
  • [medium] Return-delta fee skimming: beforeSwapReturnDelta permits the hook to alter settled swap amounts, so the hook can take currency from every swap on enabled pools; the rate is bounded only by MAX_HOOK_FEE_BPS as read from the bytecode.
  • [medium] Owner-controlled fees on live pools: setPoolFee and setPoolEnabled let the owner change fees or disable pools, which can affect the execution price for traders at the owner's discretion.
  • [low] Executor-driven swap path: An executor address and a swap-execution selector suggest a privileged or semi-trusted caller can trigger swaps through the hook; the trust boundary is not verifiable without source.
  • [info] Unverified source: No verified source is available, so behaviour is inferred from selectors, storage reads and writes, and external call selectors rather than confirmed logic.

Contract details

Verified source
No
Bytecode size
13,745 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, moves-currency, return-delta

Pools using Dynamic fee hook