Vol. I · No. 01X Layer Mainnet · Chain 196May 2026

Thehook
primitivepress.

Five production-grade Uniswap V4 hooks on X Layer. Sealed orderflow auctions, bilateral OTC settlement, CDP-style LP tranching, sealed-bid batch auctions, and collateral-backed forward orders — composed into a single registry and exposed through one PoolManager.

Hooks Deployed
05
Pools Registered
05
Interactions
Chain
X-LAYER
196
LIVE
X·HOOKS PROTOCOL
UNISWAP V4 · CANCUN EVM
POOL MANAGER · 0x360E68fa
OFA · BCS · PLT · SUBA · CAL
OKX BUILD-X HACKATHON 2026
SOLIDITY 0.8.26 · VIA-IR
FIVE HOOKS · ONE REGISTRY
LIVE
X·HOOKS PROTOCOL
UNISWAP V4 · CANCUN EVM
POOL MANAGER · 0x360E68fa
OFA · BCS · PLT · SUBA · CAL
OKX BUILD-X HACKATHON 2026
SOLIDITY 0.8.26 · VIA-IR
FIVE HOOKS · ONE REGISTRY
Figure 01

Anatomy of a
v4 swap.

Every swap on Uniswap V4 passes through a deterministic six-phase pipeline. Each X Hook intercepts the pipeline at a specific phase — never modifying the core, only composing on top. The diagram below maps where each hook takes control of the execution flow.

UserRouterbeforeSwapCore AMMafterSwapSettle / TakeI. OFA · ExecutionII. BCS · SettlementIII. PLT · LiquidityIV. SUBA · ExecutionV. CAL · Forward MarketSingle-transaction execution
Sealed intercept — execution paused, hook in control.
Atomic — settlement reverts on any failed leg.
Fallback — AMM continues if the hook abstains.
Index

The five
primitives.

Each hook is a self-contained smart contract with a deterministic permission mask, deployed via Create2 against the v4 PoolManager. Five primitives, three execution categories. Read the technical sheet for each.

Field guide

Every hook,
explained.

Each primitive solves a specific class of problem on a generic AMM — MEV leakage, missing OTC rails, undifferentiated LP risk, fair price discovery, native limit orders. Below is the long form for each one: what it does, why it matters, where you would actually use it.

I. Execution

OFA.

Orderflow auction with sealed solver competition.

Read the sheet
Why it matters

On a standard AMM, large swaps move the curve and bots front-run, back-run, or sandwich them — value that should belong to the trader silently leaks to MEV. OFA flips the model: instead of letting bots extract, the hook seals the swap and invites them to compete for the right to fill it. Whoever offers the user the best price wins. If nobody bids, the AMM still executes as a safe fallback. The user always gets at least the AMM price — and usually better.

How it works
  1. 01Swaps above the configured threshold pause execution and open a sealed solver auction in the same transaction.
  2. 02Solvers bid for N consecutive blocks; the winning bid fills the trade at an improved price relative to the AMM curve.
  3. 03If no solver responds within the window, the trade falls back to the regular AMM execution path with no penalty.
  4. 04Pending orderflow is held as ERC-6909 claims for the duration of the auction — there is no early withdrawal.
Use cases
  • Whale-sized swaps where slippage from naive AMM execution would leak value to MEV bots.
  • DAO treasury rebalancing — opens a competitive solver auction for the best execution price.
  • Aggregator routers offering institutional-grade execution without running their own RFQ infrastructure.
  • Any swap above a configurable size threshold that should receive price improvement instead of raw AMM fills.
V4 callbacks wired
beforeSwapbeforeSwapReturnDelta
II. Settlement

BCS.

Bilateral commitment settlement on a trigger price.

Read the sheet
Why it matters

OTC trades have always required a trusted intermediary — an escrow contract, a multisig, a centralized desk. BCS removes them all. Two parties register their commitment on-chain; the hook watches every swap and settles the deal the moment the pool's spot price crosses the agreed trigger. Atomic, trustless, no governance. Collateral never leaves the two participants' control until the trigger is hit, and then it settles in the same transaction as the swap that crossed it.

How it works
  1. 01Two counterparties register a bilateral commitment containing a trigger sqrtPrice and the size of each leg.
  2. 02On every swap the hook reads live price via StateLibrary.getSlot0 against the pool's current state.
  3. 03When spot crosses the trigger, the commitment settles atomically in a single transaction.
  4. 04Collateral transfers via ERC-20 safeTransfer — no intermediary custody, no escrow contract.
