Skip to main content

Contract Overview

The DelphAI contract provides an AI-powered resolution oracle for prediction markets. Platforms can create markets on DelphAI by paying a creation fee, and the AI resolver will automatically resolve them at the scheduled time.

Contract Addresses

Market Functions

createMarket

Create a new prediction market with AI resolution.
Parameters:
  • question - The market question
  • description - Additional context and resolution criteria
  • possibleOutcomes - Array of possible outcome strings (minimum 2)
  • resolutionTimestamp - Unix timestamp when AI should resolve the market
Returns:
  • marketId - Unique identifier for the created market
Requirements:
  • msg.value must be greater than or equal to marketCreationFee
  • question must not be empty
  • possibleOutcomes must have at least 2 options
  • resolutionTimestamp must be in the future
Example:
Emits: MarketCreated event

resolveMarket

Resolve a market with AI-generated outcome (only resolver).
Parameters:
  • marketId - The market to resolve
  • outcomeIndex - Index of the winning outcome in possibleOutcomes array
  • resolutionData - AI explanation and reasoning for the resolution
  • resolutionSources - Array of source URLs used for resolution
  • resolutionConfidence - Confidence level of the resolution (0-100)
  • proofData - TEE attestation or cryptographic proof (future feature)
Requirements:
  • Only callable by authorized resolver address
  • Market must exist and be in Open status
  • Current time must be greater than or equal to resolutionTimestamp
  • outcomeIndex must be valid
  • resolutionConfidence must be between 0 and 100
Emits: MarketResolved event

cancelMarket

Cancel an open market (only creator or owner).
Parameters:
  • marketId - The market to cancel
Requirements:
  • Caller must be market creator or contract owner
  • Market must be in Open status
Emits: MarketCancelled event

View Functions

getMarket

Get complete market details.
Returns: Complete market data structure with all fields

marketCreationFee

Get the current market creation fee.
Returns: Fee amount in wei (BNB)

resolver

Get the current authorized resolver address.

marketCounter

Get the total number of markets created.

getContractBalance

Get the contract BNB balance.

Admin Functions

These functions are restricted to the contract owner.

setMarketCreationFee

Update the market creation fee.
Emits: FeeUpdated event

setResolver

Update the authorized resolver address.
Emits: ResolverUpdated event

withdrawFees

Withdraw accumulated creation fees.
Emits: FeesWithdrawn event

recoverERC20

Recover ERC20 tokens sent to contract by mistake.
Emits: TokensRecovered event

Market States

DelphAI markets have 3 possible states:

Next Steps

Events Reference

Complete list of contract events

Integration Guide

Step-by-step integration tutorial

Market Lifecycle

Understand the complete market lifecycle

Examples

View integration examples on GitHub