BVCCDynamicFeeHook
ArbitrumHookBVCCDynamicFeeHook is a Uniswap v4 hook on Arbitrum. Live for 5 days. Still in use: 54 trades in the last week, and 2 new pools this week.
- Contract name
- BVCCDynamicFeeHook
How this hook works
Trading taxA trading tax hook. It changes its fee with the market, takes a cut of every trade and charges more right after launch.
Fee changes with the market
Instead of a fixed fee, it works out the fee on every trade from how the price is moving.
The code that does this (beforeSwap):function _beforeSwap(address sender, PoolKey calldata key, SwapParams calldata params, bytes calldata) internal override returns (bytes4, BeforeSwapDelta, uint24) { address user = _swapper(sender); PoolId poolId = key.toId(); uint24 baseFee = BVCCFeeGovernance.baseFeeOf(poolId); (uint24 finalFee, uint8 level,) = _ruleFee(poolId, baseFee); // Snapshots in every pool and on every swap (also at high gas and in emergency), so an // old snapshot always means no swap since: price moves only through swaps. _updatePriceSnapshotIfNeeded(poolId); if (block.timestamp - lastGasPriceCheck >= 60) { currentGasPrice = tx.gasprice; lastGasPriceCheck = block.timestamp; } PoolDynamicConfig memory config = _effectiveConfig(poolId); bool penaltyApplied = false; // Anchors are recorded even while anti-bot is paused, so unpausing never uses stale ticks. (, int24 currentTick,,) = poolManager.getSlot0(poolId); uint256 w0 = reversalWindow[poolId][0]; uint256 w1 = reversalWindow[poolId][1]; (uint256 n0, uint256 n1) = _rollWindow(w0, w1, currentTick); if (n0 != w0) reversalWindow[poolId][0] = n0; if (n1 != w1) reversalWindow[poolId][1] = n1; if (!config.pausedAntiBot) { uint256 penalties; if (block.timestamp - lastSwapTimestamp[poolId][user] < COOLDOWN_SECONDS) { penalties = REPEAT_PENALTY_FEE; penaltyApplied = true; // …Takes a cut of every trade
On top of the normal pool fee, it keeps a share of each trade. The fee can be changed. The fee builds up in the hook until it is collected.
The code that does this (afterSwap):function _afterSwap(address, PoolKey calldata key, SwapParams calldata params, BalanceDelta delta, bytes calldata) internal override returns (bytes4, int128) { PoolId poolId = key.toId(); uint256 finalFee; bytes32 tslot = FINAL_FEE_TSLOT; assembly ("memory-safe") { finalFee := tload(tslot) tstore(tslot, 0) } // The hook fee is always charged (it cannot be paused), like the base fee. bool outputIsToken0 = params.zeroForOne ? false : true; int256 outputAmount = outputIsToken0 ? delta.amount0() : delta.amount1(); // Every swap counts, always in token0 units so both directions share one unit. int256 amount0 = delta.amount0(); _updateVolumeTracking(poolId, uint256(amount0 < 0 ? -amount0 : amount0)); if (outputAmount <= 0) { return (BaseHook.afterSwap.selector, 0); } bool isExactIn = params.amountSpecified < 0; bool inputIsToken0 = params.zeroForOne; int256 inputDelta = inputIsToken0 ? delta.amount0() : delta.amount1(); if (!isExactIn) require(inputDelta < 0, "No input owed"); // Exact-input charges on output; exact-output charges on the real input. uint256 feeBasis = isExactIn ? uint256(outputAmount) : uint256(-inputDelta); uint256 feeAmount = finalFee == LAUNCH_TAG ? 0 : (feeBasis * hookFeePpm(uint24(finalFee))) / PPM; if (feeAmount == 0) { // …Higher at launch
The fee starts higher right after launch and comes down over time, which makes it costly for bots to buy first.
The code that does this (quoteSwapFee):function quoteSwapFee(PoolKey calldata key, address user, bool zeroForOne) external view returns ( uint24 finalFee, uint24 lpFeePpm, uint256 hookPpm, uint256 totalPpm, uint24 cooldownPenalty, uint24 reversalPenalty ) { PoolId poolId = key.toId(); (finalFee,,) = _ruleFee(poolId, BVCCFeeGovernance.baseFeeOf(poolId)); PoolDynamicConfig memory config = _effectiveConfig(poolId); if (!config.pausedAntiBot) { if (block.timestamp - lastSwapTimestamp[poolId][user] < COOLDOWN_SECONDS) { cooldownPenalty = REPEAT_PENALTY_FEE; } (, int24 currentTick,,) = poolManager.getSlot0(poolId); (uint256 n0, uint256 n1) = _rollWindow(reversalWindow[poolId][0], reversalWindow[poolId][1], currentTick); (reversalPenalty,) = _reversalPenalty(n0, n1, currentTick, zeroForOne, _tier1Ticks(config)); uint256 withPenalties = uint256(finalFee) + cooldownPenalty + reversalPenalty; if (withPenalties > MAX_FINAL_FEE) withPenalties = MAX_FINAL_FEE; finalFee = uint24(withPenalties); } lpFeePpm = uint24((uint256(finalFee) * LP_KEEPS_NUM) / LP_KEEPS_DEN); // …Pays extra to liquidity providers
It sends extra rewards straight into the pool for liquidity providers.
The code that does this (afterRemoveLiquidity):function _afterRemoveLiquidity( address, PoolKey calldata, ModifyLiquidityParams calldata, BalanceDelta, BalanceDelta, bytes calldata ) internal override returns (bytes4 selector, BalanceDelta hookDelta) { _forwardTo(address(BVCCLiquidityGuard), BVCCLiquidityGuard.afterRemoveLiquidity.selector); }Limits on trading
It limits trading, for example a max buy or wallet size or a wait between trades, to stop bots grabbing the supply before real traders.
The code that does this (beforeSwap):function _beforeSwap(address sender, PoolKey calldata key, SwapParams calldata params, bytes calldata) internal override returns (bytes4, BeforeSwapDelta, uint24) { address user = _swapper(sender); PoolId poolId = key.toId(); uint24 baseFee = BVCCFeeGovernance.baseFeeOf(poolId); (uint24 finalFee, uint8 level,) = _ruleFee(poolId, baseFee); // Snapshots in every pool and on every swap (also at high gas and in emergency), so an // old snapshot always means no swap since: price moves only through swaps. _updatePriceSnapshotIfNeeded(poolId); if (block.timestamp - lastGasPriceCheck >= 60) { currentGasPrice = tx.gasprice; lastGasPriceCheck = block.timestamp; } PoolDynamicConfig memory config = _effectiveConfig(poolId); bool penaltyApplied = false; // Anchors are recorded even while anti-bot is paused, so unpausing never uses stale ticks. (, int24 currentTick,,) = poolManager.getSlot0(poolId); uint256 w0 = reversalWindow[poolId][0]; uint256 w1 = reversalWindow[poolId][1]; (uint256 n0, uint256 n1) = _rollWindow(w0, w1, currentTick); if (n0 != w0) reversalWindow[poolId][0] = n0; if (n1 != w1) reversalWindow[poolId][1] = n1; if (!config.pausedAntiBot) { uint256 penalties; if (block.timestamp - lastSwapTimestamp[poolId][user] < COOLDOWN_SECONDS) { penalties = REPEAT_PENALTY_FEE; penaltyApplied = true; // …Rules for adding liquidity
It decides who can add liquidity, or when.
The code that does this (beforeAddLiquidity):function _beforeAddLiquidity(address, PoolKey calldata, ModifyLiquidityParams calldata, bytes calldata) internal override returns (bytes4 selector) { _forwardTo(address(BVCCLiquidityGuard), BVCCLiquidityGuard.beforeAddLiquidity.selector); }
Who controls it: The hook developer can change the fee and which routers are trusted. The hook developer can also change: min range width, network gas thresholds. The hook developer can also call: schedule reversal threshold, cancel reversal threshold, execute reversal threshold. The hook developer can withdraw funds held by the hook. The hook developer can pause it. The code cannot be changed.
Based on the hook’s published code.What do these labels mean?
Safety report
Before you build on it. Automated checks, not an auditsetTrustedRoutersetEmergencyMultiplierssetEmergencyMultipliersWhat it can do
Its code executes inside each trade in pools that use it.
It can take or add tokens during a swap. Fees, burns and custom curves work this way, and so do scams.
Pools using it let the hook choose the swap fee instead of a fixed tier.
It can change what LPs get back when they remove liquidity.
It checks every deposit before it goes in.
It can adjust token amounts when liquidity is added.
It runs when a pool is created, often to lock in that pool’s settings.
Hook history
Across all its pools, the hook took its fee from a trade: $0.0755.
- Took its fee from a trade 54 times, worth $0.0755
Latest transactions
- 0x0638b786…e8ce67 block 529,866,855 · 0.0000110 ETH
- 0x5c9e3884…962256 block 529,866,600 · 0.00358 USDC
- 0xdb53f1bd…6a6696 block 529,866,242 · 0.0000531 UNI
- 0x99c834f2…2603cb block 529,859,980 · 0.0000460 UNI
- 0x9c62cb57…49f91f block 529,851,320 · 0.00164 USDC
- 0xa0e3ff69…d71a40 block 529,849,046 · 5.76e-7 ETH
- 0x1419600d…6a4177 block 529,844,298 · 5.53e-7 ETH
- 0xb30be57d…190210 block 529,844,170 · 0.000898 USDC
- 0xf1fade68…1a502d block 529,843,919 · 0.00126 USDC
- 0x31bdc943…725ed7 block 529,831,160 · 3.06e-7 ETH
- Calculated the fee 54 times
Latest transactions
- 0x0638b786…e8ce67 block 529,866,855
- 0x5c9e3884…962256 block 529,866,600
- 0xdb53f1bd…6a6696 block 529,866,242
- 0x99c834f2…2603cb block 529,859,980
- 0x9c62cb57…49f91f block 529,851,320
- 0xa0e3ff69…d71a40 block 529,849,046
- 0x1419600d…6a4177 block 529,844,298
- 0xb30be57d…190210 block 529,844,170
- 0xf1fade68…1a502d block 529,843,919
- 0x31bdc943…725ed7 block 529,831,160
- Charged the rapid trading penalty 4 times
Latest transactions
- 0x1cda1dfa…1714d3 block 529,230,514
- 0x10089c9b…230f80 block 529,230,274
- 0x32f067be…c165ec block 528,534,030
- 0x3abd54c3…86abac block 528,529,958
- Applied the reversal penalty 2 times
Latest transactions
- 0x10089c9b…230f80 block 529,230,274
- 0x3abd54c3…86abac block 528,529,958
- Started the launch 2 times
Latest transactions
- 0x687a4b5a…c16899 block 528,521,325
- 0xb57f15fd…a1b3d7 block 528,347,996
- Started the operator transfer 2 times
Latest transactions
- 0xc9821e65…d1a66c block 529,690,122
- 0x4fb92596…4e683e block 529,690,101
Settings changes: set up fee settings for a new pool (2 times), set the base fee (1 time), scheduled a base fee (1 time).
Counted from what the hook recorded on-chain across all its pools, for every action in its published code, plus token transfers in and out of it. Dollar values count the amounts paid in ETH, stablecoins, BNB and BTC, at today’s prices.