OddMaki
Trading

Trading

Orders, the onchain orderbook, matching, settlement, and batch tools — the full trading surface on every OddMaki market.

Trading on OddMaki runs entirely through a fully onchain central limit order book (CLOB). Every order, fill, and cancel is a transaction on Base — there's no off-chain matching engine, no relay server, no centralised sequencer.

This section covers the trading flow end-to-end: how orders are placed, how the orderbook holds them, how the matching engine crosses them into fills, and how those fills settle into outcome tokens and collateral movements.

Order → Match → Fill → Settlement

   ┌─────────────┐   placeOrder    ┌──────────────────┐
   │   Trader    │ ───────────────▶│  Orderbook       │
   └─────────────┘                 │  (per-market     │
                                   │   tick levels)   │
                                   └────────┬─────────┘
                                            │ matchOrders (permissionless)

                                   ┌──────────────────┐
                                   │ Matching engine  │
                                   │ picks settlement │
                                   │ path per cross   │
                                   └────────┬─────────┘

            ┌──────────────────────────────┼──────────────────────────────┐
            ▼                              ▼                              ▼
     ┌────────────┐                ┌──────────────┐               ┌──────────────┐
     │  NORMAL    │                │ MINT-TO-FILL │               │ MERGE-TO-FILL│
     │  buy ⇄ sell│                │  YES + NO    │               │  YES + NO    │
     │  same      │                │  buyers      │               │  sellers     │
     │  outcome   │                │  split into  │               │  merge back  │
     │            │                │  outcome tokens│             │  to collateral│
     └────────────┘                └──────────────┘               └──────────────┘


                                   ┌──────────────────┐
                                   │ Fill event +     │
                                   │ token transfer + │
                                   │ fee distribution │
                                   └──────────────────┘

Orders

An order is a request to buy or sell YES or NO outcome tokens at a specific tick (limit) or at the best available price (market). It belongs to exactly one market and one side. Makers pay no fees; takers pay the full fee stack — see Fees.

TypeTime-in-forceWhat happens
LimitGTC by default; optional expiry timestampRests at the specified tick until matched, cancelled, or expired
Market — FOK (Fill-or-Kill)One-shotFills the requested quantity entirely or reverts; partial fills not allowed
Market — FAK (Fill-and-Kill)One-shotFills as much as possible against the book, cancels any remainder

placeOrder always takes a price + amount + side + market. The SDK's placeOrderSimple accepts human-readable strings ("0.80", "100", "24h") and converts to ticks/wei.

Order lifecycle

StateDescription
RestingLimit order sitting on the book at its tick
FilledFully matched against a counter-order
CancelledMaker called cancelOrder (or batchCancelOrders)
ExpiredPre-set expiry timestamp elapsed; the order is removed on its next interaction
Auto-cancelledMarket resolved while the order was still on the book; refundable via cancelOrdersOnResolvedMarket

Trades

A trade (called a fill on chain) is the event of two orders crossing — one taker, one maker — and the onchain settlement that results. Every fill produces:

  • A transfer of outcome tokens between the maker and taker
  • A fee distribution across the four-layer stack (taker pays everything)
  • A Fill event indexed by the subgraph

The matching engine is permissionless: anyone can call matchOrders to cross resting orders and earn the 10 bps match-operator fee.

Three settlement paths

OddMaki has three settlement paths, picked per-cross by the matching engine based on what's available on the book:

PathWhen it firesWhat changes hands
Normal FillBuy crosses Sell on the same outcomeExisting YES (or NO) tokens transfer maker → taker; collateral transfers taker → maker
Mint-to-FillYES buy + NO buy crossCollateral from both buyers is split into matched YES + NO pairs via the CTF; each buyer ends up holding the side they bought
Merge-to-FillYES sell + NO sell crossBoth sellers' tokens are merged into collateral via the CTF; collateral is paid out to both sellers

These three paths are why the CLOB stays liquid even when there's no obvious counter-order on the same side — same-side scarcity gets resolved by minting (for buyers) or merging (for sellers).

In this section

  • Overview — this page
  • Orderbook — onchain CLOB mechanics: doubly-linked tick levels, FIFO per tick, best-bid/best-ask tracking
  • Matching & Settlement — the matching engine, the three settlement paths in detail, and the match-operator fee
  • Batch Operations — place up to 20, cancel up to 100, or atomic cancel-and-replace in a single tx
  • Markets — the markets that orders trade against
  • Positions — outcome tokens you hold after orders fill
  • Fees — what the taker pays on each trade