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 ↗

Build a v4 hook

No Solidity. Pick what the hook does, set the numbers, and v4 Builder writes the contract, compiles it, runs it on the real PoolManager, and deploys it from your wallet.

Start from
01

Pick what your hook does

Done
02

Set the numbers

Done
Anti-snipe fee

The fee starts at 25% when the pool opens and falls in a straight line to zero over 10 minutes.

Cooldown

A wallet that just swapped in this pool waits 30 seconds before its next swap.

Liquidity lock

Liquidity added to the pool cannot be removed for 30 days after the pool opens.

03

Read the Solidity

Done
FairLaunch.solsolc 0.8.26callbacks 0x1280afterInitializebeforeRemoveLiquiditybeforeSwapdynamic fee pool
  • The fee starts at 25% when the pool opens and falls in a straight line to zero over 10 minutes.
  • A wallet that just swapped in this pool waits 30 seconds before its next swap.
  • Liquidity added to the pool cannot be removed for 30 days after the pool opens.
src/FairLaunch.sol · 121 lines, written from your recipe
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

// FairLaunch: a Uniswap v4 hook, written by v4 Builder (v4builder/2) from the recipe below.
// Callbacks: afterInitialize, beforeRemoveLiquidity, beforeSwap. Its address carries them in its low bits.
// Open its pools with the dynamic fee flag (0x800000). Every swap pays at least 0.3%.
//
// - The fee starts at 25% when the pool opens and falls in a straight line to zero over 10 minutes.
// - A wallet that just swapped in this pool waits 30 seconds before its next swap.
// - Liquidity added to the pool cannot be removed for 30 days after the pool opens.

import {BaseHook} from "@openzeppelin/uniswap-hooks/src/base/BaseHook.sol";
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {Hooks} from "@uniswap/v4-core/src/libraries/Hooks.sol";
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol";
import {SwapParams, ModifyLiquidityParams} from "@uniswap/v4-core/src/types/PoolOperation.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "@uniswap/v4-core/src/types/BeforeSwapDelta.sol";
import {LPFeeLibrary} from "@uniswap/v4-core/src/libraries/LPFeeLibrary.sol";

contract FairLaunch is BaseHook {
    using PoolIdLibrary for PoolKey;
    using LPFeeLibrary for uint24;

    uint24 public constant BASE_FEE = 3000; // 0.3%, the floor of every swap's fee
    uint256 public constant LAUNCH_FEE = 250000; // 25% at the open
    uint256 public constant LAUNCH_WINDOW = 600; // seconds for it to fall to zero
    uint256 public constant COOLDOWN = 30; // seconds between two swaps of one wallet
    uint256 public constant LP_LOCK = 2592000; // 30 days after the open
    uint8 internal constant COOLING_DOWN = 1;

    struct PoolState {
        uint64 openedAt;
    }
04

Prove it on the live chain

Ready

The site compiles your hook, deploys it at a mined address inside a simulation of Robinhood Chain, opens a pool with it on the real PoolManager next to a twin pool with no hook and no fee, and swaps through both at the moments your modules care about.

05

Deploy from your wallet

Waiting

Run the proof first: the deploy sends exactly the code the proof compiled.

06

Open a pool with it

Waiting

Opens once your hook is deployed: pick the pair, the starting price and the amounts, and the pool opens with your hook in one transaction.