Dynamic fee hook on Polygon

Uniswap v4 Hook Contract 0xbfdd47b54213b704b37d515d2637073753d96044 on Polygon · Dynamic fee

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

What it does

A Uniswap v4 hook on Polygon that charges a configurable dynamic fee on swaps, taking a share of output into the hook for later claiming by the owner or a recipient.

How it works step by step

  • Stores a pool configuration in beforeInitialize and records a pool-level flag.
  • Counts swaps per pool and accumulates fee totals on each afterSwap.
  • Takes a share of swap output into the hook using return deltas and the pool manager take function.
  • Tracks pending fees per address and lets them be claimed through claimFees.
  • Exposes owner-controlled fee parameters, a treasury address and ownership transfer.
Swap behaviour
afterSwap updates swap counters and fee accounting, and afterSwapReturnDelta lets the hook take a fee portion of the swap output.
Liquidity behaviour
beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity and afterRemoveLiquidity selectors are present but the decoded logic is not known; they likely only pass through without changing liquidity.
Fee behaviour
Uses a fee configuration stored in slots 4 and 5 (eight uint16 values, including a max total fee cap MAX_TOTAL_FEE_BPS and a MAX_RANDOM_FEE_BPS bound). afterSwap accumulates fees into fees_ and per-recipient pendingFees, which are claimable via claimFees. The hook appears to take a portion of swap output through afterSwapReturnDelta and redistribute it to a treasury and owner-claimable balances.
Owner & admin controls
Owner (Ownable) can call transferOwnership and set fee parameters via 0x76a7135c (eight uint16 values written to storage slots 4 and 5), can set the treasury, and can claim fees via claimFees with a recipient check. Owner is read from slot 0.

Enabled Uniswap v4 callbacks

beforeInitialize, afterSwap, afterSwapReturnDelta

beforeInitialize: runs setup and pool initialization checks, storing pool configuration. afterSwap: updates swap counters and fee accounting, and returns a delta that moves currency out of the pool. afterSwapReturnDelta: lets the hook take a share of the swap output as a return delta, which is how fees are collected.

Security & trust assessment

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

Who controls it: The owner can change fee parameters within the stored bounds, set the treasury address, transfer ownership and claim accumulated fees. A malicious or compromised owner key could redirect fee flows or raise fees up to the configured cap.

Risk to user funds: The hook can hold fee balances and moves currency via take during swaps, so a share of swap output is held by the hook until claimed. The owner can claim accumulated fees. Pool liquidity itself is not directly moved by the hook based on the decoded selectors.

Security findings

  • [medium] Hook takes swap value via return delta: afterSwapReturnDelta lets the hook take part of each swap's output and move it through the pool manager via take and unlock, so the hook directly custodies a share of swap value.
  • [medium] Owner-adjustable fee parameters: Eight uint16 fee parameters are writable by the owner through 0x76a7135c; the decoded cap MAX_TOTAL_FEE_BPS limits the total, but the exact bound enforcement could not be verified without source.
  • [low] Self-unlock callback surface: The hook contains a self-unlock path (unlockCallback and unlock) and calls take on the pool manager, which is a common pattern but relies on correct callback authentication that cannot be confirmed without source.
  • [info] Single owner control: Ownable access control on configuration and fee claiming functions with no timelock or pausing observed in the decoded selectors.

Contract details

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

Pools using Dynamic fee hook