ReferenceFor developers
For developers
Everything in NEMESIS is on-chain and readable. Here is what you need to build on it.
ABIs
ShortBook.json0x0010aCe327d5A04A09d9eaa6334c0b0286342a53
PriceFeed.json0x769AC26C01700fdf8aD40acAB4AF7F566C51DAbd
Define the chain
import { createPublicClient, defineChain, http } from "viem";
export const elysium = defineChain({
id: 99901,
name: "Elysium",
nativeCurrency: { name: "HYPE", symbol: "HYPE", decimals: 18 },
rpcUrls: { default: { http: ["https://rpc.elysium.kinetiq.xyz"] } },
blockExplorers: { default: { name: "Elysium Explorer", url: "https://elysium.kinetiq.xyz/explorer" } },
contracts: { multicall3: { address: "0xcA11bde05977b3631167028862bE2a173976CA11" } },
});
export const client = createPublicClient({ chain: elysium, transport: http() });Read parameters and markets
import { formatEther } from "viem";
import shortBookAbi from "./ShortBook.json";
import priceFeedAbi from "./PriceFeed.json";
import { client } from "./chain";
const BOOK = "0x0010aCe327d5A04A09d9eaa6334c0b0286342a53";
const FEED = "0x769AC26C01700fdf8aD40acAB4AF7F566C51DAbd";
const params = await client.readContract({ address: BOOK, abi: shortBookAbi, functionName: "getParams" });
console.log("min stake", formatEther(params.minStake), "HYPE");
const count = await client.readContract({ address: FEED, abi: priceFeedAbi, functionName: "marketCount" });
for (let id = 0n; id < count; id++) {
const [mkt, refRes, book] = await Promise.all([
client.readContract({ address: FEED, abi: priceFeedAbi, functionName: "market", args: [id] }),
client.readContract({ address: FEED, abi: priceFeedAbi, functionName: "refReserve", args: [id] }),
client.readContract({ address: BOOK, abi: shortBookAbi, functionName: "getBook", args: [id] }),
]);
console.log(id, mkt.token, mkt.listed, formatEther(refRes), formatEther(book.totalFree));
}Read a wallet's positions and tickets
const me = "0xYourWallet";
const positionIds = await client.readContract({ address: BOOK, abi: shortBookAbi, functionName: "positionsOf", args: [me] });
for (const id of positionIds) {
const p = await client.readContract({ address: BOOK, abi: shortBookAbi, functionName: "getPosition", args: [id] });
// p.market, p.depositedAt, p.free, p.locked, p.deposited, p.withdrawn
}
const ticketIds = await client.readContract({ address: BOOK, abi: shortBookAbi, functionName: "ticketsOf", args: [me] });
for (const id of ticketIds) {
const t = await client.readContract({ address: BOOK, abi: shortBookAbi, functionName: "getTicket", args: [id] });
// t.status: 0 None, 1 Open, 2 Settled, 3 Voided
// t.stake, t.premium, t.fee, t.strike, t.expiry, t.payout, t.settlePrice
}
const owed = await client.readContract({ address: BOOK, abi: shortBookAbi, functionName: "claimable", args: [me] });Quote and open a short
import { parseEther } from "viem";
// wallet: a viem WalletClient on the elysium chain, connected to your account
const SIX_HOURS = 21600n; // TERM_SHORT. TERM_LONG is 86400n
const stake = parseEther("0.1");
const [ok, premium, fee, strike, expiry] = await client.readContract({
address: BOOK, abi: shortBookAbi, functionName: "quote", args: [0n, SIX_HOURS, stake],
});
if (!ok) throw new Error("Not quotable now: price window not ready or not enough free backer HYPE");
// Premium is recomputed at open. Send a small buffer: any excess is refunded in the same transaction.
const value = stake + premium + fee + premium / 10n + 1n;
await wallet.writeContract({ address: BOOK, abi: shortBookAbi, functionName: "openShort", args: [0n, SIX_HOURS, stake], value });Keeper endpoints
The keeper exposes three public, read-friendly endpoints. They are a convenience: everything they show can be read from the chain.
| Endpoint | Returns |
|---|---|
| GET /health | Keeper status: mode, keeper address and gas balance, last sample time per market, open tickets, settles done, and house backer status. |
| GET /board | The cache the app reads: parameters, every market with price, 15 minute median, sample count, pool depth, backer free and locked HYPE, caps, utilisation and house backing, plus book events. Refreshed about every 15 seconds. CORS open. |
| GET /requests | Coin listing requests grouped by token, with vote counts. |
POST /requests | Suggest a coin: JSON body with token (full address), optional note (up to 280 characters) and wallet. Limited to 10 per hour per IP. |
curl -s https://keeper-production-5aa65d69.up.railway.app/board | jq '.markets[] | {id, symbol, backerFree, utilBps}'Events
| Contract | Event |
|---|---|
| ShortBook | Deposited(market, position, owner, amount) |
| ShortBook | Withdrawn(market, position, owner, amount) |
| ShortBook | ShortOpened(ticket, market, shorter, term, stake, premium, fee, strike, expiry) |
| ShortBook | SliceLocked(ticket, position, amount) |
| ShortBook | ShortSettled(ticket, market, shorter, settlePrice, payout, backersReceive, treasuryFee) |
| ShortBook | ShortVoided(ticket, market, shorter, reason) 1 = paused, 2 = samples |
| ShortBook | SliceReleased(ticket, position, credited) |
| ShortBook | Claimed(account, amount) |
| ShortBook | Paused, MarketPaused, ParamsSet, TreasurySet, GuardianSet |
| PriceFeed | Sampled(id, index, ts, price, rawPrice, reserve) |
| PriceFeed | MarketListed(id, token, poolId, hypeIsCurrency0, key) |
| PriceFeed | MarketListingChanged(id, listed), ParamsSet(...) |
Index from the deploy block, 14035960.
Errors
| Error | Meaning |
|---|---|
IsPaused | The game or the market is paused (new shorts and deposits only). |
NotListed | The market is not listed. |
BadTerm | Term is not 21600 or 86400 seconds. |
BelowMin | Below the minimum stake or deposit. |
CapExceeded | Over the book, global, wallet or open interest cap. |
PriceNotReady | Live price unreadable or the 15 minute window is thin. |
ReserveTooLow | Reference reserve below the reserve floor. |
NotEnoughBackers | Not enough free backer HYPE within 8 positions. |
Underpaid | Sent less than stake + premium + fee. |
NotOwner | Not the position owner. |
TooEarly | Withdraw delay not passed, or ticket not expired. |
TooMuch | Withdraw amount is zero or above free. |
NotOpen | Ticket already settled or voided. |
TooSoon | PriceFeed: sampled within the last minInterval. |
OnlyEOA | PriceFeed: sample called from a contract or an EIP-7702 delegated account. |
NotGuardian | Pause called by a wallet that is not the guardian or the owner. |
BadPool | PriceFeed listing: no single HYPE side, token has no code, or the pool is below the listing reserve floor. |
AlreadyListed | PriceFeed listing: the pool is already a market. |
TokenHasOwner | PriceFeed listing: the token's owner() is not the zero address. |
Unreadable | PriceFeed: the pool cannot be read. |
