> ## 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.

# 0G integration

> Which 0G primitives Signalium uses and what each one solves.

Signalium leans on three layers of the 0G stack plus the Gimo Finance LST that runs on top of 0G Chain.

## 0G Chain (`chainId 16661`)

* **Hosts every market.** `MarketFactory` deploys EIP-1167 clones of `PredictionMarket` plus a fresh `Treasury` and `GimoAdapter` per market in a single transaction.
* **Sub-second finality + cheap gas** make per-market provisioning practical (\~0.005 0G per market) and let bets feel instant.
* The `AIResolver` contract verifies TEE provider signatures on-chain via `ecrecover` against an allowlist before forwarding to the market.

## 0G Compute (TEE)

Three roles share the same OpenAI-compatible inference endpoint, swapped in at runtime via the `OG_COMPUTE_PROVIDER_URL` / `OG_COMPUTE_API_KEY` config:

| Role       | Where it runs                       | What it does                                                                                        |
| ---------- | ----------------------------------- | --------------------------------------------------------------------------------------------------- |
| Gatekeeper | `apps/api` (`POST /posts/evaluate`) | Scores tweets on falsifiability / clarity / specificity / signal / novelty; rejects unsuitable ones |
| Writer     | `apps/api` (`POST /posts/evaluate`) | Drafts `{ question, description, resolutionCriteria, judgePrompt, aiProbability }`                  |
| Judge      | `apps/judge-worker`                 | Re-runs the **frozen** judge prompt at `resolutionDate`, signs the verdict                          |

Because the judge runs in TEE, the operator can't quietly swap the model output. Only the allowlisted TEE provider key can produce a signature `AIResolver` accepts.

## 0G Storage

The judge prompt — the deterministic instructions the judge model will read at resolution time — is sealed to 0G Storage at market creation. Only its merkle root lives on-chain (in the market's `judgeStorageRoot` field). At resolve time the worker pulls the full prompt back, runs the judge, and submits the resolution receipt's merkle root as `attestationHash`. Anyone can re-fetch and audit.

## Gimo Finance (`StakePool` at `0xAc06d1Df23a4Fa00981aFAC0f33A5936Bd2135aF`)

Built on 0G Chain — StaFi LSaaS architecture. Native 0G in → `st0G` out; the rate appreciates over time. Each market's `Treasury` owns a `GimoAdapter` instance that:

* Calls `stake(referrer)` on deposit and holds `st0G` shares.
* Calls `unstake(lsdAmount)` to start the \~3 day unbonding queue (3 eras × 86400s).
* Calls `withdraw()` to claim matured tickets back as native 0G.

The API samples `getRate()` hourly and exposes a derived APY at [`/price/og-yield`](/api-reference/price), which the bet panel uses to project the yield a market will earn between now and resolution. Until enough samples accumulate, the projection falls back to a 5% default that matches the SDK constant.

See [`GimoAdapter`](/contracts/gimo-adapter) for the full interface and edge cases.
