B20Hook on Base

Uniswap v4 Hook Contract 0xf85f1f3082cfbc5e1149972309b25054e4d420cc on Base · Launchpad · Verified contract

Volume (24h)
$5.73
Value locked (TVL)
$4.23K
All-time volume
$11.34M
Pools using this hook
361
Swaps (24h)
1 (1 traders)
Total swaps
64,652

What it does

B20Hook is a launchpad hook for ETH-paired tokens that takes a market-cap-tiered fee (at most 1.25%) in ETH on buys and sells and splits it between a platform treasury and the token creator. It also restricts buying in the first blocks after a pool launches.

How it works step by step

  • Records the block in which each pool is initialized and charges no fee in that block.
  • Takes the swap fee in ETH from the pool manager through return deltas: on exact-input buys in beforeSwap, and on exact-output buys and exact-input sells in afterSwap.
  • Sets the fee rate from a tier table keyed on the token's market cap, read from the factory/launcher via getMarketCap. Defaults run from 1.00% below 15 ETH down to 0.10% at 6000 ETH or more.
  • Sends the platform share to platformTreasury and credits the creator share to the launcher through creditCreatorFee.
  • Applies an anti-snipe guard for the first antiSnipeBlocks blocks (default 3): buys are blocked in the launch block, and each tx.origin is capped at maxSnipeWei (default 0.1 ETH) of exact-input buys per pool. The factory's atomic dev-buy is exempted through a transient flag.
  • Reverts exact-output sells, and applies no logic to pools that are not an ETH/token pair.
Swap behaviour
For ETH/token pools, exact-output sells revert. In beforeSwap the anti-snipe check runs on buys. For exact-input buys the hook takes a fee from the ETH input via poolManager.take and returns a positive specified delta. In afterSwap, for exact-output buys and exact-input sells, it computes the fee from the ETH amount moved, takes it, and returns it as an unspecified delta. The fee is forwarded immediately to the treasury and the launcher. Pools without a native ETH currency are passed through with no fee.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
The hook charges a custom fee through return deltas, not the pool LP fee, so LPs receive none of it. The rate comes from the owner-settable tier table (each tier capped at 125 bps) selected by market cap. It is 0 in the pool's initialization block and 1% (100 bps) if no factory is set. The platform share goes to platformTreasury and the remainder is credited to the token creator through the launcher.
Owner & admin controls
The owner is set to tx.origin at deployment and can transfer ownership. The owner can set the platform treasury and the factory, replace the fee tiers (each tier at most 1.25%, thresholds ascending), enable, disable or retune anti-snipe (blocks and per-origin ETH cap), and withdraw all ETH held by the hook with rescueETH. The factory address can call armDevBuy. There is no pause function and no upgrade mechanism in the hook itself.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize records the pool's deployment block. beforeSwap runs the anti-snipe checks and takes the fee on exact-input buys. afterSwap takes the fee on exact-output buys and exact-input sells. beforeSwapReturnDelta and afterSwapReturnDelta let the hook claim the fee amounts from the swap.

Security & trust assessment

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

Who controls it: The owner can raise fees up to 1.25% per tier, repoint the factory and treasury, switch anti-snipe on or off, and sweep any ETH in the hook. The factory can arm the dev-buy exemption. It cannot pause trading or upgrade the code directly.

Risk to user funds: The hook does not custody user liquidity. It briefly holds ETH fees taken from swaps and forwards them in the same call, so balances are normally near zero unless a treasury send fails. Swaps for a pool can fail if the factory call reverts, and exact-output sells are blocked by design.

Security findings

  • [medium] Hook takes a fee from every swap via return deltas: beforeSwap and afterSwap call poolManager.take to move ETH to the hook and return the amount as a delta, so traders pay up to 1.25% outside the pool's LP fee.
  • [medium] Owner controls fees, factory and treasury: setFeeTiers, setFactory and setPlatformTreasury are owner-only. Fees are bounded at 1.25% per tier, but changing the factory redirects creator fees and the market-cap source to any address.
  • [medium] Swaps depend on an external factory contract: getMarketCap is wrapped in try/catch, but creditCreatorFee is called without protection. If the factory reverts or is malicious, fee-bearing swaps revert and pools could be blocked. Exact-output sells are also always rejected.
  • [low] Anti-snipe restrictions can block buys: In the launch window, buys in the pool's first block revert and later buys are capped per tx.origin. The owner can change blocks and the cap, or disable the guard entirely.
  • [info] Platform share is best-effort and rescuable by owner: A failed send to the treasury is ignored and the ETH stays in the hook, where only the owner can sweep it with rescueETH. The owner is tx.origin at deployment, which may be a deployer EOA.

Contract details

Verified source
Yes (B20Hook)
Compiler
solc 0.8.26+commit.8a97fa7a
Bytecode size
7,796 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, mev-protection, moves-currency, ownable, return-delta, rewards

Pools using B20Hook