Hook Simulator

Simulate any swap.

Pickahook,enteranamount,andwatchtheV4executionpipelineanimatestep-by-stepnowallet,nogas,norealtransaction.

01

Select a hook

Each hook intercepts the swap pipeline differently

02

Configure swap

Set amount and direction — pool reserves are 10,000 XHKB / 10,000 XHKA

XHKB
pendingXHKA

Auction triggered (≥ 50 XHKB) — solver-filled, price ≥ AMM

Fee: 0.30%Pool liquidity: 10,000 / 10,000tickSpacing: 60
05

How to use these hooks

Real-world integration — how a user, router, or contract actually calls a V4 pool with a hook attached

These hook contracts are permissionless infrastructure — anyone can attach them to their own pool. On Uniswap's web app, the New position screen has an Enter hook addressfield. Paste one of our contract addresses there and the pool is initialized with the hook baked in. Every swap in that pool then runs the hook's logic automatically — swappers need nothing extra.

Add a hook to your pool

Pool creator · UI

On the Uniswap web app, creating a hooked pool takes one extra field. No code, no deployment — just paste the hook address and the pool is live.

  1. 01Go to app.uniswap.org → Pool → New position
  2. 02Select v4 position from the top-right toggle
  3. 03Choose your token pair and fee tier
  4. 04Paste one of our contract addresses into the Enter hook address field
  5. 05Continue — every swap in this pool now runs the hook automatically

Swap in a hooked pool

Solidity / contract

Swapping is identical to any V4 pool — hooks fire automatically from the PoolKey, nothing extra is needed at swap time. Implement IUnlockCallback, call manager.unlock(), then manager.swap() inside the callback.

contract MySwapper is IUnlockCallback {
  IPoolManager immutable manager;

  function swap(PoolKey calldata key) external {
    manager.unlock(abi.encode(key));
  }

  function unlockCallback(bytes calldata data)
      external returns (bytes memory) {
    PoolKey memory key = abi.decode(data, (PoolKey));
    // hook.beforeSwap fires automatically ↓
    BalanceDelta delta = manager.swap(
      key,
      IPoolManager.SwapParams({
        zeroForOne:        true,
        amountSpecified:   -100e18,
        sqrtPriceLimitX96: MIN_SQRT_RATIO + 1
      }),
      "" // hookData — empty for basic swaps
    );
    // hook.afterSwap fires automatically ↑
    // settle / take delta ...
  }
}

PLT — pick your tranche on deposit

LP

Senior LPs (fee priority, IL absorbed last) and Junior LPs (residual fees, IL first) live in the same pool. The tranche is encoded in hookData on every modifyLiquidity call — no separate vault, no oracle.

bytes memory hookData = abi.encode(
  msg.sender,
  PLTHook.Tranche.SENIOR  // or JUNIOR
);
posManager.modifyLiquidities(
  abi.encode(params, hookData),
  deadline
);

CAL — post an on-chain limit order

Trader

Lock collateral with a directional trigger and an expiry block. The hook executes your order atomically inside the next swap that crosses the trigger — no keeper, no off-chain orderbook, anyone can ride the trigger.

calHook.submitCommitment(
  poolKey,
  CALHook.Direction.BUY,
  triggerSqrtPriceX96,
  expiryBlock,
  collateralAmount
);

BCS — bilateral OTC commitment

Two counterparties

Two parties register a commitment at a trigger price. The hook watches every swap; the first one that crosses the trigger settles both legs atomically against ERC-20 safeTransfer — no escrow contract, no governance.

bcsHook.submitCommitment(
  poolKey,
  counterparty,
  triggerSqrtPriceX96,
  token0Amount,
  token1Amount
);

SUBA — wait for the epoch clearing

Wallet user / keeper

Orders submitted to SUBA are buffered until the keeper calls settleEpoch, which runs a uniform-price batch auction. Traders get a fair clearing price; keepers earn a gas incentive. Front-running is structurally impossible.

subaHook.submitOrder(
  poolKey,
  amountIn,
  minAmountOut,
  deadline
);

// keeper — called once per epoch
subaHook.settleEpoch(poolKey);