Dynamic fee hook on Ethereum

Uniswap v4 Hook Contract 0x9d8c4a7cd478708441dbaba25aa6eca95d5f2044 on Ethereum · Dynamic fee

Volume (24h)
$0
Value locked (TVL)
$0
All-time volume
$0
Pools using this hook
1
Swaps (24h)
150 (50 traders)
Total swaps
150

What it does

This hook takes a fee from swaps through the pool's after-swap step and sends the accrued amount to a fee recipient, with the owner able to adjust the fee rates; without verified source, it is not confirmed which trade direction pays more.

How it works step by step

  • Sets a pool's fee on initialization through beforeInitialize, using the hook's stored parameters
  • Takes a fee from swap output in afterSwap via afterSwapReturnDelta and sends it to a fee recipient
  • Tracks accrued fees and lets the fee recipient claim them with claimFees
  • Lets the owner update the two stored fee rates with setFees and change the fee recipient with setFeeRecipient
  • Uses a two-step ownership transfer (transferOwnership then acceptOwnership) and a poolKey/initializePool flow for pool setup
Swap behaviour
afterSwap runs after each swap and can take a fee from the output via return deltas; the exact rate and which swap direction pays more could not be confirmed from bytecode alone.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
The hook stores two uint16 fee values (packed in slot 3 at offsets 21 and 23) that the owner can change with setFees; fees are taken from swaps and accrued for the fee recipient to claim; the exact split between LPs and recipient is not determinable without source.
Owner & admin controls
The owner can call setFees to change the two fee rates, setFeeRecipient to redirect fee revenue, initializePool, and transferOwnership/renounceOwnership; a pending owner must accept ownership. No pause function was identified.

Enabled Uniswap v4 callbacks

beforeInitialize, afterSwap, afterSwapReturnDelta

beforeInitialize is used to validate or configure the pool at creation; afterSwap with afterSwapReturnDelta is used to take a fee from each swap and credit it to the hook.

Security & trust assessment

Risk level: medium, estimated (decoded bytecode, low confidence).

Who controls it: A single owner key controls the fee rates, the fee recipient and ownership transfer; a compromised key could raise fees or redirect all accrued fees.

Risk to user funds: The hook can take a cut of swap output through return deltas and holds accrued fee balances until claimFees is called; it does not appear to hold LP principal directly.

Security findings

  • [medium] Owner-controlled fee rates: setFees(uint16,uint16) lets the owner change the swap fee rates stored in slot 3; the bytecode does not show a visible upper bound check, so the owner may be able to set a very high take rate.
  • [medium] Owner can redirect fee revenue: setFeeRecipient(address) lets the owner set where accrued fees are sent, so a compromised owner key could divert all collected fees.
  • [info] Hook takes value via return deltas: afterSwapReturnDelta allows the hook to take a portion of swap output, which means it holds or moves user-related currency during swaps.
  • [info] No pause or upgrade mechanism seen: No pause selector or proxy upgrade pattern was identified in the dispatched functions, so the logic appears fixed once deployed apart from owner parameter changes.

Contract details

Verified source
No
Bytecode size
6,192 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, erc20, fee-sharing, moves-currency, ownable, return-delta

Pools using Dynamic fee hook