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

Creating a pool

A v4 Marketplace pool is a new v4 pool created with the hook stack as its hook and up to five v4 hooks in it. It takes one transaction.

The pool key

FieldValue
currency0, currency1The pair, sorted by address
fee0x800000, the dynamic fee flag: the hook stack sets the fee on every swap
tickSpacing60 in the app, any value in the SDK
hooksThe hook stack
// the hook stack contract is named Dam on chain
dam.createDam(key, sqrtPriceX96, baseFeePips, hookIds, configs)

Stack rules

  • Up to five v4 hooks, no duplicates, every one active.
  • Stack royalty at most 30 bps; each hook keeps the royalty it had when it was stacked.
  • Stack gas at most 400,000: each hook's limit, plus 40,000 for a hook that also runs after the swap. Routers can read it from pools(id).gas.

How hooks compose

fee = max(baseFee, every proposal) x (100 - max rebate) / 100 any veto refuses the swap a failed call is skipped and recorded as a failed run

If a caller sends too little gas for a hook to run with its full limit, the hook stack refuses the swap rather than record a failed run, so nobody can make an honest hook fail by starving it.

Changing a stack

The pool owner proposes a new stack; it can be applied by anyone 48 hours later. LPs see it on Live swaps and in the hook stack's StackProposed event, and can leave first.