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
- Active — Accepting bets (first 50% of duration)
- Closed — No more bets (last 50% of duration)
- Ended — Waiting for resolution
- 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:
- Token Burn (tax-free)
- Validate inputs
- Store market details on-chain
- Lock initial ETH as betting pool
- 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:
- Validate market state
- Slippage check via
minOdds - Record bet
- Update pools and odds
Odds calculation:
YES Odds = NO Pool / (YES Pool + NO Pool) × 100
NO Odds = YES Pool / (YES Pool + NO Pool) × 1003) claimWinnings
What it does: Collects rewards from winning bets
Requirements:
- Market is resolved, caller has winning bets
Process:
- Verify winner
- Compute share of the 75% winners pool (after fees)
- 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 Fees4) 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:
| Recipient | Share |
|---|---|
| Admin | 15% |
| Creator | 5% |
| Protocol | 5% |
| Winners | 75% |
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"
}