Integration

Creating a Prediction Market via SDK

Developers can programmatically spawn new markets using the @cognifi/sdk. This is useful for DAOs that want to automate their own KPI tracking.

TypeScript Example:

import { CogniFiSDK, MarketType } from '@cognifi/sdk';

const sdk = new CogniFiSDK(connection, wallet);

// Initialize a new binary market
const marketId = await sdk.createMarket({
  question: "Will $BONK flip $WIF by December 31st?",
  type: MarketType.BINARY, // YES or NO
  resolutionSource: "https://api.coingecko.com/...", // Or Chainlink Feed ID
  resolutionTime: 1735689600, // Unix Timestamp
  initialLiquidity: 10, // Amount of SOL to seed liquidity (sets 'b')
  tags: ["meme", "flippening"]
});

console.log(`Market created at: ${marketId.toBase58()}`);

Resolving Disputes (UMA Integration)

If the automated resolution is challenged, the system falls back to a manual dispute process. This can be integrated with UMA's Data Verification Mechanism (DVM) or a custom DAO vote.

Raising a Dispute:

This action freezes the market payouts and triggers the governance committee or UMA OO (Optimistic Oracle) to review the data manually. If the disputer is correct, they receive their bond back plus a reward from the Agent's stake.

Last updated