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.
Pick what your hook does
Set the numbers
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.
Read the Solidity
- 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.
// 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; }
Prove it on the live chain
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.
Deploy from your wallet
Run the proof first: the deploy sends exactly the code the proof compiled.
Open a pool with it
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.