{
  "openapi": "3.1.0",
  "info": {
    "title": "Launchpad public read API",
    "version": "1",
    "summary": "Read-only display and discovery data for Launchpad coins on Robinhood Chain.",
    "description": "Read-only JSON endpoints served by the Launchpad web app. They return display hints computed from an index, a stored snapshot or sampled chain reads. The index and snapshot endpoints tag each answer with the block it was read at (`asOf`, `meta.coverage.indexed`); the history endpoints carry only each sample's block time, and `/api/health` carries none. They never prove a deployment, a balance, a right or that a transaction will succeed.\n\nRules for every client:\n\n- Treat every value as a hint valid at the block or sample time it names, not as current state.\n- `status: \"unknown\"` (or `unavailable`) means the server could not give a complete, canonical answer. Never read it as 0, empty or \"no results\". Fall back to reading the chain.\n- Before signing anything, re-read the relevant contract views on chain at a fresh block, verify the coin's deployment identity (contract addresses and code) against its published deployment manifest, and simulate the transaction. The official SDK, when available to you, does these reads and checks.\n- The indexer-backed endpoints answer 404 while the operator has not enabled the index. Treat 404 there as \"feature off\", not as \"coin not found\".\n- Limits are per client IP (IPv4 address, or IPv6 /64), counted per endpoint in a fixed one-minute window (see `x-rate-limits`). On 429, wait for `Retry-After` seconds.\n\nAll amounts and block numbers are decimal strings (they exceed 2^53). Addresses and hashes are lower-case 0x hex unless noted. `*Wad` values have 18 decimals; `*Raw` USDG values have 6 decimals.\n\nA client for these endpoints is being added to the official SDK in a separate change; until then, call the endpoints directly.",
    "license": { "name": "All rights reserved" }
  },
  "servers": [{ "url": "/", "description": "The origin that serves this file." }],
  "tags": [
    { "name": "discover", "description": "Coin lists and search across the indexed factory." },
    { "name": "positions", "description": "Candidate coins for an account." },
    { "name": "coin", "description": "Per-coin history and governance." },
    { "name": "treasury", "description": "Platform-wide Total treasury." },
    {
      "name": "app-internal",
      "description": "Used by the Launchpad mobile app. Documented for completeness; shapes may change without notice and are not intended for third parties."
    },
    { "name": "health", "description": "Platform health check." }
  ],
  "x-rate-limits": {
    "description": "Per client key (IPv4 address, or IPv6 /64; an IPv4-mapped IPv6 counts as the IPv4), per endpoint, per fixed one-minute window. When the operator configures the shared counter database, the count is shared across server instances; otherwise (or while that database fails) each server process counts on its own, and a process already tracking 10000 clients answers 429 to new ones. The base rate is the operator setting LAUNCHPAD_INDEXER_RATE_PER_MINUTE (default 20, maximum 10000). The mobile app's endpoints use the base rate times mobileScale; portfolio continuation pages use base times mobileScale times 10. Over the limit: HTTP 429 with Retry-After: 60.",
    "defaultPerMinute": 20,
    "mobileScale": 5,
    "mobileContinuationScale": 50,
    "retryAfterSeconds": 60,
    "historyConcurrency": {
      "description": "The per-coin history endpoints are not counted per IP; each server process runs at most 2 at once and answers 429 with Retry-After: 2 when busy.",
      "maxConcurrent": 2,
      "retryAfterSeconds": 2
    }
  },
  "paths": {
    "/api/health": {
      "get": {
        "tags": ["health"],
        "operationId": "health",
        "summary": "Platform health check",
        "description": "Answers `ok` without reading the chain. It says only that the web process is up.",
        "responses": {
          "200": {
            "description": "The process is up.",
            "content": { "text/plain": { "schema": { "type": "string", "const": "ok" } } }
          }
        }
      }
    },
    "/api/discover/search": {
      "get": {
        "tags": ["discover"],
        "operationId": "discoverSearch",
        "summary": "Discover list (filter/sort/cursor), home rows, or text search",
        "description": "Three modes, chosen by the query:\n\n1. **Home** — `view=home` and no other parameter: Trending, New, Ending soon and Live trading, up to 5 coins each. The latter three share card block B2; Trending has an independent purchase block B1.\n2. **List** — `filter` present: every launch of the indexed factory at one snapshot block B, filtered, sorted and paged (at most 32 per page). Card state and Treasury are B2's values; purchases24h uses the separate trending.asOf purchase block B1. Pass `nextCursor` back as `cursor` with the same `filter`, `sort`, `q`, `stock` and `limit` to read the next page at the same B.\n3. **Search** — neither `filter` nor `view`: `q` and/or `stock` (at least one) matched against verified catalogue entries whose Token address the subgraph confirms, newest first, at most 50.\n\nList and home answer from the stored Discover index snapshot only. It is served only while its block is at most 5 minutes old and still canonical (its hash is re-checked against the chain); otherwise the answer is `unknown` (`stale`, `reorged`, `not_indexed`). The newest 3 snapshots are kept; a cursor whose snapshot is gone, or older than 5 minutes, answers `unknown` with reason `expired`: start again from the first page.\n\nA cursor is bound to its snapshot's block hash and to `filter`, `sort`, `q`, `stock` and `limit`; reusing it with other parameters, or an offset past the end, is 400.\n\nIn the list, `treasuryRfvWad: null` means unknown, never 0 (sorts last): a Trading coin with a catalogue record whose identity check failed at B, or whose Treasury could not be read. The field is absent when the coin is not valued (not Trading, or no catalogue record matching the registry). `official` is true only for a Trading coin whose deployment record verified at B and whose stock target is registered. A search match is a verified deployment record, not an official listing.\n\nTrending counts unique executing accounts purchasing through Genesis and USDG Bond in (B1.timestamp - 86400, B1.timestamp], ordered by buyers, gross USDG paid, then numeric coin ID. Accounts are deduplicated across both sources; refunds are not deducted. All coin states may appear. DEX, transfers, claims and inverse purchases are excluded. Stored aggregates are schema/version pinned; requests never scan purchase events. A missing, stale (over 5 minutes), incomplete or noncanonical aggregate yields Trending unknown while other home rows remain available. All ranked cards must be available. B1 may be newer than B2; their metadata stays separate. A ready empty ranking means no purchase activity. Trending cursors also bind the ranking generation and B1; a changed ranking expires them.",
        "parameters": [
          {
            "name": "view",
            "in": "query",
            "description": "`home` for the four home rows. Must be the only parameter.",
            "schema": { "type": "string", "enum": ["home"] }
          },
          {
            "name": "filter",
            "in": "query",
            "description": "Selects list mode. `ending`: Genesis coins whose sale deadline is after B and whose raise has not reached the hard cap. `Trading`: live trading. `official`: see description.",
            "schema": { "$ref": "#/components/schemas/CoinFilter" }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "List mode only. Defaults to `deadline` for `ending`, `rfv` (Treasury, descending) for `Trading`, else `new`. Unread values sort last, never as 0. For `filter=trending`, only `sort=trending` is accepted (the default).",
            "schema": { "type": "string", "enum": ["new", "deadline", "rfv", "trending"] }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Case-insensitive text (trimmed, at most 64 characters) matched against name, ticker, stock target, address and coin ID.",
            "schema": { "type": "string", "maxLength": 64 }
          },
          {
            "name": "stock",
            "in": "query",
            "description": "A stock target's securityId (bytes32 hex).",
            "schema": { "$ref": "#/components/schemas/Bytes32" }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "List mode page size, 1-32. Default 32.",
            "schema": { "type": "integer", "minimum": 1, "maximum": 32, "default": 32 }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "List mode: the previous answer's `nextCursor`, `<block>.<offset>.<digest>` (opaque; do not construct).",
            "schema": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,18}\\.(0|[1-9][0-9]{0,5})\\.[0-9a-f]{16}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A ready answer for the mode, or `unknown`. List/home `unknown` reasons: `not_indexed`, `stale`, `reorged`, `expired`. Search `unknown` reasons: any IndexUnknownReason.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    { "$ref": "#/components/schemas/DiscoverList" },
                    { "$ref": "#/components/schemas/CoinSearch" },
                    { "$ref": "#/components/schemas/IndexUnknown" }
                  ]
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/InvalidRequest" },
          "404": { "$ref": "#/components/responses/IndexerOff" },
          "429": { "$ref": "#/components/responses/IndexRateLimited" },
          "503": { "$ref": "#/components/responses/IndexUnavailable" }
        }
      }
    },
    "/api/positions/candidates": {
      "post": {
        "tags": ["positions"],
        "operationId": "positionCandidates",
        "summary": "Candidate coins an account may hold",
        "description": "Coins of the indexed factory that past events tied to the account, at the subgraph's indexed block `asOf`. A candidate is not a balance, a right or a deployment proof: read each one on chain. `unindexed` counts catalogue coins of other factories, which this index does not cover; check those separately. The account goes in the body, never the URL. The body is at most 256 bytes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": ["account"],
                "properties": { "account": { "$ref": "#/components/schemas/Address" } }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ready, or `unknown` (never \"no coins\").",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    { "$ref": "#/components/schemas/PositionCandidates" },
                    { "$ref": "#/components/schemas/IndexUnknown" }
                  ]
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/InvalidRequest" },
          "404": { "$ref": "#/components/responses/IndexerOff" },
          "429": { "$ref": "#/components/responses/IndexRateLimited" },
          "503": { "$ref": "#/components/responses/IndexUnavailable" }
        }
      }
    },
    "/api/coins/{chainId}/{factory}/{coinId}/governance-proposals": {
      "get": {
        "tags": ["coin"],
        "operationId": "governanceProposals",
        "summary": "A coin's Governance proposals and CTO / Creator recipient events",
        "description": "Newest first by (block, log index), 50 per page, all pages at one indexed block `asOf`. A row discovers a proposal and carries its payload; it is not its state. Check the payload against the proposal ID and read every state, vote and queue/execute condition on chain. A coin of another factory answers `unknown` with `not_indexed`. A cursor from another subgraph generation answers `unknown` with `expired`. `nextCursor: null` means the list is complete at `asOf`.",
        "parameters": [
          { "$ref": "#/components/parameters/ChainId" },
          { "$ref": "#/components/parameters/Factory" },
          { "$ref": "#/components/parameters/CoinId" },
          {
            "name": "cursor",
            "in": "query",
            "description": "The previous answer's `nextCursor`, `<generation>:<block>:<blockHash>:<timestamp>:<position>` (opaque; do not construct).",
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Ready, or `unknown` (never \"no proposals\").",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    { "$ref": "#/components/schemas/GovernanceProposals" },
                    { "$ref": "#/components/schemas/IndexUnknown" }
                  ]
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/InvalidRequest" },
          "404": {
            "description": "The indexer is off (`{\"error\":\"Not found\"}`), or the path is not a coin of this chain (`{\"error\":\"Unknown coin\"}`).",
            "headers": { "Cache-Control": { "$ref": "#/components/headers/NoStore" } },
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/Error" } }
            }
          },
          "429": { "$ref": "#/components/responses/IndexRateLimited" },
          "503": { "$ref": "#/components/responses/IndexUnavailable" }
        }
      }
    },
    "/api/coins/{chainId}/{factory}/{coinId}/treasury-history": {
      "get": {
        "tags": ["coin"],
        "operationId": "treasuryHistory",
        "summary": "A coin's Treasury total over time",
        "description": "Treasury `rfv()` sampled on a fixed grid since Genesis finalization, at most 40 points; the last point is the read block. The read block is the coin's stored verified snapshot block when one is valid, else the chain head after a full identity check. A sample whose read failed is left out, never drawn as 0. The stock reserve is not part of the Treasury. Before finalization the answer is ready with no points.",
        "parameters": [
          { "$ref": "#/components/parameters/ChainId" },
          { "$ref": "#/components/parameters/Factory" },
          { "$ref": "#/components/parameters/CoinId" }
        ],
        "responses": {
          "200": {
            "description": "Ready (Cache-Control: public, max-age=60) or `unavailable` (no-store).",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/TreasuryHistory" } }
            }
          },
          "404": { "$ref": "#/components/responses/UnknownCoin" },
          "429": { "$ref": "#/components/responses/HistoryBusy" },
          "503": { "$ref": "#/components/responses/HistoryUnavailable" }
        }
      }
    },
    "/api/coins/{chainId}/{factory}/{coinId}/reserve-history": {
      "get": {
        "tags": ["coin"],
        "operationId": "reserveHistory",
        "summary": "A coin's stock reserve over time",
        "description": "The stock reserve's counters sampled on the same grid as the Treasury history. Stock held is converted to shares with today's decimals and multiplier, so a split re-scales the past. The reserve is not backing and not part of the Treasury.",
        "parameters": [
          { "$ref": "#/components/parameters/ChainId" },
          { "$ref": "#/components/parameters/Factory" },
          { "$ref": "#/components/parameters/CoinId" }
        ],
        "responses": {
          "200": {
            "description": "Ready (Cache-Control: public, max-age=60) or `unavailable` (no-store).",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/ReserveHistory" } }
            }
          },
          "404": { "$ref": "#/components/responses/UnknownCoin" },
          "429": { "$ref": "#/components/responses/HistoryBusy" },
          "503": { "$ref": "#/components/responses/HistoryUnavailable" }
        }
      }
    },
    "/api/discover/total-treasury": {
      "get": {
        "tags": ["treasury"],
        "operationId": "totalTreasury",
        "summary": "Total treasury of all Trading coins",
        "description": "The stored sum of every Trading coin's Treasury `rfv()` at one block, read in one complete pass. Served only when every Trading coin was valued and the block is at most 5 minutes old; otherwise 503. No chain read happens on request.",
        "responses": {
          "200": {
            "description": "The complete total.",
            "headers": { "Cache-Control": { "$ref": "#/components/headers/NoStore" } },
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/TotalBacking" } }
            }
          },
          "503": {
            "description": "No complete, fresh total (unconfigured, incomplete, stale or read error).",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/Error" } }
            }
          }
        }
      }
    },
    "/api/discover/total-treasury/history": {
      "get": {
        "tags": ["treasury"],
        "operationId": "totalTreasuryHistory",
        "summary": "Daily Total treasury points",
        "description": "One point per UTC day: the last complete total stored that day, at most 366. A day without a complete total has no point (never 0 or the previous value). 503 when there is no point within the last 24 hours.",
        "responses": {
          "200": {
            "description": "Daily points (Cache-Control: public, max-age=60).",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/TotalBackingHistory" }
              }
            }
          },
          "503": {
            "description": "Unavailable.",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/Error" } }
            }
          }
        }
      }
    },
    "/api/mobile/market": {
      "get": {
        "tags": ["app-internal"],
        "operationId": "mobileMarket",
        "summary": "Market pages for the mobile app (app-internal)",
        "description": "Without `q`/`stock`: catalogue coins read from the registry page by page (not rate limited per IP). With `q` or `stock`: the same indexed search, gate and unknown answers as `/api/discover/search` search mode, plus `chainId`, limited at the base rate times 5. Transaction identities still require independent verification.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "description": "Registry mode: the previous page's `nextCursor`.",
            "schema": {
              "type": "string",
              "maxLength": 256,
              "pattern": "^\\d+\\.\\d+\\.\\d+\\.0x[\\da-fA-F]{64}$"
            }
          },
          { "name": "q", "in": "query", "schema": { "type": "string", "maxLength": 64 } },
          { "name": "stock", "in": "query", "schema": { "$ref": "#/components/schemas/Bytes32" } }
        ],
        "responses": {
          "200": {
            "description": "Registry mode: a market page or `{status: unavailable|error}`. Search mode: CoinSearch or `unknown`, with `chainId`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    { "$ref": "#/components/schemas/MobileMarket" },
                    { "$ref": "#/components/schemas/CoinSearch" },
                    { "$ref": "#/components/schemas/IndexUnknown" }
                  ]
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/InvalidRequest" },
          "404": { "$ref": "#/components/responses/IndexerOff" },
          "429": { "$ref": "#/components/responses/IndexRateLimited" },
          "503": {
            "description": "Read failed: `{version, chainId, status: \"error\"}` in registry mode, `unknown` in search mode.",
            "content": { "application/json": { "schema": { "type": "object" } } }
          }
        }
      }
    },
    "/api/mobile/portfolio": {
      "post": {
        "tags": ["app-internal"],
        "operationId": "mobilePortfolio",
        "summary": "An account's balances for the mobile app (app-internal)",
        "description": "Stateless on-chain balance reads, 4 catalogue coins per page. Continuation pages must send back the first page's `block` and `catalogueHash`; a catalogue changed between pages is 409 (start again). With `index: true` and the indexer on, pages cover the account's candidate coins plus coins of other factories; with the indexer off it is the catalogue read as without it; misconfigured, the catalogue read with `index.status: unknown`. The first page counts at the base rate times 5, continuations at times 50, each on its own counter. The body is at most 1024 bytes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/MobilePortfolioRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One page.",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/MobilePortfolio" } }
            }
          },
          "400": { "$ref": "#/components/responses/InvalidRequest" },
          "409": {
            "description": "The catalogue changed between pages: `{version: 1, status: \"changed\"}`.",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/MobileStatus" } }
            }
          },
          "429": {
            "description": "Limited (only with `index: true`): `{version: 1, status: \"limited\"}`. No read was made.",
            "headers": { "Retry-After": { "$ref": "#/components/headers/RetryAfter60" } },
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/MobileStatus" } }
            }
          },
          "503": {
            "description": "`{version: 1, status: \"unavailable\"}`.",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/MobileStatus" } }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "ChainId": {
        "name": "chainId",
        "in": "path",
        "required": true,
        "description": "The chain this server serves (4663 mainnet, 46630 testnet). Another chain is 404.",
        "schema": { "type": "string", "pattern": "^[0-9]+$" }
      },
      "Factory": {
        "name": "factory",
        "in": "path",
        "required": true,
        "description": "The LaunchFactory address (any case).",
        "schema": { "$ref": "#/components/schemas/Address" }
      },
      "CoinId": {
        "name": "coinId",
        "in": "path",
        "required": true,
        "description": "The registry coin ID (uint256, decimal, no leading zeros).",
        "schema": { "$ref": "#/components/schemas/Uint" }
      }
    },
    "headers": {
      "NoStore": { "schema": { "type": "string", "const": "no-store" } },
      "RetryAfter60": {
        "description": "Seconds to wait.",
        "schema": { "type": "string", "const": "60" }
      },
      "RetryAfter2": {
        "description": "Seconds to wait.",
        "schema": { "type": "string", "const": "2" }
      }
    },
    "responses": {
      "InvalidRequest": {
        "description": "Malformed parameters or body, or a cursor that does not belong to this query, e.g. `{\"error\":\"Invalid request\"}`.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "IndexerOff": {
        "description": "The operator has not enabled the index: `{\"error\":\"Not found\"}`. A feature flag, not a missing coin.",
        "headers": { "Cache-Control": { "$ref": "#/components/headers/NoStore" } },
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "IndexRateLimited": {
        "description": "Over the per-client limit. The body is the `unknown` answer with reason `read_failed`; nothing was read.",
        "headers": {
          "Retry-After": { "$ref": "#/components/headers/RetryAfter60" },
          "Cache-Control": { "$ref": "#/components/headers/NoStore" }
        },
        "content": {
          "application/json": { "schema": { "$ref": "#/components/schemas/IndexUnknown" } }
        }
      },
      "IndexUnavailable": {
        "description": "The index is misconfigured or the read failed: the `unknown` answer with reason `read_failed`.",
        "headers": { "Cache-Control": { "$ref": "#/components/headers/NoStore" } },
        "content": {
          "application/json": { "schema": { "$ref": "#/components/schemas/IndexUnknown" } }
        }
      },
      "UnknownCoin": {
        "description": "The path is not a coin of this chain: `{\"error\":\"Unknown coin\"}`.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "HistoryBusy": {
        "description": "This server process is already reading 2 histories: `{\"error\":\"History service is busy\"}`.",
        "headers": {
          "Retry-After": { "$ref": "#/components/headers/RetryAfter2" },
          "Cache-Control": { "$ref": "#/components/headers/NoStore" }
        },
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "HistoryUnavailable": {
        "description": "Unexpected read error: `{\"error\":\"History service unavailable\"}`.",
        "headers": { "Cache-Control": { "$ref": "#/components/headers/NoStore" } },
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": ["error"],
        "properties": { "error": { "type": "string" } }
      },
      "Address": { "type": "string", "pattern": "^0x[0-9a-fA-F]{40}$" },
      "Bytes32": { "type": "string", "pattern": "^0x[0-9a-fA-F]{64}$" },
      "Uint": {
        "type": "string",
        "pattern": "^(0|[1-9][0-9]*)$",
        "description": "A non-negative integer as a decimal string."
      },
      "BlockRef": {
        "type": "object",
        "description": "A block: number and Unix-seconds timestamp as decimal strings.",
        "required": ["number", "hash", "timestamp"],
        "properties": {
          "number": { "$ref": "#/components/schemas/Uint" },
          "hash": { "$ref": "#/components/schemas/Bytes32" },
          "timestamp": { "$ref": "#/components/schemas/Uint" }
        }
      },
      "IndexUnknownReason": {
        "type": "string",
        "description": "Why no complete, canonical answer exists. `deployment_mismatch`: the subgraph is not the pinned version or dataset. `backfilling`/`lagging`/`stale`/`incident`/`rebuilding`: the index's sync state. `not_indexed`: outside the index (another factory, not yet discovered, or no stored snapshot). `read_failed`: a read failed, or the request was rate limited. `budget_exceeded`: more rows than the server reads per request. `reorged`: the block left the chain. `expired`: the cursor's snapshot or generation is gone; start again. `not_hydrated`: a view read is queued.",
        "enum": [
          "deployment_mismatch",
          "backfilling",
          "lagging",
          "stale",
          "incident",
          "rebuilding",
          "not_indexed",
          "read_failed",
          "budget_exceeded",
          "reorged",
          "expired",
          "not_hydrated"
        ]
      },
      "IndexUnknown": {
        "type": "object",
        "description": "No complete answer. Never treat as 0 or empty. The mobile market variant also carries `chainId`.",
        "required": ["version", "status", "reason"],
        "properties": {
          "version": { "const": 1 },
          "status": { "const": "unknown" },
          "reason": { "$ref": "#/components/schemas/IndexUnknownReason" },
          "chainId": { "type": "integer" }
        }
      },
      "CoinFilter": {
        "type": "string",
        "enum": ["all", "trending", "new", "ending", "Genesis", "Trading", "official"]
      },
      "Lifecycle": {
        "type": "string",
        "enum": ["Genesis", "Trading", "Failed", "Refund", "Unknown"]
      },
      "WireCoin": {
        "type": "object",
        "description": "One Discover card: state and Treasury at the answer's card block B2; purchases24h at the separate trending.asOf B1.",
        "required": [
          "coinId",
          "name",
          "symbol",
          "securityId",
          "stockTarget",
          "lifecycle",
          "official",
          "launchedAt",
          "image"
        ],
        "properties": {
          "coinId": { "$ref": "#/components/schemas/Uint" },
          "name": { "type": "string" },
          "symbol": { "type": "string" },
          "securityId": { "$ref": "#/components/schemas/Bytes32" },
          "stockTarget": {
            "type": "string",
            "description": "The stock ticker, or a shortened securityId when unknown."
          },
          "lifecycle": { "$ref": "#/components/schemas/Lifecycle" },
          "official": { "type": "boolean" },
          "launchedAt": { "$ref": "#/components/schemas/Uint" },
          "image": { "type": ["string", "null"], "description": "The creator image URL, or null." },
          "raisedRaw": {
            "$ref": "#/components/schemas/Uint",
            "description": "USDG raised (6 decimals)."
          },
          "hardCapRaw": {
            "$ref": "#/components/schemas/Uint",
            "description": "Hard cap in USDG (6 decimals)."
          },
          "saleDeadline": {
            "$ref": "#/components/schemas/Uint",
            "description": "Genesis only: Unix seconds."
          },
          "treasuryRfvWad": {
            "type": ["string", "null"],
            "pattern": "^(0|[1-9][0-9]*)$",
            "description": "Treasury rfv() (18 decimals). null: unknown, not 0 (a Trading coin that failed its identity check at B, or whose Treasury was not read). Absent: not valued."
          },
          "purchases24h": {
            "type": "object",
            "required": [
              "uniqueBuyers",
              "grossUsdgRaw"
            ],
            "additionalProperties": false,
            "properties": {
              "uniqueBuyers": {
                "type": "integer",
                "minimum": 1,
                "maximum": 50000
              },
              "grossUsdgRaw": {
                "type": "string",
                "pattern": "^[1-9][0-9]*$",
                "description": "Gross USDG paid in raw 6 decimals; may exceed one uint256 after summing."
              }
            },
            "description": "Present for Trending cards only. Existing Treasury fields retain their meaning."
          }
        }
      },
      "DiscoverRow": {
        "type": "object",
        "required": ["total", "coins"],
        "properties": {
          "total": { "type": "integer", "description": "Matches in the whole index." },
          "coins": {
            "type": "array",
            "maxItems": 5,
            "items": { "$ref": "#/components/schemas/WireCoin" }
          }
        }
      },
      "DiscoverList": {
        "type": "object",
        "description": "List or home mode. Card state and Treasury use block `asOf` (B2); purchase metrics use the separate `trending.asOf` (B1).",
        "required": [
          "version",
          "status",
          "chainId",
          "factory",
          "asOf",
          "total",
          "coins",
          "nextCursor",
          "targets"
        ],
        "properties": {
          "version": { "const": 1 },
          "status": { "const": "ready" },
          "chainId": { "type": "integer" },
          "factory": { "$ref": "#/components/schemas/Address" },
          "asOf": { "$ref": "#/components/schemas/BlockRef" },
          "total": {
            "type": "integer",
            "description": "List: matches across the whole index, not this page. Home: every coin in the index."
          },
          "coins": {
            "type": "array",
            "maxItems": 32,
            "description": "List: this page. Home: empty.",
            "items": { "$ref": "#/components/schemas/WireCoin" }
          },
          "nextCursor": {
            "type": ["string", "null"],
            "description": "null on the last page and in home mode."
          },
          "targets": {
            "type": "array",
            "description": "Every stock target in the index as [securityId, label], for filter choices.",
            "items": {
              "type": "array",
              "prefixItems": [{ "$ref": "#/components/schemas/Bytes32" }, { "type": "string" }],
              "minItems": 2,
              "maxItems": 2
            }
          },
          "rows": {
            "type": "object",
            "description": "Home mode only.",
            "required": ["ending", "trading", "new"],
            "properties": {
              "ending": { "$ref": "#/components/schemas/DiscoverRow" },
              "trading": { "$ref": "#/components/schemas/DiscoverRow" },
              "new": { "$ref": "#/components/schemas/DiscoverRow" }
            }
          },
          "trending": {
            "$ref": "#/components/schemas/DiscoverTrending"
          }
        }
      },
      "SearchMatch": {
        "type": "object",
        "required": [
          "chainId",
          "factory",
          "coinId",
          "token",
          "name",
          "symbol",
          "securityId",
          "stockTarget",
          "launchedAt"
        ],
        "properties": {
          "chainId": { "type": "integer" },
          "factory": { "$ref": "#/components/schemas/Address" },
          "coinId": { "$ref": "#/components/schemas/Uint" },
          "token": { "$ref": "#/components/schemas/Address" },
          "name": { "type": "string" },
          "symbol": { "type": "string" },
          "securityId": { "$ref": "#/components/schemas/Bytes32" },
          "stockTarget": { "type": "string" },
          "launchedAt": { "$ref": "#/components/schemas/Uint" }
        }
      },
      "CoinSearch": {
        "type": "object",
        "description": "Search mode, at the subgraph's indexed block `asOf`.",
        "required": ["version", "status", "asOf", "snapshot", "matches", "truncated", "unindexed"],
        "properties": {
          "version": { "const": 1 },
          "status": { "const": "ready" },
          "asOf": { "$ref": "#/components/schemas/BlockRef" },
          "snapshot": {
            "type": "string",
            "description": "Opaque; bound to the dataset, generation and indexed block."
          },
          "matches": {
            "type": "array",
            "maxItems": 50,
            "description": "Newest first.",
            "items": { "$ref": "#/components/schemas/SearchMatch" }
          },
          "truncated": { "type": "boolean", "description": "More than 50 matched." },
          "unindexed": {
            "type": "integer",
            "description": "Catalogue coins of other factories, not covered by this index."
          },
          "chainId": { "type": "integer", "description": "Mobile market only." }
        }
      },
      "CatalogueEntry": {
        "type": "object",
        "description": "A verified catalogue record. `input` is the v6 deployment context input (including the pinned deployment manifest); verify it on chain before relying on it.",
        "required": ["chainId", "factory", "coinId", "input"],
        "properties": {
          "chainId": { "type": "integer" },
          "factory": { "$ref": "#/components/schemas/Address" },
          "coinId": { "$ref": "#/components/schemas/Uint" },
          "input": { "type": "object" },
          "error": { "type": "string" },
          "devnet": { "const": true },
          "metadata": {
            "type": "object",
            "properties": {
              "name": { "type": "string" },
              "symbol": { "type": "string" },
              "image": { "type": "string" },
              "communityUrl": { "type": "string" }
            }
          }
        }
      },
      "PositionCandidates": {
        "type": "object",
        "required": ["version", "status", "asOf", "snapshot", "entries", "unindexed"],
        "properties": {
          "version": { "const": 1 },
          "status": { "const": "ready" },
          "asOf": { "$ref": "#/components/schemas/BlockRef" },
          "snapshot": { "type": "string" },
          "entries": {
            "type": "array",
            "description": "Candidate coins of the indexed factory. Read each one on chain.",
            "items": { "$ref": "#/components/schemas/CatalogueEntry" }
          },
          "unindexed": { "type": "integer" }
        }
      },
      "ProposalCreated": {
        "type": "object",
        "required": [
          "kind",
          "id",
          "proposalId",
          "proposer",
          "targets",
          "values",
          "calldatas",
          "description",
          "voteStart",
          "voteEnd",
          "block",
          "blockHash",
          "logIndex",
          "transaction"
        ],
        "properties": {
          "kind": { "const": "PROPOSAL_CREATED" },
          "id": { "type": "string" },
          "proposalId": { "$ref": "#/components/schemas/Uint" },
          "proposer": { "$ref": "#/components/schemas/Address" },
          "targets": { "type": "array", "items": { "$ref": "#/components/schemas/Address" } },
          "values": { "type": "array", "items": { "$ref": "#/components/schemas/Uint" } },
          "calldatas": { "type": "array", "items": { "type": "string" } },
          "description": { "type": "string" },
          "voteStart": { "$ref": "#/components/schemas/Uint" },
          "voteEnd": { "$ref": "#/components/schemas/Uint" },
          "block": { "$ref": "#/components/schemas/Uint" },
          "blockHash": { "$ref": "#/components/schemas/Bytes32" },
          "logIndex": { "$ref": "#/components/schemas/Uint" },
          "transaction": { "$ref": "#/components/schemas/Bytes32" }
        }
      },
      "GovernanceEvent": {
        "type": "object",
        "description": "A CTO or Creator recipient event. Fields that the event does not have are null.",
        "required": [
          "id",
          "kind",
          "block",
          "blockHash",
          "logIndex",
          "transaction",
          "nonce",
          "recipient",
          "account",
          "executableAt",
          "expiresAt"
        ],
        "properties": {
          "id": { "type": "string" },
          "kind": { "type": "string" },
          "block": { "$ref": "#/components/schemas/Uint" },
          "blockHash": { "$ref": "#/components/schemas/Bytes32" },
          "logIndex": { "$ref": "#/components/schemas/Uint" },
          "transaction": { "$ref": "#/components/schemas/Bytes32" },
          "nonce": { "type": ["string", "null"] },
          "recipient": { "type": ["string", "null"] },
          "account": { "type": ["string", "null"] },
          "executableAt": { "type": ["string", "null"] },
          "expiresAt": { "type": ["string", "null"] }
        }
      },
      "GovernanceProposals": {
        "type": "object",
        "required": ["version", "status", "asOf", "snapshot", "items", "nextCursor"],
        "properties": {
          "version": { "const": 1 },
          "status": { "const": "ready" },
          "asOf": { "$ref": "#/components/schemas/BlockRef" },
          "snapshot": { "type": "string" },
          "items": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "oneOf": [
                { "$ref": "#/components/schemas/ProposalCreated" },
                { "$ref": "#/components/schemas/GovernanceEvent" }
              ]
            }
          },
          "nextCursor": { "type": ["string", "null"] }
        }
      },
      "HistoryUnavailable": {
        "type": "object",
        "description": "Not read. Never draw as 0.",
        "required": ["status", "reason"],
        "properties": {
          "status": { "const": "unavailable" },
          "reason": { "type": "string", "description": "A human-readable sentence." }
        }
      },
      "TreasuryHistory": {
        "oneOf": [
          {
            "type": "object",
            "required": ["status", "intervalSeconds", "points"],
            "properties": {
              "status": { "const": "ready" },
              "intervalSeconds": { "type": "integer", "minimum": 1 },
              "points": {
                "type": "array",
                "maxItems": 40,
                "description": "Oldest first; the last point is the read block.",
                "items": {
                  "type": "object",
                  "required": ["time", "rfvWad"],
                  "properties": {
                    "time": {
                      "type": "integer",
                      "description": "The sampled block's Unix seconds."
                    },
                    "rfvWad": { "$ref": "#/components/schemas/Uint" }
                  }
                }
              }
            }
          },
          { "$ref": "#/components/schemas/HistoryUnavailable" }
        ]
      },
      "ReserveHistory": {
        "oneOf": [
          {
            "type": "object",
            "required": ["status", "symbol", "closed", "intervalSeconds", "points"],
            "properties": {
              "status": { "const": "ready" },
              "symbol": {
                "type": ["string", "null"],
                "description": "The stock token's symbol; null while none is bound."
              },
              "closed": {
                "type": "boolean",
                "description": "The reserve is closed: its USDG no longer waits to buy stock."
              },
              "intervalSeconds": { "type": "integer", "minimum": 1 },
              "points": {
                "type": "array",
                "maxItems": 40,
                "items": {
                  "type": "object",
                  "required": ["time", "shareWad", "usdgWaitingRaw"],
                  "properties": {
                    "time": { "type": "integer" },
                    "shareWad": {
                      "type": ["string", "null"],
                      "pattern": "^(0|[1-9][0-9]*)$",
                      "description": "Stock held in shares at today's multiplier (18 decimals); null while no stock token is bound."
                    },
                    "usdgWaitingRaw": {
                      "$ref": "#/components/schemas/Uint",
                      "description": "Free USDG plus the open order's budget (6 decimals)."
                    }
                  }
                }
              }
            }
          },
          { "$ref": "#/components/schemas/HistoryUnavailable" }
        ]
      },
      "IndexMeta": {
        "type": "object",
        "required": ["dataset", "snapshot", "coverage"],
        "properties": {
          "dataset": {
            "type": "object",
            "required": [
              "contract",
              "chainId",
              "deployment",
              "factory",
              "startBlock",
              "generation"
            ],
            "properties": {
              "contract": { "const": 1 },
              "chainId": { "type": "integer" },
              "deployment": {
                "type": "string",
                "description": "e.g. mainnet-pilot, mainnet, testnet."
              },
              "factory": { "$ref": "#/components/schemas/Address" },
              "startBlock": { "$ref": "#/components/schemas/Uint" },
              "generation": { "type": "string" }
            }
          },
          "snapshot": { "type": "string" },
          "coverage": {
            "type": "object",
            "required": [
              "status",
              "complete",
              "indexed",
              "safe",
              "finalized",
              "lagSeconds",
              "heartbeatAt"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": ["backfilling", "live", "lagging", "stale", "incident", "rebuilding"]
              },
              "complete": { "type": "boolean" },
              "indexed": {
                "oneOf": [{ "$ref": "#/components/schemas/BlockRef" }, { "type": "null" }]
              },
              "safe": {
                "oneOf": [{ "$ref": "#/components/schemas/BlockRef" }, { "type": "null" }]
              },
              "finalized": {
                "oneOf": [{ "$ref": "#/components/schemas/BlockRef" }, { "type": "null" }]
              },
              "lagSeconds": { "type": ["integer", "null"] },
              "heartbeatAt": { "type": ["string", "null"], "format": "date-time" }
            }
          }
        }
      },
      "TotalBacking": {
        "type": "object",
        "required": ["schema", "scope", "rfvWad", "expectedCoins", "valuedCoins", "meta"],
        "properties": {
          "schema": { "const": "launchpad-total-backing/1" },
          "scope": { "const": "all-trading-coins" },
          "rfvWad": {
            "$ref": "#/components/schemas/Uint",
            "description": "Sum of Treasury rfv() (18 decimals) at meta.coverage.indexed."
          },
          "expectedCoins": { "type": "integer" },
          "valuedCoins": {
            "type": "integer",
            "description": "Always equals expectedCoins in a served answer."
          },
          "meta": { "$ref": "#/components/schemas/IndexMeta" }
        }
      },
      "TotalBackingHistory": {
        "type": "object",
        "required": ["schema", "scope", "points", "meta"],
        "properties": {
          "schema": { "const": "launchpad-total-backing-history/1" },
          "scope": { "const": "all-trading-coins" },
          "points": {
            "type": "array",
            "maxItems": 366,
            "items": {
              "type": "object",
              "required": ["date", "block", "rfvWad", "coins"],
              "properties": {
                "date": { "type": "string", "description": "UTC day (YYYY-MM-DD)." },
                "block": { "$ref": "#/components/schemas/BlockRef" },
                "rfvWad": { "$ref": "#/components/schemas/Uint" },
                "coins": { "type": "integer", "description": "Trading coins valued in that total." }
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/IndexMeta",
            "description": "Of the newest point."
          }
        }
      },
      "MobileStatus": {
        "type": "object",
        "required": ["version", "status"],
        "properties": {
          "version": { "const": 1 },
          "status": { "type": "string", "enum": ["changed", "limited", "unavailable"] }
        }
      },
      "MobileMarket": {
        "type": "object",
        "description": "App-internal. `status` other than ready carries only version and chainId.",
        "required": ["version", "chainId", "status"],
        "properties": {
          "version": { "const": 1 },
          "chainId": { "type": "integer", "enum": [4663, 46630] },
          "status": { "type": "string", "enum": ["ready", "unavailable", "error"] },
          "block": {
            "type": "object",
            "required": ["number", "hash"],
            "properties": {
              "number": { "$ref": "#/components/schemas/Uint" },
              "hash": { "$ref": "#/components/schemas/Bytes32" }
            }
          },
          "coins": { "type": "array", "items": { "type": "object" } },
          "complete": { "type": "boolean" },
          "nextCursor": { "type": ["string", "null"] },
          "source": { "type": "string" },
          "asOf": {
            "type": "object",
            "description": "Present when the page is a verified snapshot's block, not the head.",
            "properties": { "timestampMs": { "type": "integer" }, "safe": { "type": "boolean" } }
          },
          "totalTreasury": {
            "type": "object",
            "properties": {
              "status": { "type": "string", "enum": ["ready", "unavailable"] },
              "rfvWad": { "type": "string" },
              "coins": { "type": "integer" },
              "block": { "type": "string" },
              "timestamp": { "type": "integer" },
              "expiresAt": { "type": "integer" }
            }
          }
        }
      },
      "MobilePortfolioRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": ["account"],
        "properties": {
          "account": { "$ref": "#/components/schemas/Address" },
          "cursor": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]{0,3})$",
            "description": "A multiple of 4, at most 1000. Default \"0\". Non-zero requires block and catalogueHash."
          },
          "block": {
            "type": "object",
            "additionalProperties": false,
            "required": ["number", "hash"],
            "properties": {
              "number": { "$ref": "#/components/schemas/Uint" },
              "hash": { "$ref": "#/components/schemas/Bytes32" }
            }
          },
          "catalogueHash": { "$ref": "#/components/schemas/Bytes32" },
          "index": { "const": true }
        }
      },
      "MobilePortfolio": {
        "type": "object",
        "required": [
          "version",
          "status",
          "chainId",
          "account",
          "block",
          "ethBalance",
          "assets",
          "nextCursor",
          "catalogueCount",
          "catalogueHash"
        ],
        "properties": {
          "version": { "const": 1 },
          "status": { "const": "ready" },
          "chainId": { "type": "integer" },
          "account": { "$ref": "#/components/schemas/Address" },
          "block": {
            "type": "object",
            "required": ["number", "hash"],
            "properties": {
              "number": { "$ref": "#/components/schemas/Uint" },
              "hash": { "$ref": "#/components/schemas/Bytes32" }
            }
          },
          "ethBalance": { "$ref": "#/components/schemas/Uint" },
          "assets": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["factory", "coinId", "name", "symbol", "status", "balance", "decimals"],
              "properties": {
                "factory": { "$ref": "#/components/schemas/Address" },
                "coinId": { "$ref": "#/components/schemas/Uint" },
                "name": { "type": "string" },
                "symbol": { "type": "string" },
                "status": { "type": "string", "enum": ["ready", "unavailable"] },
                "balance": {
                  "type": ["string", "null"],
                  "description": "null when unavailable (not 0)."
                },
                "decimals": { "type": ["integer", "null"] }
              }
            }
          },
          "nextCursor": { "type": ["string", "null"] },
          "catalogueCount": { "type": "integer" },
          "catalogueHash": { "$ref": "#/components/schemas/Bytes32" },
          "index": {
            "type": "object",
            "description": "Only when the request had index: true and the server has an index.",
            "properties": {
              "status": { "type": "string", "enum": ["ready", "unknown"] },
              "asOf": {
                "type": "object",
                "properties": {
                  "number": { "$ref": "#/components/schemas/Uint" },
                  "hash": { "$ref": "#/components/schemas/Bytes32" }
                }
              },
              "unindexed": { "type": "integer" }
            }
          }
        }
      },
      "DiscoverTrending": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "status",
              "asOf",
              "window",
              "total",
              "coins"
            ],
            "properties": {
              "status": {
                "const": "ready"
              },
              "asOf": {
                "$ref": "#/components/schemas/BlockRef"
              },
              "window": {
                "type": "object",
                "required": [
                  "after",
                  "through"
                ],
                "properties": {
                  "after": {
                    "type": "string"
                  },
                  "through": {
                    "type": "string"
                  }
                }
              },
              "total": {
                "type": "integer",
                "minimum": 0
              },
              "coins": {
                "type": "array",
                "maxItems": 5,
                "items": {
                  "$ref": "#/components/schemas/WireCoin"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "status",
              "reason"
            ],
            "properties": {
              "status": {
                "const": "unknown"
              },
              "reason": {
                "type": "string"
              }
            }
          }
        ]
      }
    }
  }
}
