NEMESISDocs
ReferenceFor developers

For developers

Everything in NEMESIS is on-chain and readable. Here is what you need to build on it.

ABIs

Define the chain

chain.ts
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

read.ts
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

wallet.ts
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

short.ts
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.

EndpointReturns
GET /healthKeeper status: mode, keeper address and gas balance, last sample time per market, open tickets, settles done, and house backer status.
GET /boardThe 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 /requestsCoin listing requests grouped by token, with vote counts.
POST /requestsSuggest a coin: JSON body with token (full address), optional note (up to 280 characters) and wallet. Limited to 10 per hour per IP.
sh
curl -s https://keeper-production-5aa65d69.up.railway.app/board | jq '.markets[] | {id, symbol, backerFree, utilBps}'

Events

ContractEvent
ShortBookDeposited(market, position, owner, amount)
ShortBookWithdrawn(market, position, owner, amount)
ShortBookShortOpened(ticket, market, shorter, term, stake, premium, fee, strike, expiry)
ShortBookSliceLocked(ticket, position, amount)
ShortBookShortSettled(ticket, market, shorter, settlePrice, payout, backersReceive, treasuryFee)
ShortBookShortVoided(ticket, market, shorter, reason)  1 = paused, 2 = samples
ShortBookSliceReleased(ticket, position, credited)
ShortBookClaimed(account, amount)
ShortBookPaused, MarketPaused, ParamsSet, TreasurySet, GuardianSet
PriceFeedSampled(id, index, ts, price, rawPrice, reserve)
PriceFeedMarketListed(id, token, poolId, hypeIsCurrency0, key)
PriceFeedMarketListingChanged(id, listed), ParamsSet(...)

Index from the deploy block, 14035960.

Errors

ErrorMeaning
IsPausedThe game or the market is paused (new shorts and deposits only).
NotListedThe market is not listed.
BadTermTerm is not 21600 or 86400 seconds.
BelowMinBelow the minimum stake or deposit.
CapExceededOver the book, global, wallet or open interest cap.
PriceNotReadyLive price unreadable or the 15 minute window is thin.
ReserveTooLowReference reserve below the reserve floor.
NotEnoughBackersNot enough free backer HYPE within 8 positions.
UnderpaidSent less than stake + premium + fee.
NotOwnerNot the position owner.
TooEarlyWithdraw delay not passed, or ticket not expired.
TooMuchWithdraw amount is zero or above free.
NotOpenTicket already settled or voided.
TooSoonPriceFeed: sampled within the last minInterval.
OnlyEOAPriceFeed: sample called from a contract or an EIP-7702 delegated account.
NotGuardianPause called by a wallet that is not the guardian or the owner.
BadPoolPriceFeed listing: no single HYPE side, token has no code, or the pool is below the listing reserve floor.
AlreadyListedPriceFeed listing: the pool is already a market.
TokenHasOwnerPriceFeed listing: the token's owner() is not the zero address.
UnreadablePriceFeed: the pool cannot be read.