Reference
Every export, opcode, and constant in the OMY SDK. This page is the source of truth — when the SDK changes, this updates.
:::info Future: auto-generated API The hand-curated reference below covers everything you need. We'll layer TypeDoc-generated detail (signatures, examples, type definitions) on top of this page in a future release. :::
Builders
buildMeta(opts)
Build the Meta ref-cell that accompanies every assertion. Carries the question
text and metadata used for downstream consumers + indexers.
function buildMeta(opts: {
identifier: bigint; // your data identifier (uint256)
factTimestamp: number; // unix timestamp of the asserted fact
callbackRecipient: Address | null; // where OracleResult lands
question: Cell; // question / ancillary data
}): Cell
Notes:
identifierlets you tag assertions by category (price-feed type, event category, RWA milestone class). Off-chain indexers filter by it.factTimestampis informational — the assertion doesn't validate it.callbackRecipient: nullmeans no callback is sent at resolution; useful if you only need the on-chain status and don't have a contract to notify.questionis a TL-B cell — usebeginCell().storeStringTail(...).endCell()for plain text or any structured layout your indexer can decode.
buildCreateAssertion(opts)
Build the CreateAssertion message body to send to OracleFactory.
function buildCreateAssertion(opts: {
id: bigint; // question id
resolver: Address;
bondAmount: bigint; // required bond (jetton nano-units)
liveness: number; // challenge window in seconds
meta: Cell; // from buildMeta()
}): Cell
The factory injects its current monetization snapshot into the spawned
assertion's Config, so protocolFee + treasuryAddress are baked in at deploy
time (not passed via this message).
buildBondPayload(op)
Build the inline forward-payload for a bond intake (propose / dispute). Encodes the 1-bit Either flag (= 0) then the 8-bit op code.
function buildBondPayload(op: number): Cell
// Valid op values:
// OP_PROPOSE_TRUE = 0x01
// OP_PROPOSE_FALSE = 0x02
// OP_DISPUTE = 0x03
You attach this as the forwardPayload of a TEP-74 jetton AskToTransfer
from the proposer/disputer's wallet to the assertion address.
Parsers
parseOracleResult(body)
Decode an inbound OracleResult message body. Returns null if the body
doesn't match the opcode — your handler should ignore non-matching messages,
not throw on them.
function parseOracleResult(body: Cell): {
questionId: bigint;
answer: boolean;
} | null
parseOracleDisputed(body)
Decode an inbound OracleDisputed message body. Sent by the assertion when
it enters Disputed status — your consumer can pause its logic until the
final OracleResult arrives.
function parseOracleDisputed(body: Cell): {
questionId: bigint;
} | null
parseAssertionCreated(body)
Decode the factory's reply to CreateAssertion. Carries the spawned
assertion's address — bind it in your consumer to anti-spoof later messages.
function parseAssertionCreated(body: Cell): {
id: bigint;
assertion: Address;
} | null
Constants
Cross-contract opcodes — oracle layer
export const OP_FINALIZE = 0x0a03; // keeper → assertion
export const OP_RESOLVE = 0x0a01; // resolver → assertion
export const OP_ORACLE_RESULT = 0x0a02; // assertion → consumer
export const OP_CREATE_ASSERTION = 0x0a04; // consumer → factory
export const OP_ASSERTION_CREATED = 0x0a05; // factory → consumer
export const OP_ORACLE_DISPUTED = 0x0a06; // assertion → consumer (on dispute)
export const OP_OPEN_VOTE = 0x0a07; // assertion → resolver
export const OP_REPROVIDE_WALLET = 0x0a08; // permissionless → factory
export const OP_UPDATE_MONETIZATION = 0x0a09; // owner → factory (Phase B governance)
export const OP_SET_JETTON_WALLET = 0x0a0a; // factory → assertion
export const OP_TIMEOUT_REFUND = 0x0a0b; // permissionless → assertion
export const OP_REEMIT_RESULT = 0x0a0c; // permissionless → assertion
Bond intake ops (forward payload)
export const OP_PROPOSE_TRUE = 0x01;
export const OP_PROPOSE_FALSE = 0x02;
export const OP_DISPUTE = 0x03;
Cross-contract opcodes — market layer
export const OP_CREATE_MARKET = 0x0d01;
export const OP_MARKET_CREATED = 0x0d02;
export const OP_BIND_WALLET = 0x0d03;
export const OP_SET_ORACLE = 0x0d04;
export const OP_MERGE = 0x0d05;
export const OP_REDEEM = 0x0d06;
export const OP_REQUEST_RESOLUTION = 0x0d07;
export const OP_SET_TREASURY = 0x0d08;
export const OP_CANCEL_AWAITING = 0x0d09;
Error codes
Every OMY contract uses a unique error-code range so exit codes are unambiguous in tx traces.
Assertion (100-115)
| Code | Name | Reason |
|---|---|---|
| 100 | WalletNotSet | Bond intake before SetJettonWallet bound a wallet |
| 101 | WrongJettonWallet | Bond came from a wallet that isn't ours |
| 102 | BondTooLow | Zero amount (other underfunding refunds, not throws) |
| 103 | PayloadNotInline | Forward payload was reffed, expected inline |
| 104 | NotOpen | propose() called when status ≠ Open |
| 105 | NotProposed | finalize() called when status ≠ Proposed |
| 106 | WindowClosed | dispute after deadline (now refunds, was throw historically) |
| 107 | NotDisputed | Resolve called when status ≠ Disputed |
| 108 | OnlyResolver | Resolve from wrong sender |
| 109 | WindowOpen | finalize before deadline |
| 110 | ArbitrationOngoing | TimeoutRefund before ARBITRATION_WINDOW elapsed |
| 111 | NotResolved | ReemitResult when status ≠ Resolved |
| 112 | OnlyCreator | SetJettonWallet from wrong sender |
| 113 | WalletLocked | SetJettonWallet after status moved past Open |
| 114 | BadBond | Config bound bondAmount out of valid range |
| 115 | BadLiveness | Config bound liveness out of valid range |
OracleFactory (300-304)
| Code | Name | Reason |
|---|---|---|
| 300 | Underfunded | CreateAssertion / ReprovideWallet without enough TON |
| 301 | NotOurMaster | ResponseWalletAddress not from the bound jetton master |
| 302 | UnknownQuery | ResponseWalletAddress / ReprovideWallet with unknown query id |
| 303 | OnlyOwner | UpdateMonetization from non-owner |
| 304 | BadFee | UpdateMonetization with protocolFee above MAX_PROTOCOL_FEE |
Market (500-524)
Full table in market-storage.tolk.
Highlights: OnlyCreator (500), WalletAlreadySet (501), NotOpen (505),
InsufficientShares (510), NotOurFactory (512), NotOurOracle (515),
AlreadyResolved (517), TreasuryTooLate (521), AwaitingTimeoutOngoing (522).
Gas constants
| Constant | Value | Used by |
|---|---|---|
GAS_RESERVE | 0.2 TON | Assertion (floor before outgoing payouts) |
JETTON_FWD_GAS | 0.05 TON | Assertion (per outgoing jetton transfer) |
CALLBACK_GAS | 0.02 TON | Assertion (consumer callback) |
OPENVOTE_GAS | 0.1 TON | Assertion (notify resolver on dispute) |
CREATE_MIN_VALUE | 0.6 TON | OracleFactory (min for CreateAssertion) |
ASSERTION_DEPLOY_VALUE | 0.3 TON | OracleFactory (child deploy gas) |
M_GAS_RESERVE | 0.2 TON | Market |
REQUEST_MIN_VALUE | 0.7 TON | Market (RequestResolution must carry) |
Fee parameters (Phase A)
| Constant | Value | Used by |
|---|---|---|
MAX_PROTOCOL_FEE | 3 TON (= 3 USDT-units) | OracleFactory (cap on UpdateMonetization) |
SWAP_FEE_BPS | 50 (0.5%) | Market (BUY_YES / BUY_NO) |
RESOLUTION_FEE_BPS | 100 (1%) | Market (silent skim at resolve) |
BOND_BPS | 200 (2%) | Market (bond ↔ TVL clamp) |
MAX_BOND_CAP | 10 000 USDT | Market (bond ceiling) |
AWAITING_TIMEOUT | 86 400 s (1 day) | Market (CancelAwaiting deadline) |
ARBITRATION_WINDOW | 604 800 s (7 days) | Assertion (TimeoutRefund threshold) |
Versioning
| SDK version | 0.x (pre-1.0). Expect minor opcode polish; nothing breaks. |
| Contract opcode pin | Stable. Breaking changes ship as v2 contracts at new addresses. |
| Wire stability | TL-B layouts of every cross-contract message are committed. |
| Mainnet | Coming soon. |
Source links
Direct links into the canonical contracts when you want to verify behavior: