Custom pricing hook on Ethereum

Uniswap v4 Hook Contract 0x236b8d54720f6db021dd0534f8beca52bf4560cc on Ethereum · Custom pricing

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

This hook charges an owner-set toll on swaps in its pool, collects it as the hook's own claim, and forwards it to a designated keeper address, so traders pay the toll on each swap while liquidity providers are not taxed by it.

How it works step by step

  • Charges a configurable toll on swaps, set by the owner via Tolls(uint16,uint16) and bounded by MIN_TOLL and MAX_TOLL, with BPS as the basis-point denominator
  • In beforeSwap and afterSwap it takes a portion of the swap amount using return deltas, so the hook, not the pool, receives part of the traded currency
  • Accumulates the collected tolls as unsentTolls and forwards them to a tollKeeper address (setTollKeeper) through fillTreasure
  • Uses the PoolManager unlock flow (unlock and unlockCallback) with mint and burn calls to hold the toll as ERC-6909 claims rather than raw tokens
  • Initializes its single pool in beforeInitialize and stores the poolId and a poolInitialized flag, so it serves one pool only
  • Allows an owner-set vault address (setVault) that the hook uses as a destination or source for funds, and blocks liquidity changes via beforeAddLiquidity and beforeRemoveLiquidity
Swap behaviour
Swaps run through beforeSwap and afterSwap with return deltas enabled, so a toll is deducted from the swap in the pool; the entry toll (entryToll) and the stored toll rate apply to the traded amount, and the exact direction and which trades pay more is not determinable from bytecode alone.
Liquidity behaviour
beforeAddLiquidity and beforeRemoveLiquidity are present, and afterAddLiquidity and afterRemoveLiquidity are decoded as pure stubs, so liquidity changes are likely gated or restricted rather than taxed; the exact gating logic cannot be confirmed from decoded bytecode.
Fee behaviour
Toll is set by the owner through Tolls(uint16,uint16) within MIN_TOLL and MAX_TOLL bounds and taken as a return delta on swaps; the pool's static fee is not modified by this hook.
Owner & admin controls
Owner (ownable, transferOwnership) can set the toll rates via Tolls, change the vault via setVault, change the tollKeeper via setTollKeeper, and transfer ownership; no pause or upgrade mechanism was found in the selectors.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize records the pool and its initialization state; beforeSwap sets the toll and return delta on swaps; afterSwap settles the toll and accumulates unsentTolls; beforeSwapReturnDelta and afterSwapReturnDelta allow the hook to take a share of swap currency.

Security & trust assessment

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

Who controls it: The owner can set toll rates, change the vault and tollKeeper, and transfer ownership, so a single key controls fee levels and where collected funds go.

Risk to user funds: The hook holds toll balances (tracked as unsentTolls and ERC-6909 claims) and takes a portion of swap currency via return deltas, and it can route them to the owner-set vault or tollKeeper.

Security findings

  • [medium] Owner-adjustable toll rate: The Tolls(uint16,uint16) function lets the owner change swap tolls up to MAX_TOLL, so a privileged key can raise the cost of every swap within the allowed bound.
  • [high] Vault and tollKeeper redirection: setVault and setTollKeeper let the owner redirect collected tolls and possibly hook-held balances to an arbitrary address, so a compromised owner key could divert accumulated funds.
  • [medium] Return-delta currency capture: beforeSwapReturnDelta and afterSwapReturnDelta let the hook take currency from swaps; swap outcomes depend on the hook's accounting, which increases the surface for accounting errors.
  • [low] Liquidity gating: beforeAddLiquidity and beforeRemoveLiquidity exist, so the hook may block LP actions; the exact conditions are not visible from decoded bytecode.

Contract details

Verified source
No
Bytecode size
8,029 bytes
Upgradeable proxy
No
Detected patterns
erc6909-claims, liquidity-management, moves-currency, ownable, return-delta, self-unlock, tax

Pools using Custom pricing hook