Use cases
  • Market-makers and counterparties agreeing on a future exchange price without involving an off-chain escrow.
  • Treasury swaps that should only execute when the pool reaches a strategic threshold.
  • OTC desks settling bilateral trades trustlessly inside DEX infrastructure they already use.
  • Structured products that need price-conditional settlement primitives without governance.
V4 callbacks wired
beforeSwap
III. Liquidity

PLT.

Programmable liquidity tranching with structured fee waterfall.

Read the sheet
Why it matters

Traditional Uniswap LPs all share the same risk and the same fee stream — there is no way to express preference for safety vs yield within a single pool. PLT borrows the CDO/tranche pattern from structured finance: senior LPs get fee priority and absorb impermanent loss last; junior LPs get the residual fees but eat IL first. Same pool, same range, two different risk shapes. It's the first on-chain primitive for tiered LP exposure that doesn't require a separate vault, oracle, or off-chain accounting.

How it works
  1. 01LPs choose SENIOR (fee-priority, impermanent-loss last) or JUNIOR (higher risk, fee residual) on deposit.
  2. 02After each swap, 70% of fees flow to the senior tranche, 30% to junior — a fixed structured waterfall.
  3. 03Senior bears impermanent loss last; junior absorbs IL first, replicating CDO subordination on-chain.
  4. 04hookData = abi.encode(lpAddress, tranche) must be passed on every deposit to bind the position.
Use cases
  • Risk-tiered LP products where conservative capital takes the senior fee waterfall and yield-seekers take junior subordination.
  • Institutional LPs needing a defined risk profile — senior tranche behaves like a fixed-priority fee claim.
  • Yield-bearing primitives built on top of a single pool, exposing two different return/risk shapes to two different audiences.
  • Vaults and yield aggregators looking for capital-efficient ways to split exposure across the same liquidity range.
V4 callbacks wired
afterInitializebeforeAddLiquiditybeforeRemoveLiquidityafterSwap
IV. Execution

SUBA.

Sealed-bid uniform-price batch auction over N blocks.

Read the sheet
Why it matters

On a continuous AMM, position in the block determines price. Bots that pay for priority lanes win, and retail loses every time. SUBA imposes a simple rule: every order in the same epoch settles at the same price. There is no position-within-block to compete for. The model is the Frequent Batch Auction proposed by Budish, Cramton, and Shim — long argued to be the optimal market microstructure for fair execution. SUBA brings it to AMMs without an off-chain matching engine.

How it works
  1. 01All swaps during an epoch are intercepted at beforeSwap and held as ERC-6909 claims against the manager.
  2. 02At epoch end, the designated keeper calls settleEpoch() supplying a uniform clearing price.
  3. 03Every order in the epoch executes at the same price — no front-running, no positional MEV.
  4. 04Users may withdraw unbuffered positions if an epoch expires without a settlement transaction.
Use cases
  • Token-launch pools where uniform pricing prevents sniping the first block.
  • Memecoin and high-volatility pairs where positional MEV would dominate retail flow.
  • DAO protocol-owned-liquidity venues that want fair, oracle-free price discovery on every epoch.
  • Periodic rebalancing of indices and treasury baskets — every basket member trades at the same clearing price.
V4 callbacks wired
afterInitializebeforeSwapbeforeSwapReturnDelta
V. Forward Market

CAL.

Commitments-as-liquidity — collateralized limit orders.

Read the sheet
Why it matters

DEX users have asked for native limit orders since the first AMM shipped — and every previous attempt depended on off-chain keepers that introduced trust, latency, and liveness risk. CAL turns the swap itself into the trigger. Collateral lives in the hook, the trigger price is public, and any swap that crosses the trigger auto-executes the commitment atomically inside the same transaction. No keeper, no oracle, no governance. Just collateral plus a price.

How it works
  1. 01Users lock ERC-20 collateral with a directional trigger price (BUY or SELL) and an expiry block.
  2. 02On each swap the hook checks whether the current sqrtPrice crossed the trigger in the user's favor.
  3. 03When triggered, collateral executes atomically against the pool via the sync / settle / take pattern.
  4. 04Expired commitments are auto-refunded; owners may cancel any active commitment at any time.
Use cases
  • On-chain limit orders that don't depend on a keeper network or a centralized orderbook.
  • Stop-loss and take-profit primitives for vaults, treasuries, and structured products.
  • Conditional treasury management — auto-buy a basis below a threshold, auto-sell above another.
  • Delegated execution for managed accounts: collateral is locked, triggers are public, anyone can fulfil.
V4 callbacks wired
beforeSwapbeforeSwapReturnDelta
About

More about
the protocol.

