Smart Contracts
Overview of OracleMart's smart contract architecture
Smart Contracts Overview
OracleMart V2's smart contract system consists of four interconnected contracts that work together to provide a secure, transparent, and efficient prediction market platform.
Contract Architecture
The Four Contracts
1. CoreMarket - The Marketplace
Address: 0x36b5ebE5a161E7d1C7B75aBce457d7066d87e6DB
The central hub where all the action happens:
- Market creation and storage
- Bet placement and management
- Winnings distribution
- Fee collection
Key Functions:
createMarket()- Create a new prediction marketplaceBet()- Place a bet on an outcomeclaimWinnings()- Collect payouts from won betssponsorMarket()- Add balanced liquidity (market making)
2. ResolutionEngine - The Decision Maker
Address: 0xdD2DBd78d4D260321735d45EF32Df965c962Ab7F
Determines market outcomes using various resolution methods:
- Manual resolution (commit-reveal)
- Oracle resolution (Chainlink/UMA)
- VRF resolution (provably random)
Key Functions:
resolveMarket()- Resolve a market with outcomecommitResolution()- Commit to outcome (manual)revealResolution()- Reveal committed outcomeoracleResolve()- Resolve via oracle data
3. Treasury - The Bank
Address: 0x5BCa2465a870bb0E9eaEC70256D747a48aa388E5
Manages all platform fees and token burns:
- Collects platform fees (5% of losing pools)
- Handles ORMT token burns (2000 per market)
- Distributes fees to stakeholders
- Manages revenue sharing
Key Functions:
collectFees()- Collect fees from resolved marketsburnORMT()- Burn ORMT for market creationdistributeFees()- Distribute collected feeswithdrawFees()- Admin fee withdrawal
4. AutomatedOracle - The Data Provider
Address: 0xc3D6365491A4d83a87351D0323F90bD9d8bFC1Ac
Fetches real-world data for automated resolution:
- Integrates with Chainlink price feeds
- Supports UMA Protocol for disputes
- Provides price data for oracle markets
- Handles data validation
Key Functions:
getPrice()- Fetch current price for assetresolveWithPrice()- Resolve market using price dataupdatePriceFeed()- Update oracle configurationvalidatePrice()- Verify price data integrity
Contract Interactions
Creating a Market Flow
Bet Placement Flow
Market Resolution Flow
Security Features
Access Control
- Role-based permissions (Owner, Admin, Resolver)
- Multi-sig wallet for critical operations
- Time-locked admin functions
Safety Mechanisms
- Reentrancy guards on all state-changing functions
- Emergency pause mechanism
- Maximum fee limits (25% total)
- Minimum bet amounts
Validation
- Input sanitization on all parameters
- Market state checks before operations
- Balance verification before transfers
- Outcome validation on resolution
Test Coverage
Overall: 161/161 tests passing (100%)
CoreMarket
- Market creation: 25 tests
- Bet placement: 30 tests
- Winnings claims: 20 tests
- Edge cases: 15 tests
ResolutionEngine
- Manual resolution: 20 tests
- Oracle resolution: 18 tests
- VRF resolution: 12 tests
- Edge cases: 10 tests
Treasury
- Fee collection: 8 tests
- Token burns: 7 tests
- Distribution: 5 tests
AutomatedOracle
- Price feeds: 6 tests
- Data validation: 5 tests
Gas Costs
| Operation | Gas Cost | USD (@ 20 gwei, $3000 ETH) |
|---|---|---|
| Create Market | ~200,000 | ~$12 |
| Place Bet | ~80,000 | ~$5 |
| Claim Winnings | ~60,000 | ~$4 |
| Resolve Market | ~100,000 | ~$6 |
Deployment Addresses
NPM Package
Install the official contracts package to interact with OracleMart:
npm install @oraclemart/contractsPackage: @oraclemart/contracts
Sepolia Testnet (Chain ID: 11155111)
{
CoreMarket: "0x36b5ebE5a161E7d1C7B75aBce457d7066d87e6DB",
ResolutionEngine: "0xdD2DBd78d4D260321735d45EF32Df965c962Ab7F",
Treasury: "0x5BCa2465a870bb0E9eaEC70256D747a48aa388E5",
AutomatedOracle: "0xc3D6365491A4d83a87351D0323F90bD9d8bFC1Ac",
ORMT: "0x5a7AD6C7ad82b163A3B561C77435B6354Cb030F1"
}Mainnet (Coming Soon)
Production deployment addresses will be announced after external audit completion.