Smart Contracts Reference
Complete reference for all Oracle AI smart contracts.
Contract Overview
| Contract | Purpose |
|---|---|
OracleToken | ERC-20 governance token |
OutcomeToken | ERC-1155 for YES/NO positions |
MarketFactory | Creates new prediction markets |
PredictionMarket | Individual market logic with AMM |
ResolverRegistry | Resolver staking and reputation |
ResolutionEngine | Commit-reveal consensus |
OracleToken.sol
The ORACLE token is an ERC-20 with burn functionality, transaction limits, and Uniswap V3 integration.
Token Parameters
| Parameter | Value |
|---|---|
| Name | Oracle AI |
| Symbol | ORACLE |
| Decimals | 18 |
| Total Supply | 1,000,000,000 |
| Mintable | No |
| Burnable | Yes (authorized) |
| Max Transaction | 2% (20,000,000) |
| Max Wallet | 2% (20,000,000) |
Uniswap V3 Integration
| Contract | Address |
|---|---|
| Router | 0xE592427A0AEce92De3Edee1F18E0157C05861564 |
| Factory | 0x1F98431c8aD98523631AE4a59f267346ea31F984 |
| Position Manager | 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 |
Key Functions
// Authorize a contract to burn tokens
function authorizeBurner(address burner) external onlyOwner
// Burn tokens from an address (only authorized)
function burn(address from, uint256 amount) external
// Enable trading (one-time, after liquidity added)
function enableTrading() external onlyOwner
// Set an address as AMM pair (excluded from max wallet)
function setAMMPair(address pair, bool isAMM) external onlyOwner
// Exclude address from tx/wallet limits
function setExcludedFromLimits(address account, bool excluded) external onlyOwner
// Remove limits permanently (irreversible)
function removeLimits() external onlyOwner
OutcomeToken.sol
ERC-1155 multi-token for market positions.
- Token ID 0: YES tokens
- Token ID 1: NO tokens
Key Functions
// Mint outcome tokens (only authorized markets)
function mint(address to, uint256 id, uint256 amount) external
// Burn outcome tokens
function burn(address from, uint256 id, uint256 amount) external
MarketFactory.sol
Creates and tracks prediction markets.
Parameters
| Parameter | Value |
|---|---|
| Creation Fee | 10,000 ORACLE (burned) |
Key Functions
// Create a new prediction market
function createMarket(
string memory question,
string memory resolutionCriteria,
uint256 deadline,
uint256 initialLiquidity,
string[] memory evidenceUrls
) external returns (address)
// Get paginated market list
function getMarkets(uint256 start, uint256 count)
external view returns (address[] memory)
PredictionMarket.sol
Individual market with AMM trading.
Market States
enum State {
TRADING, // Active trading
RESOLUTION, // Awaiting AI resolution
FINALIZED, // Outcome determined
SETTLED // All claims processed
}
Key Functions
// Buy outcome tokens
function buy(bool isYes, uint256 amount) external
// Sell outcome tokens
function sell(bool isYes, uint256 amount) external
// Get price quote
function getQuote(bool isYes, uint256 amount)
public view returns (uint256)
// Redeem winning tokens after resolution
function redeem() external
AMM Pricing
Uses constant product formula: x × y = k
cost = (reserveIn × amount) / (reserveOut - amount)
ResolverRegistry.sol
Manages resolver staking and reputation.
Parameters
| Parameter | Value |
|---|---|
| Minimum Stake | 100,000 ORACLE |
| Slash Percentage | 10% |
Key Functions
// Stake to become a resolver
function stake(uint256 amount) external
// Withdraw stake
function unstake(uint256 amount) external
// Check if address is active resolver
function isActiveResolver(address resolver)
external view returns (bool)
// Get resolver's stake
function getResolverStake(address resolver)
external view returns (uint256)
ResolutionEngine.sol
Coordinates commit-reveal consensus.
Parameters
| Parameter | Value |
|---|---|
| Commit Period | 24 hours |
| Reveal Period | 24 hours |
| Supermajority | 67% |
Key Functions
// Start resolution for a market
function initiateResolution(uint256 marketId) external
// Submit commitment during commit phase
function submitCommitment(
uint256 marketId,
bytes32 commitHash,
uint256 stakeAmount
) external
// Reveal outcome during reveal phase
function revealOutcome(
uint256 marketId,
Outcome outcome,
bytes32 salt,
bytes32 evidenceHash
) external
// Generate commitment hash
function generateCommitHash(
Outcome outcome,
bytes32 salt,
address resolver
) public pure returns (bytes32)
// Finalize resolution after reveal period
function finalize(uint256 marketId) external
Was this page helpful?