Dynamic fee hook on Ethereum

Uniswap v4 Hook Contract 0x630fb08c650b084758dce07fc93ff681afcca044 on Ethereum · Dynamic fee

Volume (24h)
$2.88K
Value locked (TVL)
$2.87K
All-time volume
$2.88K
Pools using this hook
1
Swaps (24h)
61 (31 traders)
Total swaps
61

What it does

A Uniswap v4 hook that appears to charge a configurable fee on swaps, taking part of the output and directing it to a fee recipient controlled by the owner.

How it works step by step

  • Hooks into pool initialization through beforeInitialize
  • Computes a fee after each swap in afterSwap
  • Takes the fee from swap output using afterSwapReturnDelta
  • Transfers accumulated fees to a fee recipient via take and ERC-20 transfer
  • Stores two 16-bit fee parameters that the owner can set
  • Owner can change the fee recipient and claim accrued fees
Swap behaviour
After each swap, the hook computes a fee and takes it from the output via afterSwapReturnDelta, transferring it to the fee recipient.
Liquidity behaviour
No liquidity callbacks are enabled. Liquidity is not managed by the hook.
Fee behaviour
Fees are taken in afterSwap via afterSwapReturnDelta and accumulated for a fee recipient. Two 16-bit parameters stored in slot 3 (offsets 21 and 23) appear to control the fee rates, set by the owner through initialize(uint16,uint16) and read during swaps.
Owner & admin controls
Owner (Ownable2Step: transferOwnership, acceptOwnership, renounceOwnership) can call initialize(uint16,uint16) to set fee parameters, setFeeRecipient to change the fee recipient, and claimFees to withdraw accumulated fees. initializePool is also owner-gated per its selector. No pause or upgrade mechanism was identified.

Enabled Uniswap v4 callbacks

beforeInitialize, afterSwap, afterSwapReturnDelta

beforeInitialize: checks or sets up the pool when it is initialized. afterSwap: computes the swap fee after execution. afterSwapReturnDelta: lets the hook take a portion of the swap output as a return delta, which is how the fee is collected.

Security & trust assessment

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

Who controls it: The owner can set the fee parameters, change the fee recipient, and withdraw accumulated fees via claimFees. The owner can also transfer ownership, and a compromised key could redirect fee income or change fee rates used on subsequent swaps.

Risk to user funds: The hook can take a portion of swap output via return delta and send it to the fee recipient through take and transfer calls. It does not appear to hold pooled liquidity, but fee accrual and the owner's ability to change fee parameters affect the amounts traders receive.

Security findings

  • [medium] Hook takes tokens from swaps: afterSwapReturnDelta lets the hook take tokens from swap outputs. The take and transfer selectors indicate the hook moves currency to the fee recipient.
  • [medium] Owner controls fee rate and recipient: initialize(uint16,uint16) and setFeeRecipient are owner-only. The owner can change how much the hook takes from swaps and where the fees go, without a timelock visible in the bytecode.
  • [info] Ownable2Step ownership: Ownership is transferable through a two-step flow (acceptOwnership), which limits accidental transfers but still gives full control to whoever holds the key.
  • [info] Limited source visibility: Without verified source, the exact fee formula and the meaning of the two 16-bit parameters could not be confirmed, so the behaviour above is inferred from storage and selectors.

Contract details

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

Pools using Dynamic fee hook