Coin<YES> / Coin<NO> outcome tokens and a shared Settlement<COLLATERAL> object.
Why one package per market
Sui’s one-time-witness rule means eachCoin type needs its own published module. So every event market is a full Move publish:
scripts/create-binary-market.ts materialises this template into .binary-markets/binary_market_<slug>/, substitutes slug + label into module names + metadata, builds, publishes, then calls settlement::create_market<DUSDC> which:
- Consumes both
TreasuryCaps into a sharedSettlement<DUSDC>. - Mints a
ResolverCapand transfers it to--resolver. - Appends the entry to
.binary-markets/registry.json.
/v1/binary-markets request, with a 4s LRU on live Settlement state. New markets show up immediately, no migration needed.
Lifecycle
Create
Settlement, mints ResolverCap to --resolver.Mint a pair
A user deposits DUSDC →
settlement::mint_pair returns equal quantities of Coin<YES> and Coin<NO>. The trader can hold both, swap one leg for DUSDC on V3 pools, or burn the pair to recover collateral.Trade on V3
Per-market pools (
Pool<YES, DUSDC> + Pool<NO, DUSDC>) live on real DeepBook V3 testnet. Bootstrapped via scripts/create-v3-pools.ts (500 DEEP fee each) + scripts/seed-v3-liquidity.ts (two-sided POST_ONLY quotes).Users market-buy / market-sell either leg via pool::swap_exact_quantity with pay_with_deep=false. Fees in the input token, so the user never has to hold DEEP.Burn the pair
Pre-resolution,
settlement::burn_pair accepts the smaller of YES / NO balances and pays back the matching DUSDC.Resolve
Once the event is decided, the resolver signs
settlement::mark_resolved with the ResolverCap. The winning side becomes redeemable at $1 / token.The registry on disk
.binary-markets/registry.json is the authoritative source of all scaffolded markets. The server merges it with live Settlement state to serve /v1/binary-markets. New markets need an indexer restart before their event stream exists, but /v1/binary-markets picks them up immediately.
ooMarketLinkId field bridges the event market to a MarketLink for the Optimistic Oracle panel.