Dynamic fee hook on Ethereum

Uniswap v4 Hook Contract 0xbfa9704fe4fe087d0e8532abe44df7fd24e240c0 on Ethereum · Dynamic fee

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

What it does

This owner-controlled dynamic-fee hook sets a per-swap fee that can be higher for specific addresses or during an armed block window, while LPs can still add and withdraw liquidity freely.

How it works step by step

  • Sets a dynamic swap fee (a 'tax') on each swap from its beforeSwap callback, using a default rate, per-address overrides and an 'armed' mode tied to block numbers.
  • The owner can 'arm' the hook (bait), after which swaps within a configurable grace window of blocks may be charged a different, likely higher, fee.
  • An afterSwap callback records state and appears to track a 'claw' token and amount, possibly to flag or follow certain traders.
  • The owner and a keeper can set fees, the grace period, per-address fee overrides and the keeper, and can sweep tokens held by the hook.
  • It has no liquidity callbacks, so LPs can add and remove liquidity freely.
Swap behaviour
Before each swap the hook picks a fee override from a default tax, per-address rates and an armed or grace-block mode, so some traders may pay more than others. After the swap it updates internal tracking state but cannot take tokens through return deltas.
Liquidity behaviour
No liquidity callbacks; LPs can add and withdraw freely.
Fee behaviour
The fee is a dynamic LP fee set per swap from admin-set values (default tax, per-address rates, armed-mode rate). Exact caps cannot be confirmed from bytecode, but Uniswap v4 limits LP fee overrides to at most 100%, and the fees go to LPs.
Owner & admin controls
The owner can change the default tax, per-address fee rates, grace blocks, the keeper and ownership, can arm, disarm or flip modes, and can sweep tokens from the hook. No fee cap is visible in the bytecode.

Enabled Uniswap v4 callbacks

beforeSwap, afterSwap

beforeSwap: chooses the fee for each swap, possibly based on the sender and block timing; afterSwap: updates tracking state after swaps.

Security & trust assessment

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

Who controls it: A single owner, plus a keeper, controls fee rates, per-address overrides and armed mode. The worst they can do is set very high swap fees for all or selected traders.

Risk to user funds: The hook cannot take swap tokens or LP principal directly. Traders may face admin-set fees of unknown size, up to the 100% v4 maximum, while LPs can always withdraw freely.

Security findings

  • [medium] Admin-set, possibly uncapped fees: The owner can set default and per-address swap fees with no cap visible in the bytecode. This could target specific traders, up to the v4 maximum of 100%.
  • [medium] Bait or arm mode based on blocks: Function names suggest an armed mode that charges different fees to swaps during a grace window of blocks. This looks like anti-sniper or trap logic run by the owner.
  • [low] Sweep function: The owner or keeper can sweep tokens held by the hook contract itself. Pool reserves held in the PoolManager are not affected.
  • [info] LP withdrawals unrestricted: Remove-liquidity callbacks and return deltas are disabled, so LP principal cannot be blocked or taken.

Contract details

Verified source
No
Bytecode size
7,264 bytes
Upgradeable proxy
No
Detected patterns
ownable, tax

Pools using Dynamic fee hook