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
PegHook.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 = "0xEb7316be9bf3733d34Ec50ee0a8867a0B021a0C8";
const RATE_BOOK = "0x06eFAe8fc540D2e0d383Cc7408ccEa797f8B9A6C";
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 PegHook, RateBook and PegRouter, 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(0xEb7316be9bf3733d34Ec50ee0a8867a0B021a0C8);
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 PegHook charges now for selling kHYPE (true) on the flagship pool
cast call 0xEb7316be9bf3733d34Ec50ee0a8867a0B021a0C8 \
"quote((address,address,uint24,int24,address),bool)((uint24,uint24,uint256,uint256,uint256,bool,bool))" \
"(0x248888D396A546A69A188f3Deb476964e581E9d0,0xbA876237B0F021A6c6D852d6c26E107997cC5E81,8388608,1,0xEb7316be9bf3733d34Ec50ee0a8867a0B021a0C8)" 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.xyzRead 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 status; the flagship with its key, prices, gap, depth and both fees.GET /api/v1/quote?price=1.029&ref=1.0278&side=sellPegHook.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/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://pegisium.com/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://pegisium.com/api/v1/quote?price=1.029&side=sell"
# Kinetiq's rate on HyperEVM and the copy RateBook holds on Elysium
curl -s https://pegisium.com/api/v1/rate// Works in a browser or Node 18+: CORS is open and no key is needed.
const base = "https://pegisium.com/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
| PegHook0xEb7316be9bf3733d34Ec50ee0a8867a0B021a0C8 | ExplorerABI |
| RateBook0x06eFAe8fc540D2e0d383Cc7408ccEa797f8B9A6C | ExplorerABI |
| PegRouter0xAd1310746184aCDE00194200eCEcaa54b958FbFf | ExplorerABI |
| VoteEscrow0x34346191F51C2bB7c9EA46Fb21454150c565fe6e | ExplorerABI |
| Gauges0x681D479fe788d96de39810050f167a75a89B6C96 | ExplorerABI |
| FeeRewards0x2CA4BE133d6e0EB6014747BfcC423f59EB7F98E4 | ExplorerABI |
| $PEG0x9eb09e63ebd711db46026697d10d9bccf35ad023 | 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://pegisium.com/mcp. Tools: get_rate, list_pools, quote_fee, get_contracts and simulate_swap, which returns an unsigned transaction. Nothing on the server signs or sends.
{
"mcpServers": {
"pegisium": {
"type": "http",
"url": "https://pegisium.com/mcp"
}
}
}claude mcp add --transport http pegisium https://pegisium.com/mcp# List the tools, then call one: plain JSON-RPC over HTTP, no key
curl -s https://pegisium.com/mcp -H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
curl -s https://pegisium.com/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