Dynamic fee hook on Base
Uniswap v4 Hook Contract 0x9d7ff38214d4e7c4d13ea05730eb3a9d6c8445c7 on Base · Dynamic fee
- Volume (24h)
- $1.38K
- Value locked (TVL)
- $0.20
- All-time volume
- $1.38K
- Pools using this hook
- 1
- Swaps (24h)
- 45 (5 traders)
- Total swaps
- 45
What it does
This hook applies a dynamic fee to swaps and takes a share of it for a creator and a fee recipient, while an owner controls pausing, fees, exemptions and token withdrawals; exactly which trades pay more or less depends on the stored fee settings and exempt list, which cannot be confirmed without source.
How it works step by step
- Overrides the pool fee per swap in beforeSwap, using a fee configuration stored in the hook and per-address fee overrides.
- Tracks a whitelist-only mode and an exempt list of addresses and trusted routers that can be treated differently from ordinary traders.
- Collects a fee take in afterSwap via return deltas, splitting a share between a creator address (creatorBps) and a fee recipient.
- Applies afterAddLiquidity and afterRemoveLiquidity return-delta hooks, which can take or give currency relative to liquidity changes.
- Supports a pause flag, a gas threshold, and a withdraw function that moves tokens held by the hook out to a recipient.
- Includes a batched external call entrypoint (selector 0xe4a0fad4) that the owner can use to execute arbitrary calls from the hook.
- Swap behaviour
- beforeSwap reads the fee configuration and can return a dynamic fee; afterSwap takes a fee via return deltas and routes part of it to the creator and fee recipient. Which trades pay more or less depends on the stored fee configuration and the exempt and whitelist settings, which cannot be determined from bytecode alone.
- Liquidity behaviour
- afterAddLiquidity, afterRemoveLiquidity and their return-delta variants run after liquidity changes and can adjust balances through return deltas; beforeAddLiquidity and beforeRemoveLiquidity are present as view selectors but their gating logic cannot be confirmed.
- Fee behaviour
- The hook sets a dynamic LP fee in beforeSwap from a packed fee configuration (several uint24 and uint16 values, capped by MAX_FEE) and takes a hook fee in afterSwap; a creator share in basis points is paid out, with the remainder going to feeRecipient.
- Owner & admin controls
- Owner (Ownable with two-step transfer and renounce) can pause swaps, toggle whitelist-only mode, set fee overrides, exempt addresses and routers, change the fee configuration and creator share, set the fee recipient and gas threshold, withdraw tokens from the hook, and execute batched calls.
Enabled Uniswap v4 callbacks
afterAddLiquidity, afterRemoveLiquidity, beforeSwap, afterSwap, afterSwapReturnDelta, afterAddLiquidityReturnDelta, afterRemoveLiquidityReturnDelta
beforeSwap sets the dynamic fee per swap; afterSwap collects the hook fee through return deltas; afterAddLiquidity, afterRemoveLiquidity and their return-delta variants adjust currency flows around liquidity changes.
Security & trust assessment
Risk level: high, estimated (decoded bytecode, medium confidence).
Who controls it: A single owner key controls pausing, fees, the fee recipient, token withdrawals and arbitrary batched calls, giving that key full control over the hook and the funds it holds.
Risk to user funds: The hook can hold fee tokens and, via return deltas, adjusts swap and liquidity amounts; the owner can withdraw those tokens and can block swaps by pausing, so user funds depend on the owner's honesty.
Security findings
- [high] Owner can withdraw hook-held tokens: The withdraw selector (0xd9caed12) takes a token, a recipient and an amount under owner control, so any balance the hook accumulates from fees can be moved to an arbitrary address.
- [high] Owner can execute arbitrary calls: Selector 0xe4a0fad4 accepts an array of (uint256, bytes) and the bytecode contains call machinery, so the owner may be able to make the hook call any contract with its authority, which could transfer funds or alter state.
- [medium] Owner can change fee and fee split: Setters for the fee configuration, fee overrides, creator share and fee recipient let the owner raise fees up to MAX_FEE or redirect the fee share, affecting every trader.
- [medium] Swap pause and whitelist gating: setPaused and setWhitelistOnly can block or restrict swaps for all users through beforeSwap, so the owner can halt trading.
- [info] Return-delta fee takes: afterSwap and liquidity return-delta hooks take currency through return deltas, which is a deliberate mechanism rather than a flaw but means the hook can alter amounts users receive.
Contract details
- Verified source
- No
- Bytecode size
- 14,420 bytes
- Upgradeable proxy
- No
- Detected patterns
- access-control, dynamic-fee, erc20, fee-sharing, moves-currency, ownable, pausable, return-delta
Pools using Dynamic fee hook
- AXIS / USDC (Dynamic fee) — 24h volume $1.38K, TVL $0.20, 45 swaps today