Dynamic fee hook on Ethereum
Uniswap v4 Hook Contract 0x051c99a4583a7137833ad048af442909426d00c4 on Ethereum · Dynamic fee
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $26.57M
- Pools using this hook
- 3
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 20,532
What it does
A Uniswap v4 hook that applies owner-configured tiered swap fees and can take a share of swap output through a return delta, with owner controls for pausing and withdrawing.
How it works step by step
- Selects a swap fee from configured tier values and a default fee in beforeSwap
- Blocks swaps when the owner has set the paused flag
- Counts swaps per pool id in a mapping keyed by bytes32
- Takes a return-delta amount after swaps via afterSwapReturnDelta
- Accumulates those amounts in the hook, which the owner can withdraw
- Exposes an owner-only fee configuration setter and gas threshold setter
- Swap behaviour
- beforeSwap sets a dynamic fee from the configured tiers and can be paused; afterSwap records the swap and can adjust the settled amounts through its return delta.
- Liquidity behaviour
- beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity, afterRemoveLiquidity, beforeDonate and afterDonate are present as selectors but permissions do not enable them, so the hook is not called on liquidity changes.
- Fee behaviour
- Fees appear to be tiered (tierOneFee, tierTwoFee, tierThreeFee, defaultFee) and set by an owner-controlled fee configuration; the beforeSwap path reads the fee config and likely selects a tier per swap, with the exact selection criteria unconfirmed without source.
- Owner & admin controls
- Owner (single address in slot 0) can call setPaused to halt the hook, setGasThreshold, transferOwnership, withdraw tokens held by the hook to any address, and an admin setter (selector 0xca14a65b, likely setFeeConfig taking uint24 tier fees, uint16 values and a uint256) that rewrites the fee tiers and related storage. No timelock or multisig was observed in the decoded input.
Enabled Uniswap v4 callbacks
beforeSwap, afterSwap, afterSwapReturnDelta
beforeSwap: sets a dynamic fee per swap using the fee configuration. afterSwap: records swap activity (swapCount mapping keyed by bytes32) and is paired with afterSwapReturnDelta, meaning it can return a delta that alters the amounts settled with the pool. afterSwapReturnDelta: allows the hook to take or give a token amount after the swap, which is the main source of hook-held balances.
Security & trust assessment
Risk level: medium (decoded bytecode, low confidence).
Who controls it: A single owner key can pause swaps, change fee tiers and the gas threshold, transfer ownership, and withdraw tokens the hook holds, so it can redirect fee revenue or freeze trading.
Risk to user funds: The hook can hold tokens taken via the afterSwap return delta and the owner can withdraw them. Swaps can be halted by pause, so users may be blocked from trading but the hook does not appear to custody LP principal.
Security findings
- [medium] Owner can pause swaps: The owner can call setPaused, which the beforeSwap path appears to check (paused() is read alongside beforeSwap), so a single key can block all swaps through the hook.
- [medium] Owner can change fees without observed bounds: The owner can call the fee configuration setter and change tier fees, potentially to very high values, with no visible cap in the decoded input.
- [medium] Owner can withdraw hook-held tokens: withdraw(address,address,uint256) is callable by the owner and moves tokens the hook holds, which include any amounts taken through the afterSwap return delta.
- [info] Hook takes tokens via return delta: afterSwapReturnDelta lets the hook take part of swap output, so tokens can accumulate in the hook contract before the owner withdraws them.
- [info] Unverified source limits analysis: No source is verified and selectors such as 0x3060a0b5 and 0xf0746b67 are undecoded, so the full behaviour and any upgrade path cannot be confirmed.
Contract details
- Verified source
- No
- Bytecode size
- 8,264 bytes
- Upgradeable proxy
- No
- Detected patterns
- ownable, pausable, return-delta
Pools using Dynamic fee hook
- USDC / WETH (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today
- WETH / USDT (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today
- USDC / WETH (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today