Contract Functions
Complete reference for all public functions.
User Functions
deposit
Deposit USDC to your trading balance.
function deposit(uint256 amount) externalRequires USDC approval first
Amount in USDC units (6 decimals)
withdraw
Withdraw USDC from trading balance to wallet.
function withdraw(uint256 amount) externalCannot exceed your balance
Sent directly to msg.sender
buyShares
Buy YES or NO shares in a market.
function buyShares(uint256 marketId, bool isYes, uint256 amount) externalisYes: true for YES, false for NOamount: USDC to spend (before fees)2% fee deducted automatically
sellShares
Sell shares back to the AMM.
function sellShares(uint256 marketId, bool isYes, uint256 shares) externalMust have enough shares
Receives USDC at current market price
claimWinnings
Claim payout from a resolved market.
function claimWinnings(uint256 marketId) externalOnly works if you hold winning shares
Adds USDC to your trading balance
Resolution Functions
proposeOutcome
Propose the outcome of an expired market.
function proposeOutcome(uint256 marketId, bool outcome) externalRequires proposal bond (5 USDC from balance)
outcome: true for YES, false for NOStarts 24-hour challenge period
challengeOutcome
Challenge the current proposed outcome.
function challengeOutcome(uint256 marketId) externalRequires challenge bond (10 USDC, escalates)
Flips the proposed outcome
Resets challenge period
finalizeOutcome
Finalize outcome after challenge period.
function finalizeOutcome(uint256 marketId) externalAnyone can call
Challenge period must be over
Distributes bonds to correct proposer
Market Creation
createMarket
Create a new prediction market.
function createMarket(
string calldata question,
string calldata category,
uint256 deadline,
string calldata resolutionSource
) externalRequires 100 USDC for initial liquidity
Deadline must be in the future
Returns new market ID
View Functions
getMarket
Get full market details.
function getMarket(uint256 marketId) external view returns (Market memory)getPosition
Get user's position in a market.
function getPosition(uint256 marketId, address user) external view returns (Position memory)getPrice
Get current share prices.
function getPrice(uint256 marketId) external view returns (uint256 yesPrice, uint256 noPrice)Prices returned in basis points (5000 = $0.50).
Last updated
