Coin type needs its own published module. The template lives at packages/binary-market-template/ and is excluded from the pnpm workspace (it’s Move, not TS).
Layout
yes.move / no.move
<slug> substitution happens during scaffolding; the resulting type is 0x<pkg>::yes::YES / 0x<pkg>::no::NO.
settlement.move
create_market<COLLATERAL>(yes_cap, no_cap, label, expiry_ms, resolver, ctx). Wraps both caps, shares theSettlement, transfersResolverCaptoresolver.mint_pair<COLLATERAL>(settlement, collateral_coin, ctx) -> (Coin<YES>, Coin<NO>). Pre-resolution. Takes equal collateral, mints equal YES + NO.burn_pair<COLLATERAL>(settlement, yes_coin, no_coin, ctx) -> Coin<COLLATERAL>. Pre-resolution. Pays back the matching collateral.mark_resolved(settlement, cap, outcome, clock, ctx). Owner-gated by theResolverCap. Assertsclock.timestamp_ms >= expiry_ms. Setsfinal_outcome.redeem_yes<COLLATERAL>(settlement, yes_coin, ctx) -> Coin<COLLATERAL>. Post-resolution. Pays $1 per YES iffinal_outcome == 1, else aborts.redeem_no<COLLATERAL>. Symmetric.
MarketCreated, PairMinted, PairBurned, MarketResolved, Redeemed.
Scaffolder
scripts/create-binary-market.ts does the following:
- Materialises template into
.binary-markets/binary_market_<slug>/. - Substitutes slug + label into module names + metadata.
- Runs
sui move buildto verify substitution (always, even in dry-run). - With
--execute: publishes, extracts package + TreasuryCap ids fromobjectChanges. - Runs
settlement::create_market<DUSDC>to consume both caps and mintResolverCap. - Appends to
.binary-markets/registry.json.
pnpm binary-market:create --slug … --label … --expiry-ms … --resolver 0x… --execute. Slug must match /^[a-z0-9_]+$/.
See Create a Binary Market for the full walkthrough.