Building a v4 hook? Pick what it does, set the numbers, and deploy it as your own hook or stacked on v4 Marketplace. Open the builder ↗
v4 Builder docs
Build a v4 hook from modules

Listing on v4 Marketplace

A stacked hook goes live once it is listed on v4 Marketplace, the sister product where pools stack up to five v4 hooks and every swap pays each of them. The whole listing is done from v4 Builder, from your wallet, right after the deploy.

Four steps

  1. Deploy the hook through the factory as a stacked hook (kind 1). Its constructor takes the hook stack, the Dam at 0xfa80…fAcc ↗, as its only caller.
  2. Open a storefront on the Storefronts contract with a name and an X handle, once per wallet: openStorefront(name, xHandle).
  3. Publish the hook: publishLog with its address, its name, a royalty, a gas limit and its source. v4 Builder fills the gas limit from the proof and the source from the generator.
  4. Stake 10,000 $V4M behind it: stake(logId, amount). The hook is active when isActive(logId) answers true, and from then on pools on v4 Marketplace can stack it.

The calls

Storefronts at 0xd497…dA00 ↗, $V4M at 0xBD1a…1C12 ↗. The stake needs an approval of $V4M to the Storefronts contract first.

Storefronts, the functions a listing uses
// Storefronts
function openStorefront(string name, string xHandle);
function publishLog(
    address impl,
    string name,
    uint16 royaltyBps,   // 0 to 10
    uint32 gasLimit,     // 10,000 to 80,000
    bool wantsAfterSwap, // false for hooks built here
    bool custodial,      // false: a stacked hook never holds funds
    string source
) returns (uint256 logId);
function stake(uint256 logId, uint256 amount);
function isActive(uint256 logId) view returns (bool);
function requiredStake(uint256 logId) view returns (uint256);

Royalty and gas limit

RangeSet by
Royalty0 to 10 bps of each swap that runs the hookYou, when you list
Gas limit10,000 to 80,000 for beforeSwapThe proof: the heaviest answer plus a quarter, rounded up to 1,000
Stake10,000 $V4Mv4 Marketplace, for a hook that holds no funds

The hook stack runs each hook with the gas limit it was listed with. Stock Hours, for example, used at most 17,492 gas in its proof and is listed with 22,000. A tighter limit leaves no room for the cold storage reads of a real swap; a looser one makes the hook dearer for every pool that stacks it.

On v4 Marketplace, a hook that reverts, runs out of its gas or answers badly is skipped and recorded as a failed run, and the swap goes on without it. Failed runs count against the stake on the terms v4 Marketplace publishes in its docs.

Once it is active

Pools created on v4 Marketplace can stack the hook next to up to four others. On every swap through such a pool, the hook stack asks each hook in order, takes the highest fee proposal and the largest rebate, refuses the swap on any veto, and pays each hook its royalty. Royalties, claims and failed runs are v4 Marketplace's, and its docs cover them. The stacked hook page covers what the hook itself answers.