Anti-snipe fee
The fee starts at 25% when the pool opens and falls in a straight line to zero over 10 minutes.
Pick the modules and set the numbers. v4 Builder writes the Solidity, proves it on the live PoolManager and deploys it from your wallet.
A v4 hook decides what each swap in its pool pays and who may swap at all. Writing one has meant Solidity, a mined address and a fork test. v4 Builder brings it down to four steps: pick, set, prove, deploy.
Open the builderTen modules, each one a rule the builder knows how to write: anti-snipe fee, volatility fee, off-hours fee, cooldown, price guard, launch allowlist, holder rebate, AI agent rebate, swap tax and liquidity lock. Take one, or combine several in the same v4 hook.
Read the modules ↗Each module takes a few numbers inside checked bounds: fees in pips, windows in seconds, cuts in basis points. Every choice reads back as one plain sentence, and the same recipe always writes the same Solidity.
Read about recipes ↗The source compiles with solc 0.8.26 and runs on the live chain in one eth_simulateV1 request: your hook at a mined address, a pool opened with it next to a twin pool with no hook and no fee, the same swaps through both.
Read the proof ↗The v4 Builder factory puts the code at its CREATE2 address with a salt bound to your wallet, checks the callbacks against the address bits and writes the recipe on chain. Then open a pool with it, or list it on v4 Marketplace.
Read about deploying ↗The fee starts at 25% when the pool opens and falls in a straight line to zero over 10 minutes.
The fee follows the average price move between swaps: 0.05% when calm, plus 0.2% for each 1% the price moves on average, up to 2%.
From 20:00 to 14:30 UTC on weekdays and all weekend, when the stock market is closed, the fee is 1%.
A wallet that just swapped in this pool waits 30 seconds before its next swap.
Once the price has moved more than 10% within 5 minutes, swaps that push it further are refused until the window rolls over. Swaps that bring it back go through.
For the first 15 minutes, only wallets you list can swap. You can add more from your wallet after the deploy.
A wallet holding at least the minimum of the token at an address pays 25% less fee.
A wallet that holds an AI agent identity in the chain's ERC-8004 registry pays 25% less fee.
0.3% of every swap's output (or input, on exact-output swaps) is sent to an address.
Liquidity added to the pool cannot be removed for 30 days after the pool opens.
An OpenZeppelin BaseHook contract. Its CREATE2 address is mined so the low 14 bits carry exactly the callbacks it uses, then you open a pool with it and every swap in that pool runs it. A hook that sets fees opens its pools with the dynamic fee flag.
afterInitialize, beforeRemoveLiquidity, beforeSwap: the callbacks its modules need, nothing more.
Swap tax and liquidity lock, in orange, run only on a hook of its own: a stacked hook never moves funds.
A contract that implements ILog. The v4 Marketplace hook stack calls it on every swap of the pools that stack it, and it answers with a fee in pips, a rebate and a veto. It never holds funds, and it shares the pool with up to four other hooks.
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;
}Listed from v4 Builder with a royalty of 0 to 10 bps per swap and a gas limit of 10,000 to 80,000, and active once 10,000 $V4M are staked behind it.
The hook is deployed inside the simulation at a mined address. A pool is opened with it next to a twin pool with no hook and no fee, and the same small swap goes through both at each moment the recipe cares about. Paid is what the swapper lost against the twin.
| Moment | Swap | Paid |
|---|---|---|
| At the open Small swap | Small swap | 24.98% |
| 31 seconds after the open Small swap | Small swap | 23.69% |
| 5 minutes after the open Small swap | Small swap | 12.49% |
| 10 minutes after the open Small swap | Small swap | 0.30% |
| Within the 30-second cooldown 2nd, 3rd and 4th swap of the same wallet | 2nd, 3rd and 4th swap of the same wallet | Refused: cooling down |
| At the end Liquidity exit | Liquidity exit | Refused: locked until 2026-11-26 |
| Moment | Swap | Proposal |
|---|---|---|
| A weekday, market open Fee proposal on TSLA / USDG | Fee proposal on TSLA / USDG | 0.05% |
| Saturday, market closed Fee proposal on TSLA / USDG | Fee proposal on TSLA / USDG | 1.00% |
At most 17,492 gas per answer, listed with a 22,000 gas limit.
| Moment | Swap | Paid in total |
|---|---|---|
| Any time A plain wallet | A plain wallet | 0.50% |
| Any time A wallet holding an ERC-8004 agent identity | A wallet holding an ERC-8004 agent identity | 0.35% |
Fee and swap tax together, against a twin pool with no hook and no fee.
Start from Fair Launch, Stock Hours or Agent Lane, or from a single module. Pick, set the numbers, read the proof, then deploy it from your wallet.
Build a v4 hook