Dynamic fee hook on Polygon
Uniswap v4 Hook Contract 0x1e426e51ea4ca7ffa90457c1b0d3598694390088 on Polygon · Dynamic fee
- Volume (24h)
- $0
- Value locked (TVL)
- $637
- All-time volume
- $1.06K
- Pools using this hook
- 1
- Swaps (24h)
- 1 (1 traders)
- Total swaps
- 294
What it does
A Polygon dynamic-fee hook that sets a configurable LP fee on swaps and takes an owner-set hook fee in basis points from each swap.
How it works step by step
- Overrides the LP fee on each swap using a stored, owner-settable fee value
- Takes a hook fee expressed in basis points from swap amounts via beforeSwapReturnDelta
- Caps the pool fee and hook fee with MAX_POOL_FEE and MAX_HOOK_FEE_BPS constants
- Exposes owner-only withdrawToken to move ERC20 balances held by the hook
- Stores configuration in packed uint24 slots and a bool flag in slot 1
- Swap behaviour
- beforeSwap sets the dynamic LP fee and returns a delta that takes the configured hook fee from the swap amount.
- Liquidity behaviour
- Liquidity callbacks beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity are present in the dispatch table, but their bodies appear to be default or no-op logic; no evident state changes were decoded.
- Fee behaviour
- The hook returns an overridden LP fee from beforeSwap, stored in a uint24 at slot 0 offset 3 and set via setPoolFee, bounded by MAX_POOL_FEE. A separate hook fee in basis points (hookFeeBps, capped by MAX_HOOK_FEE_BPS) is stored at slot 0 offset 0 and appears to be taken from swaps through the return delta.
- Owner & admin controls
- Owner-gated functions include setPoolFee (0xda2076d9), setHookFeeBps (0xdb375842), withdrawToken (0x01e33667) and the nonpayable 0xe4e78bb0 which writes the packed uint24 at slot 0 offset 6. Owner is readable via owner() (0x8da5cb5b) and an executor() address is also exposed. Pausing or upgrade logic was not identified in the decoded selectors.
Enabled Uniswap v4 callbacks
beforeSwap, beforeSwapReturnDelta
beforeSwap sets a dynamic LP fee and can return a delta to take a hook fee from the swap. beforeSwapReturnDelta allows the hook to adjust the amounts settled with the PoolManager, which is how the hook fee is collected.
Security & trust assessment
Risk level: medium, estimated (decoded bytecode, medium confidence).
Who controls it: The owner can change the pool LP fee via setPoolFee and the hook fee via setHookFeeBps (within the caps), and can withdraw tokens held by the contract via withdrawToken. This can raise costs for swappers or redirect accrued hook fees.
Risk to user funds: The hook can take a fee from swaps via return delta and holds tokens it can transfer via withdrawToken, so balances in the hook contract are controlled by the owner. Pool liquidity itself is not directly held by the hook according to the decoded liquidity callbacks.
Security findings
- [medium] Owner can change swap fees: The owner-controlled setPoolFee and setHookFeeBps change swap economics immediately, with only the MAX_POOL_FEE and MAX_HOOK_FEE_BPS caps as limits.
- [medium] Owner can withdraw hook-held tokens: withdrawToken (0x01e33667) is owner-gated and can move ERC20 balances held by the hook, which may include accrued hook fees.
- [info] Hook takes currency on swaps: beforeSwapReturnDelta is enabled, so the hook can take a portion of each swap as a return delta, which settles against the PoolManager.
- [info] Unverified source: The source is unverified and this analysis relies on decoded selectors and storage, so the exact fee math and access checks were not confirmed.
Contract details
- Verified source
- No
- Bytecode size
- 9,140 bytes
- Upgradeable proxy
- No
- Detected patterns
- dynamic-fee, moves-currency, return-delta
Pools using Dynamic fee hook
- RNT / USDT0 (Dynamic fee) — 24h volume $0, TVL $637, 1 swaps today