Skip to main content

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:

  • identifier lets you tag assertions by category (price-feed type, event category, RWA milestone class). Off-chain indexers filter by it.
  • factTimestamp is informational — the assertion doesn't validate it.
  • callbackRecipient: null means no callback is sent at resolution; useful if you only need the on-chain status and don't have a contract to notify.
  • question is a TL-B cell — use beginCell().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)

CodeNameReason
100WalletNotSetBond intake before SetJettonWallet bound a wallet
101WrongJettonWalletBond came from a wallet that isn't ours
102BondTooLowZero amount (other underfunding refunds, not throws)
103PayloadNotInlineForward payload was reffed, expected inline
104NotOpenpropose() called when status ≠ Open
105NotProposedfinalize() called when status ≠ Proposed
106WindowCloseddispute after deadline (now refunds, was throw historically)
107NotDisputedResolve called when status ≠ Disputed
108OnlyResolverResolve from wrong sender
109WindowOpenfinalize before deadline
110ArbitrationOngoingTimeoutRefund before ARBITRATION_WINDOW elapsed
111NotResolvedReemitResult when status ≠ Resolved
112OnlyCreatorSetJettonWallet from wrong sender
113WalletLockedSetJettonWallet after status moved past Open
114BadBondConfig bound bondAmount out of valid range
115BadLivenessConfig bound liveness out of valid range

OracleFactory (300-304)

CodeNameReason
300UnderfundedCreateAssertion / ReprovideWallet without enough TON
301NotOurMasterResponseWalletAddress not from the bound jetton master
302UnknownQueryResponseWalletAddress / ReprovideWallet with unknown query id
303OnlyOwnerUpdateMonetization from non-owner
304BadFeeUpdateMonetization 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

ConstantValueUsed by
GAS_RESERVE0.2 TONAssertion (floor before outgoing payouts)
JETTON_FWD_GAS0.05 TONAssertion (per outgoing jetton transfer)
CALLBACK_GAS0.02 TONAssertion (consumer callback)
OPENVOTE_GAS0.1 TONAssertion (notify resolver on dispute)
CREATE_MIN_VALUE0.6 TONOracleFactory (min for CreateAssertion)
ASSERTION_DEPLOY_VALUE0.3 TONOracleFactory (child deploy gas)
M_GAS_RESERVE0.2 TONMarket
REQUEST_MIN_VALUE0.7 TONMarket (RequestResolution must carry)

Fee parameters (Phase A)

ConstantValueUsed by
MAX_PROTOCOL_FEE3 TON (= 3 USDT-units)OracleFactory (cap on UpdateMonetization)
SWAP_FEE_BPS50 (0.5%)Market (BUY_YES / BUY_NO)
RESOLUTION_FEE_BPS100 (1%)Market (silent skim at resolve)
BOND_BPS200 (2%)Market (bond ↔ TVL clamp)
MAX_BOND_CAP10 000 USDTMarket (bond ceiling)
AWAITING_TIMEOUT86 400 s (1 day)Market (CancelAwaiting deadline)
ARBITRATION_WINDOW604 800 s (7 days)Assertion (TimeoutRefund threshold)

Versioning

SDK version0.x (pre-1.0). Expect minor opcode polish; nothing breaks.
Contract opcode pinStable. Breaking changes ship as v2 contracts at new addresses.
Wire stabilityTL-B layouts of every cross-contract message are committed.
MainnetComing soon.

Direct links into the canonical contracts when you want to verify behavior: