Skip to main content

Contract addresses

GET /api/platform/contracts (public) lists both generations. Cache it for a few minutes; never hard-code the values.
The *Gen2 fields are null until generation 2 is deployed in that environment. The other fields are unchanged; see Environments.

The rule

Every market (GET /api/markets/{slug} and the list endpoints) carries contractGeneration (1 | 2) — stored at deploy time — as well as exchangeAddress, the exchange it is pinned to (lower-case, set once), and negRiskEligible. The primary rule is reading market.contractGeneration:
  • contractGeneration === 2 → generation 2 (Order.maker = generation-2 vault, verifyingContract = market.exchangeAddress).
  • contractGeneration === 1 → generation 1 (Order.maker = generation-1 vault, verifyingContract = ctfExchangeNegRisk if negRiskEligible, else ctfExchange).
For clients that predated contractGeneration or when determining generation from exchangeAddress directly: Compare against the generation-1 addresses, which are always published. Do not compare against the *Gen2 fields: a bot that cached them as null before the deploy would sign every generation-2 order with the generation-1 vault and get 409 vault_generation_mismatch until it restarts.

Your vaults

GET /api/me/vault lists every vault you own:
Pick the maker per market:
Cache vaults[] rather than calling GET /api/me/vault before every order. Refresh it after your upgrade, on the WebSocket’s vault_activated frame, or when the cache has no vault of the generation you need.