PakoMarket uses a combination of on-chain data and IPFS for market information. All data is read directly from the blockchain using viem/wagmi.
- Factory:
TBD - USDC:
TBD
- Factory:
TBD - USDC:
TBD
// Get all markets
const { markets, isLoading, error } = useMarkets();
// Get market by ID
const market = await getMarket(marketId);// Trade Yes/No shares
const { trade, isLoading, error } = useTrade();
await trade({
marketId: "0x...",
side: "yes", // or "no"
amount: 1000000, // $1 USDC (6 decimals)
slippage: 1, // 1%
deadline: 1800 // 30 minutes
});
// Cashout shares
const { cashout, isLoading, error } = useCashout();
await cashout({
marketId: "0x...",
side: "yes",
shares: 1000000,
minAmount: 500000 // minimum USDC to receive
});// Resolve market (admin only)
const { resolve, isLoading, error } = useResolve();
await resolve({
marketId: "0x...",
outcome: true, // true for Yes, false for No
evidenceCid: "Qm...", // IPFS CID with evidence
sourceUrls: ["https://..."] // source URLs
});MarketCreated(address indexed market, address indexed creator, string question, uint256 endTime, uint256 initialLiquidity)Traded(address indexed user, uint256 side, uint256 amount, uint256 shares, uint256 price)Cashout(address indexed user, uint256 side, uint256 shares, uint256 amount)PreliminaryResult(bool outcome, string resolutionCid)Disputed(address indexed disputer, string reason)Finalized(bool outcome, string resolutionCid)Redeemed(address indexed user, uint256 amount)
{
"question": "Will Nigeria win the next AFCON?",
"description": "Full description of the market",
"category": "sports",
"close_time_utc": "2024-02-25T17:00:00Z",
"resolution": {
"primary_source": "CAF Official Website",
"backup_sources": ["BBC Sport", "ESPN"],
"invalid_conditions": ["postponed > 30 days", "cancelled"]
}
}{
"outcome": true,
"source_urls": ["https://cafonline.com/..."],
"note": "Official CAF announcement",
"screenshots": ["bafy..."],
"posted_at": "2024-02-26T10:14:00Z"
}All SDK methods return standardized error objects:
interface Error {
code: string;
message: string;
details?: any;
}Common error codes:
INSUFFICIENT_BALANCEMARKET_CLOSEDSLIPPAGE_TOO_HIGHINVALID_MARKETUNAUTHORIZED