Developers
Quickstart
- Point a client at ElysiumRPC
https://rpc.elysium.kinetiq.xyz, chain id 99901, gas in HYPE. Explorer: elysium.kinetiq.xyz. - Read the feeCall
OmniPegHook.quote(key, zeroForOne)with the flagship pool key below. It returns the fee in pips and whether the swap takes the gap. - Or skip the chainThe same reads come back as JSON from /api/v1/pools, or as tools from the MCP server at
/mcp.
viem
Reads the reference from RateBook and the fee on both sides of the flagship pool. Run it with node read-fee.mjs after npm i viem.
// node read-fee.mjs (npm i viem)
import { createPublicClient, http, defineChain, parseAbi } from "viem";
const elysium = defineChain({
id: 99901,
name: "Elysium",
nativeCurrency: { name: "HYPE", symbol: "HYPE", decimals: 18 },
rpcUrls: { default: { http: ["https://rpc.elysium.kinetiq.xyz"] } },
});
const client = createPublicClient({ chain: elysium, transport: http() });
const PEG_HOOK = "0x0000000000000000000000000000000000000000";
const RATE_BOOK = "0x0000000000000000000000000000000000000000";
const flagship = {
currency0: "0x248888D396A546A69A188f3Deb476964e581E9d0", // kHYPE
currency1: "0xbA876237B0F021A6c6D852d6c26E107997cC5E81", // WHYPE
fee: 0x800000, // dynamic fee flag
tickSpacing: 1,
hooks: PEG_HOOK,
};
const abi = parseAbi([
"struct PoolKey { address currency0; address currency1; uint24 fee; int24 tickSpacing; address hooks; }",
"struct Quote { uint24 fee; uint24 protocolFee; uint256 poolPriceWad; uint256 refWad; uint256 gapPips; bool fresh; bool takesGap; }",
"function quote(PoolKey key, bool zeroForOne) view returns (Quote)",
"function referenceOf(bytes32 feed) view returns (uint256 priceWad, uint256 updatedAt, bool fresh)",
"function FEED_KHYPE() view returns (bytes32)",
]);
const feed = await client.readContract({ address: RATE_BOOK, abi, functionName: "FEED_KHYPE" });
const [refWad, updatedAt, fresh] = await client.readContract({ address: RATE_BOOK, abi, functionName: "referenceOf", args: [feed] });
const sell = await client.readContract({ address: PEG_HOOK, abi, functionName: "quote", args: [flagship, true] });
const buy = await client.readContract({ address: PEG_HOOK, abi, functionName: "quote", args: [flagship, false] });
console.log("reference", Number(refWad) / 1e18, fresh ? "fresh" : "stale", "updated", new Date(Number(updatedAt) * 1000).toISOString());
console.log("sell kHYPE pays", sell.fee, "pips", sell.takesGap ? "(gap fee)" : "(base)");
console.log("buy kHYPE pays", buy.fee, "pips", buy.takesGap ? "(gap fee)" : "(base)");Solidity
Interfaces for OmniPegHook, RateBook and OmniPegRouter, and a reader contract that prices the flagship pool on chain. Compiles with solc 0.8.24 or later.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// Uniswap v4 pool key (Currency and IHooks are plain addresses in the ABI).
struct PoolKey {
address currency0;
address currency1;
uint24 fee;
int24 tickSpacing;
address hooks;
}
interface IPegHook {
struct Quote {
uint24 fee; // total fee, pips (1e-6)
uint24 protocolFee; // protocol part of the fee, pips
uint256 poolPriceWad; // HYPE per kHYPE, 1e18
uint256 refWad; // reference, 1e18
uint256 gapPips; // |pool - ref| / ref, pips
bool fresh; // reference within RateBook's maxAge
bool takesGap; // this side moves the pool away from the reference
}
/// The fee a swap on `key` in direction `zeroForOne` pays right now.
function quote(PoolKey calldata key, bool zeroForOne) external view returns (Quote memory);
/// The fee at any pool price and reference, for what-if pricing.
function quoteAt(bytes32 id, uint160 sqrtPriceX96, uint256 refWad, bool zeroForOne) external view returns (Quote memory);
}
interface IRateBook {
function FEED_KHYPE() external view returns (bytes32);
function latest() external view returns (uint256 rate, uint256 l1Block, uint256 time);
function referenceOf(bytes32 feed) external view returns (uint256 priceWad, uint256 updatedAt, bool fresh);
}
interface IPegRouter {
/// zeroForOne = sell kHYPE. Pay HYPE as msg.value to buy; unwrapOut = receive native HYPE.
function swap(bool zeroForOne, uint256 amountIn, uint256 minOut, uint256 maxMoveBps, bool unwrapOut, uint256 deadline)
external
payable
returns (uint256 amountOut);
}
/// Reads the flagship kHYPE/WHYPE pool on Elysium (chain 99901).
contract PegFeeReader {
IPegHook public constant HOOK = IPegHook(0x0000000000000000000000000000000000000000);
IRateBook public constant BOOK = IRateBook(0x06eFAe8fc540D2e0d383Cc7408ccEa797f8B9A6C);
address public constant KHYPE = 0x248888D396A546A69A188f3Deb476964e581E9d0;
address public constant WHYPE = 0xbA876237B0F021A6c6D852d6c26E107997cC5E81;
function flagship() public pure returns (PoolKey memory) {
return PoolKey(KHYPE, WHYPE, 0x800000, 1, address(HOOK));
}
/// Fee in pips for selling (true) or buying (false) kHYPE now, and whether it is the gap fee.
function feeNow(bool sellKHYPE) external view returns (uint24 fee, bool gapFee) {
IPegHook.Quote memory q = HOOK.quote(flagship(), sellKHYPE);
return (q.fee, q.takesGap);
}
/// Kinetiq's rate less the queue band, as RateBook serves it to the hook.
function referencePrice() external view returns (uint256 priceWad, bool fresh) {
(priceWad,, fresh) = BOOK.referenceOf(BOOK.FEED_KHYPE());
}
}cast
# Fee OmniPegHook charges now for selling kHYPE (true) on the flagship pool
cast call 0x0000000000000000000000000000000000000000 \
"quote((address,address,uint24,int24,address),bool)((uint24,uint24,uint256,uint256,uint256,bool,bool))" \
"(0x248888D396A546A69A188f3Deb476964e581E9d0,0xbA876237B0F021A6c6D852d6c26E107997cC5E81,8388608,1,0x0000000000000000000000000000000000000000)" true \
--rpc-url https://rpc.elysium.kinetiq.xyz
# Kinetiq's rate as RateBook holds it: (rate, HyperEVM block, time)
cast call 0x06eFAe8fc540D2e0d383Cc7408ccEa797f8B9A6C "latest()(uint256,uint256,uint256)" --rpc-url https://rpc.elysium.kinetiq.xyzQuote API
An exact-input quote in the shape aggregators already read: tokenIn, tokenOut, amount in base units, an optional from and slippageBps. The answer carries amountOut, minAmountOut, the route with its v4 pool key and hook, the OmniPegRouter transaction ready to sign, the approval it needs, and the fee split into base fee and gap fee. Every number comes from Uniswap's V4Quoter and OmniPegHook by eth_call on Elysium.
# 0.001 native HYPE -> kHYPE on Elysium: amounts in base units, 0x0 for native HYPE
curl -s "https://omnipeg.space/api/v1/quote?tokenIn=0x0000000000000000000000000000000000000000&tokenOut=0x248888D396A546A69A188f3Deb476964e581E9d0&amount=1000000000000000&slippageBps=50"
# Symbols work too; add from= to simulate the transaction from that address
curl -s "https://omnipeg.space/api/v1/quote?tokenIn=kHYPE&tokenOut=USDC&amount=100000000000000&from=0xYourAddress"{
"chainId": 99901,
"tokenIn": { "address": "0x0000000000000000000000000000000000000000", "symbol": "HYPE", "decimals": 18, "native": true },
"tokenOut": { "address": "0x248888D396A546A69A188f3Deb476964e581E9d0", "symbol": "kHYPE", "decimals": 18, "native": false },
"amountIn": "1000000000000000",
"amountOut": "969388395857410",
"minAmountOut": "964541453878122",
"route": [{ "protocol": "omnipeg", "type": "uniswap-v4-hook", "pool": "khype-hype",
"poolId": "0x0000…0000", "hook": "0x0000…0000", "zeroForOne": false, "portionBps": 10000, "fee": 100 }],
"tx": { "to": "0x0000…0000", "data": "0xdc614acd…", "value": "1000000000000000", "chainId": 99901 },
"approval": null,
"fees": { "unit": "pips (1e-6 of the input)", "total": 100, "baseFee": 100, "gapFee": 0,
"protocolFee": 20, "lpFee": 80, "takesGap": false, "gapPips": 0, "referenceFresh": true },
"prices": { "pool": 1.0281, "reference": 1.0279, "unit": "HYPE per kHYPE" },
"deadline": 1795888800
}// Quote, approve if needed, then send the OmniPegRouter call the API returns (viem, any EIP-1193 wallet)
import { createWalletClient, custom, erc20Abi } from "viem";
const q = await fetch("https://omnipeg.space/api/v1/quote?tokenIn=kHYPE&tokenOut=HYPE&amount=1000000000000000").then((r) => r.json());
const wallet = createWalletClient({ transport: custom(window.ethereum) });
const [account] = await wallet.requestAddresses();
const chain = { id: 99901, name: "Elysium", nativeCurrency: { name: "HYPE", symbol: "HYPE", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.elysium.kinetiq.xyz"] } } };
if (q.approval) {
await wallet.writeContract({ account, chain, address: q.approval.token, abi: erc20Abi, functionName: "approve", args: [q.approval.spender, BigInt(q.approval.amount)] });
}
const hash = await wallet.sendTransaction({ account, chain, to: q.tx.to, data: q.tx.data, value: BigInt(q.tx.value) });
console.log(q.amountOutFormatted, q.tokenOut.symbol, "fee", q.fees.total, "pips, gap part", q.fees.gapFee, hash);OmniPegRouter fills inside a 1% price bound and refunds any input it cannot fill. Native HYPE goes in as value; tokens need the approval in approval first.
Read API
JSON over HTTPS, no key, CORS open to every origin. Responses are cached at the edge for a few seconds and one chain read serves every caller in that window.
GET /api/v1/liveEverything the site reads in one call: rate, reference, prices, fees from the hook, depth.GET /api/v1/rateKinetiq's kHYPE rate on HyperEVM and the copy RateBook holds on Elysium, with its age.GET /api/v1/poolsEvery pool with its key, router, reference contract, live prices, gap, both fees from the hook, and the house position's live depth.GET /api/v1/quote?pool=hype-usdc&in=HYPE&amount=0.0003A swap quote on any pool (khype-hype, hype-usdc, khype-usdc, peg-hype) through Uniswap's V4Quoter by eth_call, the hook's fee included, with the pool's live fee and the largest size inside OmniPegRouter's 1% bound.GET /api/v1/quote?price=1.029&ref=1.0278&side=sellOmniPegHook.quoteAt by eth_call: the fee the deployed hook charges at a pool price and reference. side is sell (kHYPE in) or buy. ref defaults to the live reference.GET /api/v1/quote?tokenIn=0x0000000000000000000000000000000000000000&tokenOut=0x248888D396A546A69A188f3Deb476964e581E9d0&amount=1000000000000000Aggregator quote: tokenIn and tokenOut as addresses (0x0 or 0xEeee for native HYPE) or symbols, amount in base units, optional from and slippageBps. Returns amountOut, minAmountOut, the route, OmniPegRouter calldata ready to sign, the approval needed, and the fee split into base fee and gap fee.GET /api/v1/route?from=HYPE&to=kHYPE&amount=1000000000000000Best route over OmniPeg's pools: every one-pool and two-pool path quoted by eth_call on V4Quoter, ranked by output. When a path through a $OMNIP pool is within 0.10% of the best, it wins. Returns each leg with its OmniPegRouter calldata, the approval it needs, and every candidate path.GET /api/v1/flowThroughput: swaps and volume through OmniPegHook (24 h and all time), the gap fees arbitrageurs paid back to pools, $OMNIP locked, votes, incentives, KNTQ burned once live, and the epoch end.GET /api/v1/incentivesEvery gauge: votes this epoch, its share, and the incentives on it for this epoch and the next.GET /api/v1/hypercore?token=KNTQFind a HyperCore spot token by name, index, HyperEVM or Elysium address: its spot books with mid, mark and 24 h volume. ?book=@334 reads the top of a book (bid, ask, spread, depth within 2%).GET /api/v1/pegkHYPE peg health on Elysium: Kinetiq's rate on HyperEVM, kHYPE's price in the deepest Elysium kHYPE pool, the gap between them, and the age of the rate on Elysium.GET /api/v1/contractsChain, every deployed address with its explorer link and ABI URL, the flagship pool key.# Every pool, with the flagship's key, prices, gap and both fees
curl -s https://omnipeg.space/api/v1/pools
# The fee the deployed hook charges for selling kHYPE at a pool price of 1.029 (ref defaults to the live one)
curl -s "https://omnipeg.space/api/v1/quote?price=1.029&side=sell"
# Kinetiq's rate on HyperEVM and the copy RateBook holds on Elysium
curl -s https://omnipeg.space/api/v1/rate// Works in a browser or Node 18+: CORS is open and no key is needed.
const base = "https://omnipeg.space/api/v1";
const { pools } = await fetch(`${base}/pools`).then((r) => r.json());
const flagship = pools.find((p) => p.slug === "khype-hype");
console.log("gap", flagship.gapBps.toFixed(2), "bps; selling kHYPE pays", flagship.fees.sellKHYPE.fee, "pips");
const q = await fetch(`${base}/quote?price=1.029&side=sell`).then((r) => r.json());
console.log("at 1.029:", q.fee, "pips", q.takesGap ? "(gap fee)" : "(base)");Contracts
| OmniPegHook0x0000000000000000000000000000000000000000 | ExplorerABI |
| RateBook0x0000000000000000000000000000000000000000 | ExplorerABI |
| OmniPegRouter0x0000000000000000000000000000000000000000 | ExplorerABI |
| OmniPegRouter (HYPE/USDC)0x0000000000000000000000000000000000000000 | ExplorerABI |
| OmniPegRouter (kHYPE/USDC)0x0000000000000000000000000000000000000000 | ExplorerABI |
| OmniPegRouter (OMNIP/HYPE)0x0000000000000000000000000000000000000000 | ExplorerABI |
| CoreFeed0x0000000000000000000000000000000000000000 | ExplorerABI |
| CueAdapter0x0000000000000000000000000000000000000000 | ExplorerABI |
| ProductRef0x0000000000000000000000000000000000000000 | ExplorerABI |
| PoolSpotRef0x0000000000000000000000000000000000000000 | ExplorerABI |
| VoteEscrow0x0000000000000000000000000000000000000000 | ExplorerABI |
| Gauges0x0000000000000000000000000000000000000000 | ExplorerABI |
| FeeRewards0x0000000000000000000000000000000000000000 | ExplorerABI |
| SpotFeed0x0000000000000000000000000000000000000000 | ExplorerABI |
| CoreRead (mark)0x0000000000000000000000000000000000000000 | ExplorerABI |
| CoreRead (spot)0x0000000000000000000000000000000000000000 | ExplorerABI |
| CoreListings0x0000000000000000000000000000000000000000 | ExplorerABI |
| ProductRef (kHYPE/KNTQ)0x0000000000000000000000000000000000000000 | ExplorerABI |
| OmniPegRouter (KNTQ/HYPE)0x0000000000000000000000000000000000000000 | ExplorerABI |
| OmniPegRouter (kHYPE/KNTQ)0x0000000000000000000000000000000000000000 | ExplorerABI |
| OmniPegRouter (MONTRA/HYPE)0x0000000000000000000000000000000000000000 | ExplorerABI |
| KntqBurner0x0000000000000000000000000000000000000000 | ExplorerABI |
| GaugeBribes0x0000000000000000000000000000000000000000 | ExplorerABI |
| $OMNIP0x0000000000000000000000000000000000000000 | Explorer |
All addresses as JSON: /api/v1/contracts.
Flagship pool key
A standard v4 pool: the Universal Router and any aggregator that reads v4 can route it.
MCP server
Keyless, Streamable HTTP at https://omnipeg.space/mcp. Tools: get_quote, get_flow, get_incentives, find_hypercore_token, get_rate, list_pools, quote_fee, get_contracts and simulate_swap, which returns an unsigned transaction. Nothing on the server signs or sends.
{
"mcpServers": {
"omnipeg": {
"type": "http",
"url": "https://omnipeg.space/mcp"
}
}
}claude mcp add --transport http omnipeg https://omnipeg.space/mcp# List the tools, then call one: plain JSON-RPC over HTTP, no key
curl -s https://omnipeg.space/mcp -H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
curl -s https://omnipeg.space/mcp -H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"quote_fee","arguments":{"price":1.029,"side":"sell"}}}'For agents
/llms.txt sums up the protocol, the addresses and every endpoint in one plain text file.
Read the build docs