Dynamic fee hook on MegaETH

Uniswap v4 Hook Contract 0x7d1e3501d2e2bd6af25218df3d4a7479233c6ac8 on MegaETH · Dynamic fee

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

What it does

A Uniswap v4 hook that applies an owner-configurable swap fee on the pool and splits collected fees between the protocol, a team treasury and a buyback burner.

How it works step by step

  • Stores a configurable swap fee and applies it during beforeSwap.
  • Splits collected fees by owner-set protocol, team and buyback shares.
  • Forwards team and buyback portions to a treasury address and a buyback burner.
  • Tracks reserves and principal token state across liquidity add and remove operations.
  • Registers and validates the pool key during initialization.
Swap behaviour
beforeSwap and afterSwap callbacks run custom fee and accounting logic, and beforeSwapReturnDelta lets the hook adjust the swap's token deltas, taking a fee-based amount from the swap.
Liquidity behaviour
beforeAddLiquidity and beforeRemoveLiquidity callbacks are present; addLiquidity and removeLiquidity functions are exposed and interact with reserve/principal token state, so the hook manages a reserve-tracked liquidity position rather than relying solely on the pool's native liquidity.
Fee behaviour
A swap fee is stored in a storage slot and set by the owner through setSwapFee; fees are split between protocol, team and buyback recipients according to owner-set fee shares (setFeeShares), with a team treasury and buyback burner receiving their portions.
Owner & admin controls
Owner (Ownable) can set swap fee via setSwapFee, set fee share parameters via setFeeShares, set buyback burner and team treasury addresses, register the pool key, and transfer or renounce ownership.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeAddLiquidity, beforeRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta

beforeInitialize validates and records pool initialization; beforeAddLiquidity and beforeRemoveLiquidity gate and account liquidity changes; beforeSwap and afterSwap run custom swap logic and update fee/price state; beforeSwapReturnDelta lets the hook alter the swap's token deltas, so it can take or supply currency during swaps.

Security & trust assessment

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

Who controls it: The owner controls the swap fee, fee-share splits, the treasury and buyback burner addresses, and pool key registration. A malicious or compromised owner could raise fees substantially, redirect fee shares to a chosen address, or change the buyback destination, extracting value from swappers and LPs.

Risk to user funds: The hook uses take/settle/sync calls and return deltas, so it can hold and move pool currency during swaps and liquidity operations; the owner can alter fees and recipients that determine how those flows are split. Exact bounds on these parameters could not be verified without source.

Security findings

  • [medium] Owner-adjustable swap fee: Owner can call setSwapFee and set fees that apply to every subsequent swap, with the only guard being a FeeTooHigh/InvalidFee check whose threshold is not verified from source.
  • [medium] Return-delta currency handling: beforeSwapReturnDelta permission lets the hook modify swap deltas and take currency, so user swap amounts depend on hook logic controlled partly by the owner.
  • [medium] Fee recipient redirection: Owner can reassign team treasury, buyback burner and fee shares, redirecting protocol revenue.
  • [info] Single owner key: Ownable pattern with transferOwnership and renounceOwnership; no timelock or multisig evidence in bytecode.

Contract details

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

Pools using Dynamic fee hook