FactoryHook on Robinhood Chain

Uniswap v4 Hook Contract 0xb31780aad49d3cc7dd6e03e9e462606f0a5a30cc on Robinhood Chain · Dynamic fee · Verified contract

Volume (24h)
$1.59K
Value locked (TVL)
$35.13K
All-time volume
$826.77K
Pools using this hook
21
Swaps (24h)
6 (6 traders)
Total swaps
5,984

What it does

A singleton fee hook for graduated BC token pools that charges a volatility-based dynamic fee, delivers the LP share as the native LP fee, and routes the protocol share to treasury, staking vault and fee recipient.

How it works step by step

  • Blocks swaps on a pool until the BC token reports it has graduated (isLPd).
  • Computes a volatility reading from time-decayed tick displacement of recent swaps, capped at 900 ticks.
  • Runs a bounded chain of optional third-party fee calculators seeded with a base fee of 0.30% by default, clamped to 10% (50% during an optional sniper window).
  • Delivers the LP share of the fee as V4's native dynamic LP fee override and takes the protocol share as a hook delta, with a 3 bps floor.
  • Distributes the protocol share: treasury takes protocolFeeRatio, the remainder splits between the staking vault and fee recipient, with ETH-side payouts wrapped to WETH.
  • Maintains a truncated tick oracle checkpointed after each swap and notifies bound observers after swaps under a shared gas budget.
Swap behaviour
Swaps are blocked until the coin is graduated. Each swap updates a decaying volatility accumulator, computes a total fee through the pool's fee chain (capped at 10%, or 50% in a sniper window), floors it at 3 bps, splits it into LP and protocol shares, and takes the protocol share as a hook delta on the input currency.
Liquidity behaviour
No liquidity callbacks. Liquidity hook flags are off, so third-party LPs can add and remove liquidity freely and the hook never intercepts position mint or collect.
Fee behaviour
Each graduated pool uses V4 dynamic fees. A fee chain seeded with a fixed base fee (default 0.30%) is run via staticcall stages, volatility (decayed tick displacement, capped at 900 ticks) feeds the chain, and the result is floored at 3 bps and capped at 10% (50% during an optional sniper window of up to 1 hour after graduation). The total is split by lpShareBps (default 70%): the LP share is delivered as the native LP fee override, and the protocol share (never below the 3 bps floor) is taken by the hook as a delta and distributed to treasury, staking vault and fee recipient.
Owner & admin controls
Factory owner (via BCTokenFactory.owner()) can set protocolFeeRatio (0-100) and the stakingVaultFactory, and can replace or clear each pool's staking vault via setStakingVault. Liquidity manager is the only caller allowed to register pools and initialize them. No pause or upgrade mechanism is present in the hook; it is immutable with constructor-set BC_TOKEN_FACTORY and WETH.

Enabled Uniswap v4 callbacks

beforeInitialize, afterInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize restricts pool creation to the liquidity manager for registered, dynamic-fee pools. afterInitialize seeds volatility and oracle state from the opening tick. beforeSwap gates swaps to graduated coins (isLPd), updates volatility, computes the fee and takes the protocol share on exact-input swaps as a hook delta, and sets the LP fee override. afterSwap checkpoints the truncated oracle, charges the protocol share on exact-output swaps, and notifies bound observers. beforeSwapReturnDelta and afterSwapReturnDelta let the hook take non-LP fee tokens.

Security & trust assessment

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

Who controls it: The factory owner can set the protocol fee ratio up to 100% of the non-LP share (protocol floor still applies as a minimum), redirect or clear staking vaults, and change the staking vault factory. Changing the protocol ratio alters revenue split, not the swap price, but the owner's control of the protocol treasury address via the factory affects where protocol fees go.

Risk to user funds: The hook takes a non-LP share of every swap fee (hook delta) and routes it to treasury, staking vault and fee recipient; it does not custody pool liquidity. Protocol share is never below 3 bps of swap amount. The hook does not hold user funds beyond transient settlement within the swap.

Security findings

  • [info] Swap gate depends on external graduation flag: Swaps revert with NotLPd until the coin is graduated, so trading is gated on an external coin flag controlled by the factory's liquidity manager.
  • [low] Per-swap fee take can revert on drained pools: Fee distribution uses poolManager.take against live pool reserves. A swap whose input currency the pool has been drained of cannot have its fee taken and reverts.
  • [low] Bound observers can reenter swap flow: Observers run inside the swap unlock and can run nested swaps. Isolation relies on V4 per-address delta accounting and a shared gas budget. A malicious observer can at most DoS its own pool by leaving unsettled deltas.
  • [info] Third-party fee calculators are caged: Fee-chain stages are third-party staticcalls with a fixed gas stipend and output clamped to the cage. A failing stage is skipped, so a malicious calculator cannot raise the fee above the cap or block swaps.
  • [medium] Owner can route the entire non-LP fee to protocol treasury: Protocol ratio of the non-LP share can be set to 100% by the factory owner, so the protocol can capture all of the non-LP fee while LPs keep the native LP share.

Contract details

Verified source
Yes (FactoryHook)
Compiler
solc 0.8.26+commit.8a97fa7a
Bytecode size
19,382 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, erc20, liquidity-management, mev-protection, moves-currency, oracle, return-delta, rewards

Pools using FactoryHook