Dynamic fee hook on Ethereum
Uniswap v4 Hook Contract 0x094a582f6e34035ed4f8f3cd4ebfa56585880080 on Ethereum · Dynamic fee
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $350
- Pools using this hook
- 1
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 1
What it does
A dynamic-fee hook that adjusts each pool's swap fee based on recent volatility, raising fees in turbulent markets and lowering them in calm ones.
How it works step by step
- Records a per-pool volatility estimate from observations and an EWMA smoothing factor
- Maps the volatility estimate to a regime using moderate, high and ultra-high thresholds
- Chooses a fee between MIN_FEE_BPS and MAX_FEE_BPS (ULTRA_MAX_FEE_BPS as the outer cap)
- Writes the chosen fee to per-pool storage on each swap via beforeSwap
- Pushes the new fee to the pool manager with updateDynamicLPFee
- Exposes view functions for fee ranges, regime thresholds, volatility info and pool observations
- Swap behaviour
- On every swap, beforeSwap computes a volatility-adjusted fee within preset bounds, stores it per pool and sets it as the pool's LP fee for that swap.
- Liquidity behaviour
- No liquidity callbacks are enabled; liquidity add and remove functions exist in the dispatch table but the permissions only enable beforeSwap, so they are not invoked by the PoolManager for this hook.
- Fee behaviour
- Fees are set dynamically per pool by beforeSwap, which writes a fee value into storage slot 0 (a mapping keyed by pool) and returns it to the PoolManager as the dynamic LP fee. The fee is bounded by MIN_FEE_BPS, BASE_FEE_BPS, MAX_FEE_BPS and ULTRA_MAX_FEE_BPS, and is driven by a volatility measure (poolVolatilityData, EWMA_ALPHA, several time windows and regime thresholds). The bytecode also references updateDynamicLPFee, consistent with pushing the computed fee to the pool manager.
- Owner & admin controls
- No admin controls found. No owner, pause or upgrade selectors were dispatched; the parameter getters (MIN_FEE_BPS, MAX_FEE_BPS, BASE_FEE_BPS, thresholds, windows) are view-only constants or reads.
Enabled Uniswap v4 callbacks
beforeSwap
beforeSwap: computes the volatility-adjusted dynamic fee for each swap and applies it to the pool before execution.
Security & trust assessment
Risk level: medium, estimated (decoded bytecode, medium confidence).
Who controls it: Constants are fixed in bytecode and no privileged setter was found, so no single key is evident. The owner-free design could not be fully confirmed without source.
Risk to user funds: The hook does not take custody of tokens and has no liquidity or return-delta permissions, so it cannot hold or move pool funds directly. Its exposure is limited to the fee applied to swappers, which can be elevated up to the configured maximum.
Security findings
- [medium] Volatility-driven fee may be manipulable: Fee writes to storage are made from beforeSwap, which is permissionless and driven by on-chain price and volatility data. An attacker who can move pool price or manipulate the volatility observations could push the fee up or down for subsequent trades.
- [low] External fee update path: The contract calls extsload and updateDynamicLPFee on the pool manager. Mis-set fee bounds or an unexpected fee path could result in fees being applied that differ from documented ranges.
- [info] Unverified source: Without verified source, the exact fee formula and bounds could not be confirmed from the bytecode alone.
Contract details
- Verified source
- No
- Bytecode size
- 15,205 bytes
- Upgradeable proxy
- No
- Detected patterns
- dynamic-fee
Pools using Dynamic fee hook
- UMA / USDC (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today