Skip to content

oddmaki/oddmaki-core

Repository files navigation

OddMaki Protocol

Permissionless prediction market factory with a fully on-chain Central Limit Order Book (CLOB). Built on Base.

OddMaki lets anyone launch their own prediction market platform — what we call a venue. Each venue is an independent marketplace where operators control who can create markets, who can trade, fee structures, and oracle configuration. Think of it as Shopify for prediction markets: the protocol provides the trading engine, order matching, and settlement infrastructure; operators bring their audience and markets.

All trading happens on-chain through a CLOB — no off-chain components, no centralized matching, no custodial risk.

Architecture

Single EIP-2535 Diamond proxy with modular facets:

src/
├── OddMaki.sol              # Diamond proxy
├── facets/                   # Public entry points
│   ├── VenueFacet.sol        # Venue creation and configuration
│   ├── MarketsFacet.sol      # Market lifecycle
│   ├── MarketGroupFacet.sol  # Mutually exclusive market groups (neg-risk)
│   ├── LimitOrdersFacet.sol  # Limit order placement and cancellation
│   ├── MarketOrdersFacet.sol # FOK / FAK market orders
│   ├── MatchingFacet.sol     # Order matching engine
│   ├── OrderBookFacet.sol    # On-chain orderbook reads
│   ├── VaultFacet.sol        # Collateral deposits and withdrawals
│   ├── ResolutionFacet.sol   # Oracle-based market resolution
│   └── ...
├── aggregates/               # Domain orchestration (write path)
├── services/                 # Business logic
├── validators/               # Domain invariants and guard checks
├── storage/                  # Namespaced Diamond storage
└── libraries/                # Pure utilities

Key Concepts

  • Venues — Permissionless market factories. Each venue defines who can create markets, who can trade, fee structure, and oracle configuration.
  • Matching Engine — Three settlement paths: direct fill (existing tokens), mint-to-fill (split collateral into YES + NO), and merge-to-fill (redeem YES + NO to collateral).
  • Market Groups — N mutually exclusive binary markets sharing collateral. One resolves YES, the rest cascade to NO.
  • Fees — Protocol fee, venue fee, creator fee, and operator fee. Fee rates are snapshotted per market at creation to protect resting orders.

External Dependencies

Deployments

Base mainnet (chainId 8453)

Diamond: 0x025d086a62d93e24f3cb3f161612ca8e9530127d

All protocol calls go through the Diamond proxy. Full facet manifest: deployments/base/latest.json.

Inspect the live facet → selector graph on Louper — the standard explorer for EIP-2535 diamonds. Basescan only shows the original verified source at the proxy address and is not diamond-aware; Louper enumerates the loupe and links to each facet's verified source.

Base Sepolia (testnet, chainId 84532)

Diamond: 0x31a4126aec35b36d46dd371eb0f0d5b71e1c2292 — full manifest in deployments/base-sepolia/latest.json, facet graph on Louper.

Build

Requires Foundry.

forge build

Test

forge test -vvv

423 tests covering matching, settlement, fees, market groups, resolution, access control, and edge cases.

Security

This protocol handles real funds. The matching engine, fee calculations, and settlement paths are designed to be provably correct.

If you find a vulnerability, please report it responsibly to team@oddmaki.com.

Related Repositories

Links

License

Business Source License 1.1 — see LICENSE for details. Converts to MIT on January 1, 2030. Copyright (c) 2025-2026 Predictable Reality, Inc.