VolumeDynamicFeeHook on Optimism

Uniswap v4 Hook Contract 0x2c3254da64956f495356a482d51e7311347f5044 on Optimism · Dynamic fee · Verified contract

Volume (24h)
$2.31K
Value locked (TVL)
$4.04K
All-time volume
$1.85M
Pools using this hook
1
Swaps (24h)
1,529 (139 traders)
Total swaps
332,653

What it does

A single-pool dynamic-fee hook that moves LP fees between floor, cash and extreme tiers based on period swap volume compared with an exponential moving average, and takes a small owner-set share of swap output as a hook fee.

How it works step by step

  • Initializes the pool at the floor LP fee tier and enables dynamic fees for the bound pool key only.
  • Tracks stable-side swap volume per fixed-length period, ignoring swaps below a dust threshold.
  • Maintains an EMA of period volume and moves between floor, cash and extreme modes when volume-to-EMA ratios and minimum volumes are met for configured confirmation periods.
  • Applies hold periods, emergency low-volume reset to floor, and idle reset after prolonged inactivity.
  • Takes up to 10% of the unspecified-side swap amount as hook fee, minted as ERC6909 claims and withdrawable by the owner.
  • Suspends fee transitions and hook fee accrual while paused, but keeps swaps executing.
Swap behaviour
After each swap the hook adds the stable-side volume above a dust threshold to the current period, closes elapsed periods through the controller state machine, updates the LP fee tier via updateDynamicLPFee, and takes hookFeePercent of the unspecified-side amount as a return delta.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
Dynamic LP fee chosen among three owner-set tiers (floor, cash, extreme) by a volume and EMA state machine evaluated per period; the hook also takes a hookFeePercent (max 10%) of the unspecified-side swap amount, computed from the active LP fee tier and minted to the hook as ERC6909 claims.
Owner & admin controls
Owner (two-step transfer via proposeNewOwner/acceptOwner) can pause/unpause, set mode fees and controller/reset/model parameters (fees and model changes require pause), set hook fee percent with a 48h timelock capped at 10%, set dust threshold, emergencyReset to floor or cash while paused, claim accrued hook fees, and rescue non-pool tokens and ETH to the owner.

Enabled Uniswap v4 callbacks

afterInitialize, afterSwap, afterSwapReturnDelta

afterInitialize sets the initial floor fee and enables the dynamic fee via updateDynamicLPFee; afterSwap updates period volume, runs the fee-tier controller, updates the LP fee, and accrues hook fees; afterSwapReturnDelta lets the hook take a portion of the unspecified currency as a hook fee.

Security & trust assessment

Risk level: medium (verified source, high confidence).

Who controls it: The owner can set mode fees up to the LP fee maximum while paused, change controller thresholds and periods, force the fee tier via emergencyReset, pause swaps' fee updates and accrual, and claim all accrued hook fees. Hook fee percent is capped at 10% with a 48h delay, which limits but does not remove the owner's ability to extract value.

Risk to user funds: The hook holds ERC6909 claims for accrued hook fees on its PoolManager balance and can take a percentage of unspecified-side swap amounts; it does not custody LP principal, and swaps are not blocked by the owner, but the owner can change LP fees and pause fee accrual.

Security findings

  • [medium] Owner can drain accrued hook fees and rescue balances: The owner can claim all accrued hook fees at any time through claimHookFees, and rescue any non-pool token or ETH balance held by the contract.
  • [medium] Owner can reconfigure fees and parameters while paused: Mode fees, model and controller parameters can be changed by the owner without a timelock, but only while paused; pausing freezes regulator transitions and stops hook fee accrual while swaps still execute at the frozen fee.
  • [info] Hook fee change is timelocked and capped: Hook fee percent changes are gated by a 48-hour timelock and capped at 10%, which bounds the hook's take on swaps.
  • [low] Hook takes tokens via return delta: The hook takes a share of the unspecified-side swap amount through afterSwapReturnDelta and mints ERC6909 claims to itself, so it does affect the net amounts traders receive.
  • [info] Non-upgradeable with single owner key: The owner is a single EOA or address with no multisig requirement visible in the contract; no upgradeability proxy is present.

Contract details

Verified source
Yes (VolumeDynamicFeeHook)
Compiler
solc 0.8.26+commit.8a97fa7a
Bytecode size
20,950 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, moves-currency, return-delta, self-unlock

Pools using VolumeDynamicFeeHook