Dynamic fee hook on Arbitrum
Uniswap v4 Hook Contract 0x52578e2037393781ebf5aa2d64b90b427ab08088 on Arbitrum · Dynamic fee
- Volume (24h)
- $0
- Value locked (TVL)
- $41
- All-time volume
- <$0.01
- Pools using this hook
- 40
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 49
What it does
A dynamic-fee hook for Uniswap v4 pools on Arbitrum that sets swap fees per pool in its beforeSwap callback and can take a share of swap value through a return delta, with an owner-controlled configuration and a token withdrawal function.
This read was written for the hook 0xa018…4088 on Arbitrum and reused here: the two share a code shape, so constants such as fees, owners and addresses can differ.
How it works step by step
- Overrides the LP fee for swaps in the pool via a per-pool fee configuration, with a maximum LP fee bound (MAX_LP_FEE) and a hook fee bound in basis points (MAX_HOOK_FEE_BPS).
- Runs logic in beforeSwap that can modify the swap amount through a return delta, which means the hook can take or give currency during the swap.
- Stores per-pool configuration (pool enabled flag, fee settings) in storage keyed by pool id, and exposes getPoolConfig for reading it.
- Exposes owner and executor roles that can enable or disable pools and update fees (setPoolEnabled, setPoolFee and related selectors).
- Includes a withdrawToken function that moves tokens out of the hook contract, and a tokenBalance view, indicating the hook accumulates tokens (likely collected hook fees).
- Interacts with the PoolManager (POOL_MANAGER_ADDRESS, poolManager) and references external swap and settlement selectors, suggesting it can swap, take and settle currency internally.
- Swap behaviour
- beforeSwap is implemented and can return a fee override and a return delta, so the hook can alter the effective swap amount and fee and retain part of the currency for itself. afterSwap is also dispatched but its behaviour cannot be confirmed from the bytecode alone.
- Liquidity behaviour
- beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity selectors are dispatched; the permissions in the address only enable swap callbacks, so these are likely inert no-op or revert-free passthroughs. No liquidity callbacks with state changes are indicated.
- Fee behaviour
- The hook sets a dynamic LP fee per pool (setPoolFee, updateDynamicLPFee style selectors, bounded by MAX_LP_FEE) and collects a hook fee bounded by MAX_HOOK_FEE_BPS, accumulating those tokens in the contract balance, which the owner can withdraw.
- Owner & admin controls
- Owner and executor addresses exist. The owner (or executor) can enable and disable pools, change the LP fee per pool up to MAX_LP_FEE, and withdraw accumulated tokens through withdrawToken. Upgradeability and pausing could not be determined from the bytecode.
Enabled Uniswap v4 callbacks
beforeSwap, beforeSwapReturnDelta
beforeSwap: sets the dynamic fee and computes the swap-time currency adjustment for the pool. beforeSwapReturnDelta: lets the hook take a share of the swap's input or output currency through a return delta, so it directly affects the amounts users receive.
Security & trust assessment
Risk level: medium, estimated (decoded bytecode, low confidence).
Who controls it: The owner and executor can enable or disable pools, set per-pool LP fees up to the protocol cap, and withdraw tokens the hook holds. A compromised key could raise fees and drain accumulated balances.
Risk to user funds: The hook can take currency during swaps via the return delta and holds collected tokens, which the owner can withdraw. Funds held by the hook itself are at risk from the privileged key; LP principal in the PoolManager is not directly controlled by the hook from the evidence available.
Security findings
- [medium] Owner can withdraw hook-held tokens: withdrawToken(address,address,uint256) lets a privileged key transfer tokens held by the hook contract, which include fees collected through the return delta, to an arbitrary recipient. The recipient and caller checks could not be verified without source.
- [medium] Privileged fee control: setPoolFee and related selectors let an owner or executor change the LP fee for enabled pools, bounded only by MAX_LP_FEE, so a malicious key could raise swap costs for users up to that cap.
- [medium] Return delta can alter swap amounts: The hook holds beforeSwapReturnDelta permission, so it can change the currency amounts settled in a swap. Users are exposed to any extraction logic the hook implements, which cannot be fully verified from decoded bytecode.
- [info] No verified source: Source code is not verified, so access checks, reentrancy protection, upgradeability and the exact fee formula must be inferred from selectors and storage slots.
- [info] Inferred storage collisions: Storage slot 0 is a mapping of uint256 to address and slot 1 is a uint256 used in both reads and writes; their semantics (owner, executor, pool registry or counters) could not be confirmed.
Contract details
- Verified source
- No
- Bytecode size
- 13,750 bytes
- Upgradeable proxy
- No
- Detected patterns
- dynamic-fee, moves-currency, return-delta
Pools using Dynamic fee hook
- ETH / ARB (Dynamic fee) — 24h volume $0, TVL $14, 0 swaps today
- ETH / USD₮0 (Dynamic fee) — 24h volume $0, TVL $26, 0 swaps today
- ETH / USDC (Dynamic fee) — 24h volume $0, TVL $0.02, 0 swaps today
- ETH / ZRO (Dynamic fee) — 24h volume $0, TVL <$0.01, 0 swaps today
- ETH / wstETH (Dynamic fee) — 24h volume $0, TVL $0.24, 0 swaps today
- #BB / ARB (Dynamic fee) — 24h volume $0, TVL <$0.01, 0 swaps today
- #BB / UNI (Dynamic fee) — 24h volume $0, TVL <$0.01, 0 swaps today
- SOL / #BB (Dynamic fee) — 24h volume $0, TVL <$0.01, 0 swaps today
- ETH / USDC (Dynamic fee) — 24h volume $0, TVL <$0.01, 0 swaps today
- #BB / USDC (Dynamic fee) — 24h volume $0, TVL <$0.01, 0 swaps today
- GRAIL / #BB (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / FINX (Dynamic fee) — 24h volume $0, TVL $0.12, 0 swaps today
- ETH / #BB (Dynamic fee) — 24h volume $0, TVL $0.09, 0 swaps today
- #BTB / UNI (Dynamic fee) — 24h volume $0, TVL <$0.01, 0 swaps today
- USDC / USD₮0 (Dynamic fee) — 24h volume $0, TVL <$0.01, 0 swaps today
- WBTC / USDC (Dynamic fee) — 24h volume $0, TVL <$0.01, 0 swaps today
- Cake / #BB (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today
- #BB / USDe (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today
- #BTB / GRAIL (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / MAGIC (Dynamic fee) — 24h volume $0, TVL $0.12, 0 swaps today