Developer Notes

Polymarket Glossary

A quick-reference breakdown for the concepts used in this app, focused on practical developer understanding.

Events vs Markets

  • Event: The parent topic (example: a debate, a CPI release, a match). It groups multiple tradable markets.
  • Market: A specific tradable question/outcome contract inside that event (usually YES/NO).
  • In this app: Step 1 helps you choose an event for context, then Step 2 narrows to a single market and outcome to trade.

Polymarket APIs in this app

  • Gamma API: Used for market discovery and metadata. In this app it powers event and market selection and market detail refreshes.
  • CLOB API: Used for authenticated trading actions. In this app it derives trading credentials (Step 3), fetches quotes, and submits BUY market orders from pUSD notional input.
  • Data API: Used for portfolio/position reads after trading. In this app it powers sidebar counts and the My Positions page to confirm trade outcomes.
  • Why this split matters: Discovery (Gamma), execution (CLOB), and reporting (Data) are intentionally separate responsibilities.

Step 3: L2 credentials (derived from wallet signature)

After you sign with your EOA wallet, the CLOB auth flow derives API credentials for trading requests. The app shows these three values:

  • Key: Public identifier for your CLOB API identity. Sent with requests so the backend knows which credential set is being used.
  • Secret: Private signing secret used to prove request authenticity. Keep this hidden.
  • Passphrase: Additional secret factor paired with key+secret for authenticated CLOB calls.
  • Practical takeaway: wallet connection alone is not enough for trading; Step 3 creates the credentials needed for authenticated order endpoints.

Step 4: Contract permissions and why they are needed

Before first trade, the app sends approvals to Polymarket-related contracts on Polygon so exchange contracts can move tokens during settlement.

  • CLOB Exchange V2 (0xE111180000d2663C0091e4f400237545B87B996B): primary exchange contract used for standard order execution in CLOB V2.
  • Neg-Risk Exchange V2 (0xe2222d279d744050d28e00520010520000310F59): exchange path used for negative-risk style markets in CLOB V2.
  • Neg-Risk Adapter (0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296): adapter route still used in some negative-risk settlement paths.
  • What is approved: pUSD uses ERC20 approve, and CTF positions use ERC1155 setApprovalForAll, for each of the contracts above.
  • What pUSD is: pUSD is Polymarket's collateral token for CLOB V2. It is backed by USDC on Polygon; if you only hold USDC.e, wrap to pUSD before API-only trading.