Skip to main content

Process map

Data flow at create-time

  1. User pastes an X URL → POST /posts/evaluate.
  2. API pulls the tweet (RapidAPI), runs the gatekeeper model (TEE) for an eligible: bool + score.
  3. If eligible, the writer model drafts the proposal: { question, description, resolutionCriteria, resolutionDate, judgePrompt, aiProbability }.
  4. The judge prompt is uploaded to 0G Storage; the API persists the proposal in SQLite keyed by the resulting merkle root.
  5. The user reviews and signs MarketFactory.createMarket(...). In one transaction the factory:
    • Clones a PredictionMarket (EIP-1167 minimal proxy).
    • Deploys a fresh Treasury whose principal is the new market.
    • Deploys a GimoAdapter wired to that Treasury.
    • Enables the adapter on the Treasury and hands ownership to the factory owner.
    • Initializes the market with the merkle root and the Treasury address.

Data flow at resolve-time

  1. Judge worker calls startResolving() on every market past resolutionDate.
  2. For each market in Resolving status, it pulls the sealed prompt back from 0G Storage and runs the judge model in TEE.
  3. The TEE provider signs keccak256(abi.encode(DOMAIN_TAG, chainId, resolver, market, outcome, attestationHash, nonce)).
  4. Worker submits AIResolver.submitResolution(market, outcome, attestationHash, proof).
  5. AIResolver verifies the signature on-chain and forwards resolve(outcome, attestationHash) to the market.
  6. The market recalls liquid funds from its Treasury and snapshots the 80/20 yield split.
See Yield economics for the math behind step 6.