X·Hooks Protocol is a catalogue of five production-grade Uniswap V4 hooks deployed on X Layer Mainnet (chain 196). Each hook addresses a specific shortcoming of a vanilla AMM — MEV extraction, missing OTC infrastructure, undifferentiated LP risk, sniping-prone launches, and the absence of native limit orders — and resolves it without modifying the core protocol.

Built from scratch for the OKX Build-X hackathon. No upgradability, no admin keys, no governance. Every hook is deployed via Create2 so its permission mask is encoded in the address itself, and every contract is registered in a single on-chain HookRegistry so the catalogue is discoverable, byte-verifiable, and queryable from a single read.

The frontend is a wagmi/Next.js dashboard that pins all reads to X Layer's public RPC, so the displayed state is always the real chain state — not a cached snapshot. Anyone can clone the repo, deploy the contracts to any EVM that supports Uniswap V4, and stand up an identical interface.

Network
X Layer Mainnet
Chain ID 196
Hooks shipped
05
One registry · five primitives
License
MIT
Open source on GitHub
Compiler
0.8.26
cancun · via_ir · 200 runs
Built for
OKX Build-X
Hackathon 2026
Status
Mainnet live
Verifiable on OKLink
F·A·Q

Common
questions.

Quick answers about how the protocol works, where it runs, and how to use it.

01
What is X·Hooks Protocol?
A catalogue of five production-grade Uniswap V4 hooks deployed on X Layer Mainnet. Each hook is a specialised smart contract that intercepts a stage of the V4 swap pipeline to add functionality the bare AMM lacks — sealed auctions, OTC settlement, LP tranching, batch auctions, and on-chain limit orders.
02
Which network is the protocol live on?
X Layer Mainnet (chain ID 196). The canonical PoolManager is 0x360E…FB32, and the HookRegistry is 0xeBc9…D56D. Both are queryable on OKLink.
03
Do I need to use a special router?
No. Hooks attach to standard V4 pools, so any wallet or aggregator that swaps through the canonical PoolManager interacts with them automatically. Some hooks (PLT, CAL, BCS) accept extra parameters via hookData for richer behaviour, but the basic swap path is the same.
04
Are the contracts upgradeable?
No. Every hook is non-upgradeable, has no admin, and has no governance. The only privileged role is the SUBA epoch keeper, which is per-pool and only allowed to call settleEpoch — it cannot freeze, drain, or alter user funds.
05
How do I verify a hook is what it claims to be?
Each hook is deployed via Create2 so its permission mask is encoded in its address bits. Read the address, and you can verify which V4 callbacks the contract is allowed to fire. The HookRegistry pins the name, type, version, and deployer of each contract on-chain.
06
Where can I see live activity?
The /dashboard page reads directly from the HookRegistry and PoolManager every 30 seconds. It shows pool counts, interaction counts, and the current block — all real chain state, no caching.
07
What was the protocol built for?
X·Hooks Protocol was built from scratch for the OKX Build-X hackathon (2026). The goal was a single coherent suite of hooks demonstrating that V4 can host primitives previously thought to require off-chain infrastructure — MEV-resistant auctions, structured liquidity, native limit orders — while keeping the same trustless guarantees as a vanilla AMM.
08
Is the code open source?
Yes. The full repository — contracts, deployment scripts, frontend — is published under MIT on GitHub. Follow @XHooks_protocol for release notes and protocol updates.
Colophon

Built like
infrastructure.

01

Single registry, five hooks

The HookRegistry is an append-only on-chain catalogue. Every hook is registered with name, type, version, and deployer — and queryable from a single contract address.

02

Permissions baked into the address

Each hook contract is mined via Create2 so its address encodes its permission mask. Anyone can verify which v4 callbacks a hook can fire just by reading its address bits.

03

ERC-6909 claims, sync / settle / take

Intercepts hold value as ERC-6909 claims against the PoolManager and resolve via the canonical sync → settle → take pattern — no intermediary custody, no escrow.

04

Solidity 0.8.26 · via_ir

Compiled with via_ir and 200-run optimizer on the cancun EVM target. Deterministic builds, ABI-stable across redeploys.

05

Sourcemaps for OKLink

Each contract ships a flattened source file ready for OKLink verification. Verifiable from the registry, byte-for-byte.

06

No multisig, no admin

The hooks themselves are non-upgradeable. Hook-specific keepers (SUBA epoch settlement) are role-scoped per pool, not global.

Open the terminal

Live data,
verified addresses,
zero handwaving.

Registry0xeBc902Cee74345DD23f63E2f132f81E5fBE1D56D
Enter dashboard