Dynamic fee hook on Ink
Uniswap v4 Hook Contract 0xf2b52a96554b3b12409110af54534841024a80cc on Ink · Dynamic fee
- Volume (24h)
- $0.39
- Value locked (TVL)
- $4.76K
- All-time volume
- $1.65M
- Pools using this hook
- 56
- Swaps (24h)
- 5 (3 traders)
- Total swaps
- 7,550
What it does
A Uniswap v4 hook that charges swap and holder fees on registered pools using return deltas, with a protocol fee share sent to a configurable recipient.
How it works step by step
- Runs before and after each swap on pools registered through the configured factory.
- Takes a swap fee (SWAP_FEE_BPS) and a holder fee (HOLDER_FEE_BPS) via return deltas.
- Splits a protocol fee (PROTOCOL_FEE_BPS) to a configurable protocolFeeRecipient.
- Stores per-pool fee configuration in poolFeeConfigs keyed by pool id.
- Restricts pool registration to the factory address, which the owner can set.
- Initialization and liquidity callbacks exist in the selector table but are not enabled in the hook permissions.
- Swap behaviour
- beforeSwap and afterSwap run on every swap of registered pools, with return deltas enabled so the hook can adjust swap amounts and take fees.
- Liquidity behaviour
- Liquidity add and remove callbacks (beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity, afterRemoveLiquidity) are present in the selector table, but these are not in the enabled permissions, so the hook is not expected to intercept them.
- Fee behaviour
- Fee constants are exposed (SWAP_FEE_BPS, HOLDER_FEE_BPS, PROTOCOL_FEE_BPS) and per-pool fee configs are stored in poolFeeConfigs. A protocol fee recipient is configurable. The hook uses return deltas, suggesting it takes a portion of swap amounts as fees, but exact split logic cannot be verified without source.
- Owner & admin controls
- Owner (Ownable2Step: transferOwnership, acceptOwnership, renounceOwnership) can set the factory address (setFactory) and the protocol fee recipient (setProtocolFeeRecipient). The factory is the only caller allowed to register pools (registerPool), so the factory and owner hold configuration control. Fee constants SWAP_FEE_BPS, HOLDER_FEE_BPS and PROTOCOL_FEE_BPS are exposed as views; whether they are immutable or adjustable cannot be confirmed from decoded bytecode alone.
Enabled Uniswap v4 callbacks
beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeSwap: hook runs before each swap and can return a delta. afterSwap: hook runs after each swap and can return a delta. beforeSwapReturnDelta: hook can modify the amount swapped, taking or giving tokens. afterSwapReturnDelta: hook can modify the post-swap amounts, taking or giving tokens.
Security & trust assessment
Risk level: medium, estimated (decoded bytecode, low confidence).
Who controls it: The owner can change the factory and protocol fee recipient, which redirects fee revenue. If the owner controls the factory, it can register new pools bound to this hook. Ownership is transferable and renounceable.
Risk to user funds: Because swap return deltas are enabled, the hook can take a share of swap amounts and route protocol fees to the configured recipient. It does not show a direct withdrawal function for pool funds in the selector list, but the owner-set recipient and return-delta fees mean user swap value is exposed to the hook's fee logic.
Security findings
- [medium] Return-delta hook takes swap value: beforeSwapReturnDelta and afterSwapReturnDelta are enabled, so the hook can take or alter token amounts during swaps; the exact extraction rate depends on fee constants and logic not visible without source.
- [medium] Owner-controlled fee recipient: The owner can set the protocol fee recipient, redirecting protocol fee revenue to an arbitrary address.
- [low] Factory-gated pool registration: Registration of pools is restricted to the configured factory, which is in turn set by the owner.
- [info] Two-step ownership: Contract is Ownable2Step; ownership changes require the pending owner to accept, reducing accidental transfer risk.
Contract details
- Verified source
- No
- Bytecode size
- 7,116 bytes
- Upgradeable proxy
- No
- Detected patterns
- ownable, return-delta
Pools using Dynamic fee hook
- WETH / XSPLASH (0.00% fee) — 24h volume $0.39, TVL $4.23K, 5 swaps today
- wMSTRx / SPLASHCAT (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- ANITA / wSPYx (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- WETH / XDOG (0.00% fee) — 24h volume $0, TVL $102, 0 swaps today
- WETH / STONK (0.00% fee) — 24h volume $0, TVL $282, 0 swaps today
- XSPLASH / WETH (0.00% fee) — 24h volume $0, TVL $54, 0 swaps today
- wMSTRx / WINK (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- AI / wNVDAx (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- WETH / XSPLASH (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- SDOG / XAUt0 (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- WETH / HSALPSX (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- WETH / KRAKENITES (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- KRAIKEN / wNVDAx (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- WETH / LAUNCHER (0.00% fee) — 24h volume $0, TVL $7.93, 0 swaps today
- WETH / ICAT (0.00% fee) — 24h volume $0, TVL $86, 0 swaps today
- THANOS / wNFLXx (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- FRIES / wMCDx (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- WETH / ICREATURE (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- AI / wNVDAx (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today
- wNVDAx / AGI (0.00% fee) — 24h volume $0, TVL $0, 0 swaps today