BVCCDynamicFeeHook on Arbitrum
Uniswap v4 Hook Contract 0x2097d7329389264a1542ad50802bb0de84a650c4 on Arbitrum · Dynamic fee · Verified contract
- Volume (24h)
- $1.86K
- Value locked (TVL)
- $631
- All-time volume
- $16.62K
- Pools using this hook
- 10
- Swaps (24h)
- 45 (23 traders)
- Total swaps
- 1,318
What it does
A BVCC anti-bot hook that overrides each swap's LP fee with a dynamic value based on gas price, volatility and volume, adds a repeat-trader penalty, and takes a small 0.01% cut of swap output as a hook fee.
How it works step by step
- Initializes a default dynamic fee configuration for every new pool in afterInitialize.
- Before each swap, picks a base fee per pool (falling back to a global default of 0.025%) and scales it by Ethereum gas-price tiers: normal gas uses volatility and volume multipliers, higher gas tiers use fixed emergency multipliers.
- Caps emergency fees at a per-pool or default emergency cap (1% by default) and enforces an absolute ceiling of 7.5% via a circuit breaker.
- Adds a 2.5% penalty fee when the same sender (tx.origin) swaps again in the same pool within 300 seconds, unless anti-bot is paused.
- After each swap, takes 0.01% of the output amount into the hook contract as a hook fee, unless hook fees are paused.
- Tracks price snapshots and hourly volume per pool to drive the volatility and volume multipliers.
- Swap behaviour
- Before swap: computes and returns an overridden LP fee (with the override flag) and emits fee events; no token movement and no before-swap delta. After swap: if output is positive and hook fees are not paused, calls poolManager.take to move 0.01% of the output currency to the hook and returns that amount as an afterSwap delta, so the trader receives slightly less.
- Liquidity behaviour
- No liquidity callbacks.
- Fee behaviour
- The LP fee is set dynamically per swap (base fee times gas-tier or volatility/volume multipliers, plus penalty, capped at 7.5%). Separately, the hook takes a fixed 0.01% of swap output as its own fee, held in the hook contract and withdrawable by HOOK_FEE_MANAGER_ROLE.
- Owner & admin controls
- DEFAULT_ADMIN_ROLE (set to admin at deployment) can set network gas thresholds. FEE_MANAGER_ROLE can change the default and per-pool base fees, emergency fee caps, emergency multipliers, enable or disable dynamic fees per pool, and initialize pool configs. PAUSE_MANAGER_ROLE can pause or unpause dynamic fees, anti-bot, hook fee, and emergency fees per pool, or pause all for a pool (which also disables dynamic fees). HOOK_FEE_MANAGER_ROLE can withdraw accumulated hook fee tokens and native currency to any address. Roles are granted and revoked via the standard AccessControl functions by holders of the role admin. The contract is not behind an upgradeable proxy in the provided source.
Enabled Uniswap v4 callbacks
afterInitialize, beforeSwap, afterSwap, afterSwapReturnDelta
afterInitialize sets the default dynamic configuration for the new pool. beforeSwap computes and overrides the LP fee and applies the repeat-trader penalty. afterSwap collects the 0.01% hook fee on output, updates volume tracking, and returns that amount as a delta. afterSwapReturnDelta lets the hook take that delta from the swap output.
Security & trust assessment
Risk level: medium (verified source, high confidence).
Who controls it: A holder of FEE_MANAGER_ROLE can change fees on any pool, and a holder of HOOK_FEE_MANAGER_ROLE can drain accumulated hook fees. Holders of DEFAULT_ADMIN_ROLE can grant themselves any role, so the admin key effectively controls the whole contract.
Risk to user funds: The hook holds only the 0.01% fee tokens it takes on swaps and any native currency sent to it, not LP principal. It cannot block swaps by reverting in the code shown, but admin fee settings can raise swap costs up to 7.5% per swap.
Security findings
- [medium] Hook fee withdrawal by a single role: HOOK_FEE_MANAGER_ROLE can call withdrawHookFees and withdrawNative to send any ERC20 balance or native balance held by the hook to any address, and the same admin key holds all roles by default at deployment.
- [medium] Admin can change fees on live pools: FEE_MANAGER_ROLE can set a pool base fee up to 5% (MAX_BASE_FEE 50,000) and emergency multipliers up to 10x, and enable or disable dynamic fees, changing trader costs immediately without a timelock. Emergency fees are still capped at 7.5% by the absolute max.
- [low] Pause manager can halt fee logic: PAUSE_MANAGER_ROLE can switch dynamic fees, anti-bot, hook fee and emergency fees off per pool or set enabled to false via emergencyPauseAll. Pausing is not a swap block, but it changes fee outcomes for all swappers in that pool.
- [info] Hook takes tokens from swap output: afterSwap calls poolManager.take for 0.01% of output on every swap with positive output, so the hook holds token balances that the admin can withdraw. The fee is also skipped when the hook fee is paused.
- [info] Anti-bot keyed on tx.origin: The cooldown and penalty use tx.origin rather than the router or caller, so smart-contract wallets and routers share or evade the penalty depending on the caller, and the penalty can apply to an EOA's routed trades.
Contract details
- Verified source
- Yes (BVCCDynamicFeeHook)
- Compiler
- solc 0.8.30+commit.73712a01
- Bytecode size
- 19,711 bytes
- Upgradeable proxy
- No
- Detected patterns
- dynamic-fee, moves-currency, return-delta
Pools using BVCCDynamicFeeHook
- ETH / USDC (0.0075% fee) — 24h volume $1.78K, TVL $164, 24 swaps today
- ETH / USD₮0 (0.25% fee) — 24h volume $81, TVL $467, 21 swaps today
- WC / USDC (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (Dynamic fee) — 24h volume $0, TVL $0, 0 swaps today
- DARB / BBF (0.30% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / LINK (0.25% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH / USDC (0.0222% fee) — 24h volume $0, TVL $0, 0 swaps today
- ETH-BLUE / DARB (0.30% fee) — 24h volume $0, TVL $0, 0 swaps today
- USDC / USD₮0 (0.01% fee) — 24h volume $0, TVL <$0.01, 0 swaps today
- WC / USDC (0.30% fee) — 24h volume $0, TVL $0, 0 swaps today