Custom pricing hook on Ethereum

Uniswap v4 Hook Contract 0xc8b85c30fc2699012a3fe503075218305089658b on Ethereum · Custom pricing

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 a fee on swaps and records liquidity-related debts, with the owner able to change the fee and receive fees, but the exact trades that pay more or less cannot be determined from the decoded bytecode.

How it works step by step

  • Hook is attached with beforeInitialize, beforeSwap, afterAddLiquidity and afterRemoveLiquidity callbacks plus return-delta permissions, so it can override swap amounts and liquidity deltas.
  • Dispatches a beforeSwap entrypoint that can return a specific delta and a dynamic fee, indicated by the dynamic-fee and return-delta heuristics.
  • afterAddLiquidity and afterRemoveLiquidity entrypoints can return deltas, so the hook can take or credit tokens during liquidity changes.
  • Tracks per-pool and per-address debt in a nested mapping (debtOf) and a counter in storage, indicating internal accounting of owed amounts.
  • Moves currency using take(address,address,uint256) calls to the pool manager, and includes pancake and uniswap V3 swap callback handlers.
  • Stores a feeReceiver address and a uint16 fee parameter that owner-only setters update.
Swap behaviour
beforeSwap runs before each swap and can return a dynamic fee and a delta, so swaps routed through this pool may pay a fee or receive an adjusted amount that differs from the pool's default; the exact direction and size cannot be determined from bytecode alone.
Liquidity behaviour
afterAddLiquidity and afterRemoveLiquidity run after liquidity changes, can return deltas, record debt in a nested mapping keyed by pool id and address, and may take tokens via the pool manager.
Fee behaviour
A uint16 fee value stored in slot 0 is set by owner-only selectors and used by the swap path, with a feeReceiver address that receives collected fees; the precise fee formula is not determinable without source.
Owner & admin controls
Owner (slot 2) can transfer or renounce ownership, set the fee receiver and update the uint16 fee parameters via selectors 0xcb9442e2 and 0x534eb4cf.

Enabled Uniswap v4 callbacks

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

beforeInitialize sets up per-pool state; beforeSwap sets dynamic fees and deltas; afterAddLiquidity and afterRemoveLiquidity can return deltas to take or credit currency; the return-delta flags allow these deltas to alter balances.

Security & trust assessment

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

Who controls it: The owner can change fee parameters, the fee receiver and ownership, so a compromised key could redirect fees or raise the fee to extract value from traders and LPs.

Risk to user funds: The hook takes tokens from the pool manager through return deltas and debt accounting, so it can hold or withhold user and pool funds during swaps and liquidity changes.

Security findings

  • [high] Return-delta hooks can alter user funds: beforeSwap and liquidity callbacks have return-delta permissions and call take on the pool manager, so the hook can move or withhold tokens from swappers and LPs.
  • [medium] Owner-adjustable fee parameters: Selectors 0x534eb4cf and 0xcb9442e2 write uint16 values in slots 0 and 2 that the swap path reads; an owner could raise fees substantially.
  • [medium] Single owner key controls fee receiver: setFeeReceiver (0xefdcd974) redirects collected fees to any address chosen by the owner.
  • [info] Owner can transfer or renounce control: transferOwnership and renounceOwnership exist, so admin control may change hands or be permanently removed.
  • [info] No upgrade proxy detected: No upgrade or proxy selectors were found in the dispatch table, so the logic appears fixed at deployment.

Contract details

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

Pools using Custom pricing hook