Skip to main content
Lightweight wrapper that maps a human-readable question to either a Predict OracleSVI or an OO market, plus the Walrus blob pointer to the long-form spec.

Types

public struct MarketLink has key, store {
    id: UID,
    question: String,                  // "Will BTC close above $100k on Jun 30?"
    spec_blob_id: vector<u8>,           // Walrus blob id of rules + sources
    spec_hash: vector<u8>,              // blake2b-256 of spec blob
    category: String,                   // "crypto" | "sports" | "politics" | …
    resolution_kind: u8,                // 0 = price oracle, 1 = optimistic
    oracle_id_bytes: vector<u8>,        // OracleSVI id (or empty for OO)
    expiry_ms: u64,                     // or "event end time" for OO
    creator: address,                   // receives 0.5% of fees
    created_at_ms: u64,
}
Shared MarketRegistry table maps MarketLink id → MarketSummary.

Resolution kinds

const RESOLUTION_PRICE_ORACLE: u8 = 0;
const RESOLUTION_OPTIMISTIC: u8 = 1;

Public functions

public fun register_price_market(
    registry: &mut MarketRegistry,
    question: String,
    spec_blob_id: vector<u8>,
    spec_hash: vector<u8>,
    category: String,
    oracle_id_bytes: vector<u8>,
    expiry_ms: u64,
    clock: &Clock,
    ctx: &mut TxContext,
): MarketLink

public fun register_optimistic_market(
    registry: &mut MarketRegistry,
    question: String,
    spec_blob_id: vector<u8>,
    spec_hash: vector<u8>,
    category: String,
    event_end_ms: u64,
    clock: &Clock,
    ctx: &mut TxContext,
): MarketLink

Wired via

scripts/register-market.ts. --kind price calls register_price_market, --kind oo calls register_optimistic_market. Captures the MarketLink id and suggests the .env key (BTC_MARKET_LINK_ID / SPORTS_OO_MARKET_LINK_ID).

Tests

tests/market_tests.move. Sanity check that resolution_price_oracle_kind() != resolution_optimistic_kind().