Likely fee sharing hook on HyperEVM

Uniswap v4 Hook Contract 0x5172bf9ec9213d270e78275d991fee740637a0cc on HyperEVM · Fee sharing

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 charges owner-configurable buy and sell fees on swaps in its pool and routes the fee revenue to a treasury address.

How it works step by step

  • Charges a separate buy fee and sell fee in basis points on swaps in its pool
  • Takes fees via beforeSwapReturnDelta and afterSwapReturnDelta so fees are settled inside the PoolManager
  • Accrues fees in pendingFees and forwards them to the treasury through collectFees
  • Lets the owner update fee rates within a MAX_FEE_BPS cap using setFees
  • Uses ERC6909 claims with mint, burn and take to account for fee balances
Swap behaviour
beforeSwap and afterSwap run on every swap; the hook takes a directional fee through return deltas, accrues it, and the owner can later sweep it to the treasury.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
Fees are taken as a return delta in beforeSwap and afterSwap and accrue as pendingFees. buyFeeBps and sellFeeBps are owner-settable via setFees, bounded by a MAX_FEE_BPS constant; collectFees forwards accrued fees to the treasury. The exact direction-to-fee mapping and rounding could not be confirmed without source.
Owner & admin controls
Owner (storage slot 0) can call setFees(uint16,uint16) to set buy and sell fee bps, setTreasury(address) to redirect fee recipient, collectFees() to sweep accrued fees, and transferOwnership/renounceOwnership to change or drop control. No pause or upgrade mechanism was identified in the decoded selectors.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize: validates and records the pool id and initialization status for the pool. beforeSwap: computes the directional fee and returns a before-swap delta to take it. afterSwap: applies an after-swap delta and accrues fees. beforeSwapReturnDelta and afterSwapReturnDelta: allow the hook to take a share of swap amounts, which is the mechanism for fee capture.

Security & trust assessment

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

Who controls it: The owner can raise buy and sell fees up to MAX_FEE_BPS, redirect all future fee revenue by changing the treasury, and renounce or transfer ownership. A malicious or compromised owner could set fees to the cap and direct them to an arbitrary address.

Risk to user funds: The hook takes a fee from swap amounts via return deltas and holds accrued value until collectFees runs, so user swap proceeds pass through hook-controlled accounting. The owner can adjust that fee within the on-chain cap.

Security findings

  • [medium] Owner-adjustable fees and treasury: Owner can change buy and sell fee bps through setFees and redirect the treasury through setTreasury, affecting every subsequent swap.
  • [medium] Hook holds and moves swap value: beforeSwapReturnDelta and afterSwapReturnDelta let the hook take tokens from swap amounts, and the hook uses ERC6909 claims and take/mint/burn calls to hold funds.
  • [low] Accrued fees held by the contract: Accrued fees sit in the hook until collectFees is called; a bug in accounting or an owner key compromise would expose these balances.
  • [info] Single owner key: Ownable pattern with transferOwnership and renounceOwnership; no timelock or multisig is evident from the bytecode.

Contract details

Verified source
No
Bytecode size
6,777 bytes
Upgradeable proxy
No
Detected patterns
erc6909-claims, moves-currency, ownable, return-delta, self-unlock

Pools using Likely fee sharing hook