Dynamic fee hook on Ethereum

Uniswap v4 Hook Contract 0x5a9c0320f019a9d13304a163f72d76221579a58b on Ethereum · Dynamic fee

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

What it does

This hook sets dynamic parameters for pools and takes part in swap and liquidity accounting, with its exact fee direction not determinable from the decoded bytecode alone.

How it works step by step

  • Runs in beforeInitialize and records two uint16 parameters plus an address in slot 0 at initialization
  • Uses beforeSwap with return-delta permission, so it can alter swap amounts or take currency during swaps
  • Tracks debts per pool id and address in a nested mapping (slot 1), updated by liquidity add/remove callbacks
  • Calls an external take(address,address,uint256) function, indicating it settles currency with the pool manager
  • Stores a fee receiver address that can be changed by the owner via setFeeReceiver
  • Implements Uniswap V3 style swap callbacks (uniswapV3SwapCallback, pancakeV3SwapCallback), suggesting it performs internal swaps on another venue
Swap behaviour
beforeSwap is implemented and can return a delta, so the hook may adjust swap amounts or move currency during swaps. The exact fee or direction logic cannot be fully determined from decoded bytecode without verified source.
Liquidity behaviour
afterAddLiquidity and afterRemoveLiquidity callbacks are enabled with return-delta permission. They update debt bookkeeping in the nested mapping and may take or settle currency after liquidity changes.
Fee behaviour
Dynamic fee tagging is suggested by the heuristic, and the hook reads stored uint16 values in beforeSwap-related paths, which likely hold fee or parameter settings. The precise fee formula and which trades pay more or less cannot be determined from the decoded input.
Owner & admin controls
Ownable: owner() exists, and the owner can transfer or renounce ownership and set the fee receiver. The owner can also write slot 0 values via setter-like selectors (0x534eb4cf and 0xcb9442e2 accept uint16 arguments), so the owner likely controls fee or parameter settings. No pause or upgrade mechanism was found.

Enabled Uniswap v4 callbacks

beforeInitialize, afterAddLiquidity, afterRemoveLiquidity, beforeSwap, beforeSwapReturnDelta, afterAddLiquidityReturnDelta, afterRemoveLiquidityReturnDelta

beforeInitialize sets up pool-specific parameters at pool creation. beforeSwap with return delta can modify swap accounting. beforeSwapReturnDelta lets it take or give currency during swaps. afterAddLiquidity and afterRemoveLiquidity track debts after liquidity changes, and their return-delta permissions let them adjust balances.

Security & trust assessment

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

Who controls it: The owner can change fee-related parameters, redirect the fee receiver and transfer or renounce ownership, which affects all pools using this hook.

Risk to user funds: The hook has return-delta permissions and calls take(), so it can hold or move pool currency during swaps and liquidity changes. Users' funds are exposed to the hook's accounting logic and to owner-controlled parameters.

Security findings

  • [medium] Owner-set uint16 parameters: Two nonpayable selectors accept a uint16 and write to slot 0, which the owner can change. Changing these values could alter fees or swap behaviour for all pool users.
  • [high] Return-delta permissions on swap and liquidity callbacks: The hook can return deltas from beforeSwap and liquidity callbacks and calls take(), so it can move or hold pool currency. A malicious or buggy implementation could extract value from LPs or traders.
  • [medium] Fee receiver can be changed by owner: setFeeReceiver lets the owner redirect collected fees to any address, which is a centralization risk for accrued fees.
  • [low] Internal swap callbacks: The presence of uniswapV3SwapCallback and pancakeV3SwapCallback implies the hook performs swaps on external pools, which adds counterparty and reentrancy surface.

Contract details

Verified source
No
Bytecode size
12,915 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, moves-currency, ownable, return-delta

Pools using Dynamic fee hook