UniHooks

How to create a Uniswap v4 hook (with or without code)

11 November 2026

There are two ways to create a Uniswap v4 hook. If you want a pool with rules like a tax, anti-snipe or a liquidity lock, you don't need to code at all. If you want behaviour nobody has built yet, you write the hook yourself. Here is how both work.

Option 1: no code (a few minutes)

  1. Open Create and pick a chain.
  2. Choose your rules from 15 ready-made ones and set the numbers.
  3. Paste your token, pick a pair (ETH or a stablecoin) and a starting price.
  4. Sign one transaction. Your pool goes live with the hook attached.

More detail in our Uniswap hook builder guide.

Option 2: write it in Solidity

  1. Set up the project. Most developers use Foundry with OpenZeppelin's uniswap-hooks library, which gives you a tested BaseHook to build on.
  2. Choose your permissions. In getHookPermissions(), switch on only the moments you need, for example beforeSwap to change fees or afterSwap to take a cut. Fewer permissions means less risk and an easier review.
  3. Write the logic. Implement the matching functions, such as _beforeSwap or _afterSwap. Taking tokens from a trade needs the "return delta" permissions as well.
  4. Test against real Uniswap code. Deploy the v4 PoolManager in your tests and run real swaps and liquidity changes through your hook, including edge cases like tiny and huge trades.
  5. Mine the address. Uniswap reads a hook's permissions from the last bits of its address, so the hook must be deployed with CREATE2 and a salt that gives the right address. See how to deploy a Uniswap v4 hook.
  6. Deploy, verify and create a pool. Publish the source on the block explorer so others can read it, then initialize a pool with your hook in the pool key.

Which should you pick?

Before you launch

Whoever made it, traders will check what your hook can do. See what the hook safety report looks at, so your hook passes.

Try it on your own token. Pick the rules, sign one transaction, no code.Create a hook

More guides