Building a v4 hook? Four house hooks already earn on every swap: volatility fee, anti-snipe, agent rebate and weekend gap guard.Read the protocol.Building a v4 hook? Four house hooks already earn on every swap: volatility fee, anti-snipe, agent rebate and weekend gap guard.Read the protocol.
v4 Marketplace docs

Build on v4 Marketplace

Hooks and storefronts

A stacked v4 hook is a small contract with three functions. A storefront is where its author lists it, sets its royalty and stakes $V4M behind it.

The ILog interface

interface ILog {
    function onStack(PoolKey calldata key, bytes calldata cfg) external;
    function beforeSwap(address origin, PoolKey calldata key, SwapParams calldata params)
        external returns (uint24 feePips, uint8 rebatePct, bool veto);
    function afterSwap(PoolKey calldata key, SwapParams calldata params, BalanceDelta delta) external;
}

Fees are in pips: 1,000,000 is 100%. Zero means no opinion. The interface and a template with a fork test are served at /sdk/ILog.sol and /sdk/HookTemplate.sol.

anti-snipe: 25% to 0 over 10 minutesvolatility: 0.05% + 20 pips x average move, max 2%time since open, or average tick move

Volatility fee

An exponential moving average of the absolute tick change between swaps, weight one eighth, sets the fee.

ewma = (7 x ewma + 100 x |tick - lastTick|) / 8 fee = clamp(500 + 20 x ewma / 100, 500, 20,000) pips

Anti-snipe

fee(t) = 250,000 x (600 - t) / 600 pips for t < 600 s after the pool opens, then 0

Time is measured in seconds, because the chain reports its parent chain's block number.

Agent rebate

If the transaction origin holds an identity in the chain's ERC-8004 Identity Registry (0x8004...a432), the composed fee is lowered by 25%.

Weekend gap guard

For a stock token against USDG. The market counts as closed from Friday 23:00 to Monday 01:00 UTC, or whenever the stock's Chainlink feed is older than 12 hours. While closed, the fee is 1%, and a swap that starts more than 2% away from the last feed price and pushes further away is refused. The guard reads the price before the swap, so one swap can still cross the band; the keeper and the next swap bring it back.

Listing

  1. Open a storefront with a name and an X handle.
  2. Deploy your v4 hook and verify its source on Sourcify or Blockscout. Build a v4 hook does both from your wallet.
  3. List it with a royalty from 0 to 10 bps and a gas limit from 10,000 to 80,000.
  4. The house verifier checks the source every hour and flags the hook verified.
  5. Stake 10,000 $V4M behind it. A hook that will hold funds needs 50,000 and an audit note.