DynamicFeeHook on Ethereum
Uniswap v4 Hook Contract 0x8b35143afac0f7fda790c6580d6a768bd4198080 on Ethereum · Dynamic fee · Verified contract
- Volume (24h)
- $0
- Value locked (TVL)
- $3.64K
- All-time volume
- $0
- Pools using this hook
- 3
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 0
What it does
A Uniswap v4 hook that lets authorized fee oracles set a per-pool swap fee on-chain, which the hook applies to every swap in that pool.
How it works step by step
- Stores a fee per pool (poolFees) that authorized fee oracles can update via updateFee, bounded by MIN_FEE and MAX_FEE.
- On each swap, beforeSwap updates the pool's dynamic LP fee to the stored value and returns it with the override flag.
- Optionally reverts swaps when the stored fee was last updated more than maxBlockRange blocks ago (staleness check, off by default).
- Manages a whitelist of fee oracles; the owner is always an oracle and oracles are added or removed by the owner.
- Exposes setDynamicFee so anyone can push the stored fee into the pool manager for a given key.
- Swap behaviour
- On every swap, beforeSwap checks the optional staleness window, reads the pool's stored fee, pushes it to the pool as the dynamic LP fee, and returns it as an override fee. No token deltas are taken.
- Liquidity behaviour
- No liquidity callbacks.
- Fee behaviour
- Fees are stored per pool by authorized fee oracles via updateFee, bounded between MIN_FEE (1) and MAX_FEE (1000000). On every swap, beforeSwap pushes the stored fee into the pool with poolManager.updateDynamicLPFee and returns it with the override flag. Fees are not shared with anyone; they accrue to LPs as normal.
- Owner & admin controls
- Owner (single EOA or multisig, not timelocked) can add and remove fee oracles, toggle the staleness check, set maxBlockRange, and transfer ownership. Fee oracles (including the owner) can set any pool's fee between MIN_FEE and MAX_FEE via updateFee. No pausing or upgrade mechanism found; the contract is not a proxy.
Enabled Uniswap v4 callbacks
beforeSwap
beforeSwap: reads the stored fee for the pool (optionally rejecting it if stale), updates the pool's dynamic LP fee, and returns the fee with the override flag set.
Security & trust assessment
Risk level: high (verified source, high confidence).
Who controls it: The owner and any address added as a fee oracle can set any pool's fee to any value from 0.0001% to 100%. A malicious or compromised key could set a 100% fee to extract essentially all swap value from traders, or set the fee so that swaps are uneconomical. The owner can also grant oracle rights to new addresses instantly.
Risk to user funds: The hook never holds tokens, takes no return deltas (beforeSwapReturnDelta is false) and does not move liquidity, so it cannot directly seize pool funds. User funds are exposed economically: a fee oracle can set extreme fees on a pool, and swaps can revert when the staleness check is enabled and the fee is stale or unset.
Security findings
- [high] Unbounded fee setting by oracles: updateFee lets any fee oracle set a pool fee up to MAX_FEE (100%), with no rate limit, timelock or per-update bound. The owner is also automatically an oracle.
- [medium] Single-key oracle and owner control: Oracle role is granted to any address by the owner with no timelock, and the owner is an EOA-style single key by default.
- [medium] Swaps can be blocked by staleness check: When checkStaleness is enabled, beforeSwap reverts with FeeDataStale if the fee has not been updated within maxBlockRange blocks, which can halt swaps for that pool until an oracle updates it. Staleness is off by default, so this only matters if enabled.
- [low] Unset fee blocks swaps: beforeSwap reverts with FeeTooLow when the stored fee is 0, so pools whose fee was never set cannot be swapped in this hook. Fee bounds in updateFee do not match the 0 path in beforeSwap.
- [info] Unrestricted setDynamicFee entrypoint: setDynamicFee is public and unrestricted and calls updateDynamicLPFee, but the pool manager's own access control applies, so this is informational only.
Contract details
- Verified source
- Yes (DynamicFeeHook)
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Bytecode size
- 10,776 bytes
- Upgradeable proxy
- No
- Detected patterns
- dynamic-fee, oracle, ownable
Pools using DynamicFeeHook
- ETH / USDC (0.01% fee) — 24h volume $0, TVL $3.64K, 0 swaps today
- AU / ORX (0.25% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.05% fee) — 24h volume $0, TVL $0, 0 swaps today