Dynamic fee hook on Polygon

Uniswap v4 Hook Contract 0xb415ba047e5806ffe25e7197a378c01cd8e34088 on Polygon · Dynamic fee

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

What it does

A pausable Uniswap v4 hook that gates swaps through a beforeSwap check and can take a fee via a return delta, with an owner-set fee per pool and a pause switch that can stop swaps.

This read was written for the hook 0xf705…8088 on Ethereum and reused here: the two share a code shape, so constants such as fees, owners and addresses can differ.

How it works step by step

  • beforeSwap runs on every swap in pools using this hook and reads the paused flag and a per-pool fee mapping.
  • The owner can pause and unpause the hook through setPaused(bool), which affects swap handling.
  • The owner can set a fee for a pool through setPoolFee(bytes32,uint24), indexed by pool id.
  • beforeSwapReturnDelta permission means the hook can return a delta that adjusts the swap amounts, which is how a custom fee or charge is taken from a swap.
  • The contract also holds a pool registry (pool count, allPools array, pools mapping) and exposes owner, poolManager and weth getters.
  • Liquidity and donate callbacks exist as selectors but the hook does not enable those permissions, so they are not invoked by the pool manager.
Swap behaviour
beforeSwap is invoked before each swap, checks the paused state and reads the stored fee for the pool, and can return a delta that changes the swap settlement amounts.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
Per-pool fee is stored in a mapping and set by the owner via setPoolFee; the hook can charge this through its return delta during swaps. Exact fee arithmetic cannot be confirmed without source.
Owner & admin controls
Owner can change the owner address (setOwner), pause or unpause swaps (setPaused), and set per-pool fees (setPoolFee). A function that sets an address (selector 0x8ec6cd0d, and others) appears but its purpose is unknown.

Enabled Uniswap v4 callbacks

beforeSwap, beforeSwapReturnDelta

beforeSwap is used to run custom logic and check pause state and pool fee on each swap. beforeSwapReturnDelta is used to let the hook return a balance adjustment that is applied to the swap.

Security & trust assessment

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

Who controls it: A single owner key can pause all swaps for pools using this hook, set arbitrary per-pool fees that the return delta applies to trades, and transfer ownership.

Risk to user funds: The hook can alter swap amounts through its return delta and can block swaps through the pause flag; it does not appear to custody pool funds directly, but fee changes directly affect what traders receive.

Security findings

  • [medium] Owner can pause swaps: setPaused(bool) is gated by owner state and beforeSwap reads the paused flag, so the owner can halt swaps in pools using this hook.
  • [medium] Owner can set pool fee: setPoolFee(bytes32,uint24) lets the owner change the fee for a pool; without a documented cap a very high value could extract most of a trade via the return delta.
  • [medium] Return delta takes value from swaps: beforeSwapReturnDelta permission lets the hook alter swap amounts, so it can take tokens from traders; the exact amount and conditions cannot be verified from bytecode alone.
  • [low] Owner transfer is a single step: setOwner(address) appears to change ownership in one call, so a mistaken or malicious transfer is not recoverable without the new owner.
  • [info] Unverified source: No verified source is available, so behaviour and cap checks are inferred from decoded selectors and storage only.

Contract details

Verified source
No
Bytecode size
16,996 bytes
Upgradeable proxy
No
Detected patterns
pausable, return-delta

Pools using Dynamic fee hook