C0LLBACK
#SIMULATORJUIL 2025LIVE

HOOK SIMULATOR

Paste your Uniswap v4 hook, configure a swap scenario, and see what happens — the verdict, the hook execution, the state diff, the gas. It runs entirely in your browser. No Foundry, no testnet, no deployment.

Open the live simulator

The story

Building a v4 hook means living inside a slow loop: write the hook, forge build, write a whole Foundry test (PoolManager setup, mock tokens, pool init, liquidity…), forge test, read the terminal, fix, repeat. Just to call beforeSwap once.

Every iteration costs at least 30 seconds of ceremony. So most people don't test their hooks thoroughly before shipping — not because they don't want to, but because the tooling makes it painful.

Hook Simulator cuts the loop. Paste the code, configure a scenario, see the result in seconds — the revert reason, where in the call stack it happened, the full state diff, the gas. The first useful simulation takes under a minute from opening the site.

What it does

Editor
A Solidity editor with syntax highlighting and live parsing — it reads your getHookPermissions() and constructor args as you type.
Scenario
A visual form for the pool (tokens, fee tier, price, liquidity) and the swap (direction, amount, slippage) — plus one-click predefined scenarios.
Result
Status, the revert reason and where it happened, hook execution trace, swap output, price impact, gas, and a full before/after state diff.
Call trace
The whole execution stack — PoolManager.swap → your beforeSwap → _swap → settle — with gas per frame.
Compare
Run the same hook against two amounts side by side to see where behaviour diverges.
Shareable
Every simulation encodes its code + scenario into the URL — paste it in a PR or Discord and the recipient opens the exact same setup.

How it works — honestly

Everything runs in your browser. Hook Simulator parses your hook's getHookPermissions() and any guard requires, then models the swap with a constant-product approximation — estimating the verdict (success / revert), amount out, price impact, gas and the call trace. No compiler, no node, no wallet: the first useful result is instant.

It's an estimator, and it says so. It doesn't execute your Solidity, so custom fee logic, BeforeSwapDelta, state reads and oracles aren't run, and v4's concentrated liquidity is approximated as constant-product. It's built to reason about a hook's control flow, permissions and guards in seconds — not to replace a Foundry test when you need exact onchain numbers.

Next.jsSolidity editorLive permission parsingIn-browser swap modelShareable URLs

Companion to HOOKED and HOOK INSPECTOR — the kit builds hooks, the inspector reads them, the simulator runs a swap against them.

← Back to index© 2025 C0LLBACK — ONCHAIN