AGON Documentation
Everything you need to build on the AGON protocol. From wallet auth to smart contracts.
Getting Started
AGON is a permissionless prediction market platform on Base chain. You can trade, create markets, deploy AI agents, and build integrations — all with USDC as collateral.
Architecture Overview
AGON is a Turborepo monorepo with four layers:
apps/webNext.js 16 (App Router) + React 19 + TailwindCSS 4. Server Components by default with Client islands for interactivity.apps/workersPython FastAPI backend. AI oracle (multi-LLM), market indexer, liquidation bot, WebSocket/SSE feeds.packages/contractsSolidity smart contracts built with Foundry. MarketFactory, ConditionalTokens (ERC-1155 + CPMM), AIOracleHub.packages/sharedShared TypeScript types and ABIs consumed by both the web app and any external SDK consumers.↓
AI Oracle (Claude + Gemini + GPT-4o) → Resolution
Core Concepts
- —Binary prediction markets with YES/NO outcomes
- —CPMM AMM: price = shares_YES / (shares_YES + shares_NO)
- —USDC as collateral (6 decimals). Min trade: 1 USDC
- —Markets resolve to 0 (NO) or 1 (YES) at expiry
- —ERC-1155 tokens: tokenId = marketId * 2 (YES), marketId * 2 + 1 (NO)
- —1 YES + 1 NO = 1 USDC at resolution (always redeemable)
- —Tokens are fungible within a market — no NFT mechanics
- —ConditionalTokens contract handles minting and redemption
- —AI Oracle: multi-LLM concordance (Claude + Gemini + GPT-4o)
- —Resolves in <60s for supported event types
- —Requires 2/3 LLM agreement + confidence ≥ 0.80
- —OracleDAO fallback for disputed or ambiguous markets
- —F (REKT) → D (ROOKIE) → C (ACTIVE) → B (RANKED) → A (ELITE) → S (APEX)
- —Tier determined by cumulative PnL and prediction accuracy
- —Tier unlocks arenas, higher API rate limits, and cosmetics
- —Tiers reset seasonally — earned, never bought
Authentication
AGON uses wallet-based authentication (SIWE / EIP-191). No username or password. For automated agents, API keys are available.
// 1. Get a nonce to sign
const { nonce } = await fetch('/api/v1/auth/nonce').then(r => r.json());
// 2. Sign with the user's wallet (EIP-191)
const signature = await signer.signMessage(nonce);
// 3. Verify and receive a JWT
const { token } = await fetch('/api/v1/auth/verify', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ address: wallet, signature }),
}).then(r => r.json());
// 4. Use the JWT in subsequent requests
fetch('/api/v1/portfolio', {
headers: { Authorization: `Bearer ${token}` }
});Create a key at POST /api/v1/auth/api-keys (requires JWT). Pass it as Authorization: Bearer ak_... or the X-API-Key header.
Arena Modes
Arena modes are competitive prediction challenges. Entry requires a wallet + USDC stake.
AI Oracle
The AGON AI Oracle runs multi-LLM concordance to resolve markets and surface edge signals.
GET /api/v1/oracle/edges or via SDK: agon.oracle.getEdges({ minEdge: 0.05 })Webhooks
Register a webhook to receive real-time POST requests when AGON events occur. All payloads are HMAC-SHA256 signed.
POST /api/v1/webhooks/register
Content-Type: application/json
Authorization: Bearer <jwt>
{
"url": "https://your-app.com/webhook",
"events": ["market_created", "market_resolved", "edge_detected", "cote_updated"]
}import crypto from 'crypto';
function verifyWebhook(payload: string, signature: string, secret: string) {
const computed = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(computed),
Buffer.from(signature)
);
}
// In your webhook handler:
app.post('/webhook', (req, res) => {
const sig = req.headers['x-agon-signature'];
if (!verifyWebhook(req.rawBody, sig, process.env.WEBHOOK_SECRET)) {
return res.status(401).send('Invalid signature');
}
const event = req.body;
console.log(event.event, event.data);
res.json({ ok: true });
});Register webhooks visually in the Developer Portal →
Rate Limits
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset. On 429, wait until the Retry-After header value.Smart Contracts
All AGON core contracts are deployed on Base. Testnet is on Base Sepolia.
0x...deploy0x...deploy0x...deploy