Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.signalium.site/llms.txt

Use this file to discover all available pages before exploring further.

                       ┌────────────────────────┐
                       │       apps/web         │  Next.js 15 + Reown AppKit + HeroUI v3
        paste tweet →  │  /create  /m/[address] │
                       └─────────┬──────────────┘
                                 │ HTTP
                       ┌─────────▼──────────────┐
                       │       apps/api         │  Bun + Hono
   X post fetch via    │  /posts/evaluate       │  ├─ X-posts service (RapidAPI)
   twitter241,         │  /markets, /price/0g   │  ├─ gatekeeper (0G Compute TEE)
   CoinGecko 0G price  │  /users/:addr/positions│  └─ SQLite cache (proposals, posts, USD)
                       └─────────┬──────────────┘
                                 │ contract calls (viem)
                       ┌─────────▼──────────────┐
                       │  0G Chain (mainnet)    │  EVM, sub-second finality
                       │  MarketFactory ─────┬──┤  EIP-1167 clones
                       │  AIResolver         │  │  ECDSA-verifies TEE receipts
                       │  PredictionMarket × N  │  Parimutuel YES/NO
                       │     ├─ Treasury × N    │  ├─ reserve floor + adapter allowlist
                       │     └─ GimoAdapter × N │  └─ st0G liquid staking
                       └─────────▲──────────────┘
                                 │ submitResolution()
                       ┌─────────┴──────────────┐
                       │  apps/judge-worker     │  Bun cron worker
                       │  discover → judge      │  ├─ paginates factory
                       │  → sign → submit       │  ├─ judge runs in 0G Compute TEE
                       └────────────────────────┘  └─ signs domain-separated digest

Process map

TierProcessTechNotes
Frontendsignalium-webNext.js 15, Reown AppKit, wagmi, viem, HeroUI v3, TanStack QueryReads markets via API, places bets directly via wallet
Backendsignalium-apiBun + Hono, SQLite (WAL)Caches X post metadata, AI proposals, 0G/USD price
Workersignalium-judge-workerBun cronSweeps factory for matured markets, runs judge in TEE, posts on-chain
IndexerGoldsky subgraphAssemblyScript handlersIndexes factory + per-market events including yield snapshots
Chain0G mainnet (16661)EVMMarkets, treasuries, adapters; Gimo StakePool is a third-party dependency

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.