OracleMart LogoOracleMart
Smart Contracts

CoreMarket

Core marketplace contract for creating markets, placing bets, and claiming winnings

CoreMarket

CoreMarket is the main marketplace contract — think of it as the "Amazon" of prediction markets. It's where markets are created, bets are placed, and winnings are claimed.

Overview

CoreMarket serves as the central hub where:

  • Markets are created and stored
  • Users place their bets
  • Winners collect their rewards
  • Fees are collected and distributed

Key Concepts

What is a Market?

A market is a prediction question with:

  • A clear YES/NO question
  • A deadline for betting
  • A resolution method
  • A pool of bets on each side

Market States

  1. Active — Accepting bets (first 50% of duration)
  2. Closed — No more bets (last 50% of duration)
  3. Ended — Waiting for resolution
  4. Resolved — Outcome determined, ready for claims

User Roles and Permissions

Anyone Can

  • Create a market (requires 2000 ORMT burn)
  • Place bets on any market
  • View all market information
  • Claim winnings from resolved markets

Market Creator Can

  • All public actions
  • Collect creator fees (5% of total pool)
  • Resolve their manual markets
  • Set initial market parameters

Admin Can

  • Pause/unpause the entire system
  • Update fee structures (admin fee max 25%)
  • Emergency market interventions
  • Upgrade contract logic
  • Sponsor markets with balanced liquidity (market making)
  • Cannot place directional bets

Core Functions Explained

1) createMarket

What it does: Creates a new prediction market

Requirements:

  • Burn 2000 ORMT
  • Provide at least 0.01 ETH initial liquidity
  • Question under 500 characters, description under 1000

Process:

  1. Token Burn (tax-free)
  2. Validate inputs
  3. Store market details on-chain
  4. Lock initial ETH as betting pool
  5. Emit MarketCreated

Parameters:

  • question, description, duration, minBet, maxBet, marketType (0 Manual, 1 Oracle, 2 Random), oracleData, msg.value

2) placeBet

What it does: Places a YES or NO bet on a market

Requirements:

  • Market is in the first half of its duration
  • Bet amount within min/max bounds

Process:

  1. Validate market state
  2. Slippage check via minOdds
  3. Record bet
  4. Update pools and odds

Odds calculation:

YES Odds = NO Pool / (YES Pool + NO Pool) × 100
NO Odds  = YES Pool / (YES Pool + NO Pool) × 100

3) claimWinnings

What it does: Collects rewards from winning bets

Requirements:

  • Market is resolved, caller has winning bets

Process:

  1. Verify winner
  2. Compute share of the 75% winners pool (after fees)
  3. Transfer ETH and mark claimed

Payout calculation:

Total Pool After Fees = Total Pool × 75%
Your Share = Your Bet / Total Winning Bets
Your Winnings = Your Share × Total Pool After Fees

4) sponsorMarketBalanced (Admin)

What it does: Admins add liquidity to both sides equally to bootstrap markets, acting as market makers (not taking positions).

Financial Flows and Fees

From the total pool, 25% fees are collected on resolution and split:

RecipientShare
Admin15%
Creator5%
Protocol5%
Winners75%

Security Features

  • Betting cutoff at 50% of duration (prevents last-minute manipulation)
  • Reentrancy guards around state-changing functions
  • Slippage protection via minOdds
  • Global pause mechanism

State Transitions

Created → Active → Closed → Ended → Resolved → Claimed
   ↓        ↓        ↓        ↓        ↓          ↓
 [New]   [Betting] [Waiting] [Done]  [Outcome]  [Paid]

On-chain (Sepolia)

{
  address: "0x36b5ebE5a161E7d1C7B75aBce457d7066d87e6DB"
}