BonkerHookDynamicFeeV2 on Base

Uniswap v4 Hook Contract 0x963e91a45148b39737b9df10c5b897b55ca9e8cc on Base · Dynamic fee · Verified contract

Volume (24h)
$26
Value locked (TVL)
$1.32K
All-time volume
$40.52K
Pools using this hook
367
Swaps (24h)
16 (4 traders)
Total swaps
28,903

What it does

A Uniswap v4 hook for Bonker token pools that sets the LP fee dynamically from price volatility, skims a protocol fee equal to 20% of the LP fee in the paired token for the factory, and runs a short-lived MEV fee module after pool creation.

How it works step by step

  • Before every swap it simulates the swap through the pool manager (a deliberate revert returns the end tick), measures the tick move against a reference tick, and sets the LP fee to baseFee + feeControlNumerator * volatility^2 / 1e10, capped at the pool's maxLpFee.
  • The hook takes a protocol fee of 20% of the current LP fee, always in the paired (non-Bonker) token, using before-swap and after-swap return deltas. It mints ERC6909 claims to itself, and on the next swap burns them and sends the tokens to the factory.
  • For the first 2 minutes after pool creation, an assigned MEV module can raise the swap fee up to 80%. During that window, liquidity adds are blocked.
  • Pools can only be created through initializePool (factory only) or initializePoolOpen (anyone). Direct pool manager initialization reverts, and ETH pools are rejected.
  • Factory-created pools can have an allowlisted pool extension that receives afterSwap callbacks, and an LP locker whose rewards are collected before swaps.
Swap behaviour
beforeSwap updates the dynamic LP fee using a simulated end tick, claims accumulated hook fees to the factory, triggers the LP locker's collectRewardsWithoutUnlock, runs the MEV module while it is active, and takes the protocol fee on the paired-token side through a before-swap delta where the paired token is the specified amount. afterSwap takes the fee through an unspecified-amount delta where the paired token is the unspecified amount, then calls the pool extension, with failures caught and logged.
Liquidity behaviour
beforeAddLiquidity reverts with MevModuleEnabled while the pool's MEV module is operational (the first 2 minutes after creation for pools where it was enabled). Otherwise adds are allowed, and removals have no callback.
Fee behaviour
Pools use the dynamic fee flag. The LP fee is baseFee (at least 0.25%) plus a quadratic volatility term, capped at maxLpFee (at most 10%). The decay and reset parameters are fixed per pool at creation. The protocol fee is 20% of the LP fee, taken in the paired token and sent to the factory. The MEV module can temporarily push the fee up to 80% during the first 2 minutes.
Owner & admin controls
There is no owner. The factory (immutable) alone can initialize factory pools and the MEV module, and it receives the claimed protocol fees. Each pool's MEV module address and locker are set by the factory at creation, and the MEV module alone can call mevModuleSetFee. Pool extensions must be enabled in an external allowlist contract whose governance is not visible here. The contract is not an upgradeable proxy, and I found no pause function and no way to change fee parameters after pool creation.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeAddLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize always reverts so pools can only start through the hook's own initializePool functions. beforeAddLiquidity blocks liquidity adds while the MEV module is active. beforeSwap sets the dynamic fee, claims fees, runs the MEV module and takes the protocol fee in the before-swap delta. afterSwap takes the protocol fee in the unspecified-amount delta and runs the pool extension. beforeSwapReturnDelta and afterSwapReturnDelta let the hook adjust swap amounts to collect the protocol fee.

Security & trust assessment

Risk level: medium (verified source, high confidence).

Who controls it: The factory receives all protocol fees and decides each pool's locker, MEV module and extension at creation. The MEV module can briefly raise the fee to 80% and block liquidity adds. No key can pause the hook, change fee parameters afterwards or upgrade the code.

Risk to user funds: The hook does not custody user funds long term. It holds protocol fees as ERC6909 claims in the pool manager until the next swap, when they are sent to the factory. Fees are taken from swap amounts through deltas. Funds could be affected if the locker or MEV module reverts and blocks swaps, or by temporary high MEV fees at launch.

Security findings

  • [info] Hook skims a protocol fee via return deltas: beforeSwap and afterSwap return deltas take 20% of the LP fee in the paired token for the factory. Swappers pay this on top of the LP fee, and the hook mints and later burns ERC6909 claims to move it.
  • [medium] Temporary MEV fee up to 80%: The pool's assigned MEV module can raise the fee up to MAX_MEV_LP_FEE (800000, which is 80%) via mevModuleSetFee. This only works for 2 minutes after creation, and the module can also block liquidity adds during that time. Its logic lives in an external contract not shown here.
  • [medium] External calls in the swap path: beforeSwap calls the LP locker (collectRewardsWithoutUnlock) and the MEV module without catching failures. A reverting or malicious locker or module chosen by the factory could block swaps. Pool extension calls are wrapped in try/catch.
  • [low] Swap simulation with approximate fee: The hook runs a nested pool manager swap and reads the end tick from a revert. The comment in the source says the simulated tick may differ from the real one, so the fee can be slightly off. The decoding relies on revert-data parsing, and a failed simulation reverts the swap.
  • [low] Open pool creation for any token pair: initializePoolOpen lets anyone create pools. Parameters such as maxLpFee up to 10% and baseFee are set by the creator, so traders should check each pool's config. Open pools have no locker, MEV module or extension.

Contract details

Verified source
Yes (BonkerHookDynamicFeeV2)
Compiler
solc 0.8.28+commit.7893614a
Bytecode size
20,347 bytes
Upgradeable proxy
No
Detected patterns
access-control, dynamic-fee, mev-protection, return-delta

Pools using BonkerHookDynamicFeeV2