docs: populate 96 empty documentation files (2026-04-26)
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Contracts
|
||||
|
||||
> All Polymarket smart contract addresses, audits, and security resources
|
||||
|
||||
All Polymarket contracts are deployed on **Polygon mainnet** (Chain ID: 137). This is the single source of truth for all contract addresses used across the platform.
|
||||
|
||||
***
|
||||
|
||||
## Core Trading Contracts
|
||||
|
||||
| Contract | Address |
|
||||
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
|
||||
| CTF Exchange | [`0xE111180000d2663C0091e4f400237545B87B996B`](https://polygonscan.com/address/0xE111180000d2663C0091e4f400237545B87B996B) |
|
||||
| Neg Risk CTF Exchange | [`0xe2222d279d744050d28e00520010520000310F59`](https://polygonscan.com/address/0xe2222d279d744050d28e00520010520000310F59) |
|
||||
| Neg Risk Adapter | [`0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296`](https://polygonscan.com/address/0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296) |
|
||||
| Conditional Tokens (CTF) | [`0x4D97DCd97eC945f40cF65F87097ACe5EA0476045`](https://polygonscan.com/address/0x4D97DCd97eC945f40cF65F87097ACe5EA0476045) |
|
||||
|
||||
***
|
||||
|
||||
## Collateral Contracts
|
||||
|
||||
| Contract | Address |
|
||||
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
|
||||
| pUSD — CollateralToken (proxy) | [`0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB`](https://polygonscan.com/address/0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB) |
|
||||
| pUSD — CollateralToken (impl) | [`0x6bBCef9f7ef3B6C592c99e0f206a0DE94Ad0925f`](https://polygonscan.com/address/0x6bBCef9f7ef3B6C592c99e0f206a0DE94Ad0925f) |
|
||||
| CollateralOnramp | [`0x93070a847efEf7F70739046A929D47a521F5B8ee`](https://polygonscan.com/address/0x93070a847efEf7F70739046A929D47a521F5B8ee) |
|
||||
| CollateralOfframp | [`0x2957922Eb93258b93368531d39fAcCA3B4dC5854`](https://polygonscan.com/address/0x2957922Eb93258b93368531d39fAcCA3B4dC5854) |
|
||||
| PermissionedRamp | [`0xebC2459Ec962869ca4c0bd1E06368272732BCb08`](https://polygonscan.com/address/0xebC2459Ec962869ca4c0bd1E06368272732BCb08) |
|
||||
| CtfCollateralAdapter | [`0xADa100874d00e3331D00F2007a9c336a65009718`](https://polygonscan.com/address/0xADa100874d00e3331D00F2007a9c336a65009718) |
|
||||
| NegRiskCtfCollateralAdapter | [`0xAdA200001000ef00D07553cEE7006808F895c6F1`](https://polygonscan.com/address/0xAdA200001000ef00D07553cEE7006808F895c6F1) |
|
||||
|
||||
***
|
||||
|
||||
## Wallet Factory Contracts
|
||||
|
||||
| Contract | Address |
|
||||
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Gnosis Safe Factory | [`0xaacfeea03eb1561c4e67d661e40682bd20e3541b`](https://polygonscan.com/address/0xaacfeea03eb1561c4e67d661e40682bd20e3541b) |
|
||||
| Polymarket Proxy Factory | [`0xaB45c5A4B0c941a2F231C04C3f49182e1A254052`](https://polygonscan.com/address/0xaB45c5A4B0c941a2F231C04C3f49182e1A254052) |
|
||||
|
||||
***
|
||||
|
||||
## Resolution Contracts
|
||||
|
||||
| Contract | Address |
|
||||
| --------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
||||
| UMA Adapter | [`0x6A9D222616C90FcA5754cd1333cFD9b7fb6a4F74`](https://polygonscan.com/address/0x6A9D222616C90FcA5754cd1333cFD9b7fb6a4F74) |
|
||||
| UMA Optimistic Oracle | [`0xCB1822859cEF82Cd2Eb4E6276C7916e692995130`](https://polygonscan.com/address/0xCB1822859cEF82Cd2Eb4E6276C7916e692995130) |
|
||||
|
||||
***
|
||||
|
||||
## Security
|
||||
|
||||
### Audits
|
||||
|
||||
CTF Exchange V2 has been audited by two independent firms:
|
||||
|
||||
| Auditor | Report |
|
||||
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Quantstamp | [CTF Exchange V2 — Quantstamp — March 2026](https://github.com/Polymarket/ctf-exchange-v2/blob/main/audits/CTF%20Exchange%20V2%20-%20Quantstamp%20-%20March%202026.pdf) |
|
||||
| Cantina | [CTF Exchange V2 — Cantina — March 2026](https://github.com/Polymarket/ctf-exchange-v2/blob/main/audits/CTF%20Exchange%20V2%20-%20Cantina%20-%20March%202026.pdf) |
|
||||
|
||||
### Bug Bounty
|
||||
|
||||
Security vulnerabilities can be reported through the [Cantina bug bounty program](https://cantina.xyz/bounties/ff945ca2-2a6e-4b83-b1b6-7a0cd3b94bea).
|
||||
|
||||
***
|
||||
|
||||
## Source Code
|
||||
|
||||
<CardGroup cols={1}>
|
||||
<Card title="CTF Exchange V2" icon="github" href="https://github.com/Polymarket/ctf-exchange-v2">
|
||||
Order matching and settlement contracts
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Merge Tokens
|
||||
|
||||
> Convert outcome token pairs back to pUSD
|
||||
|
||||
**Merging** is the inverse of splitting — it converts a full set of outcome tokens back into pUSD collateral. For every 1 Yes token and 1 No token you merge, you receive \$1 pUSD. The condition must already be prepared on the CTF contract (via `prepareCondition`).
|
||||
|
||||
```
|
||||
100 Yes tokens + 100 No tokens → $100 pUSD
|
||||
```
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before merging, you need:
|
||||
|
||||
1. **Equal amounts** of both Yes and No tokens
|
||||
2. **Condition ID** of the market
|
||||
3. **Sufficient gas** for the transaction
|
||||
|
||||
## How It Works
|
||||
|
||||
1. You call `mergePositions()` with the amount and market details
|
||||
2. One unit of each position in a full set is burned in return for 1 collateral unit
|
||||
3. The CTF contract releases pUSD back to your wallet
|
||||
|
||||
The operation is atomic — if you don't have enough of both tokens, the transaction reverts.
|
||||
|
||||
## Function Parameters
|
||||
|
||||
<ResponseField name="collateralToken" type="IERC20">
|
||||
pUSD (Polymarket USD) contract address: `0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB`
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="parentCollectionId" type="bytes32">
|
||||
Always `0x0000...0000` (32 zero bytes) for Polymarket markets
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="conditionId" type="bytes32">
|
||||
The market's condition ID, available from the Markets API
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="partition" type="uint[]">
|
||||
Array of index sets: `[1, 2]` for binary markets
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="amount" type="uint256">
|
||||
The number of full sets to merge. Also the amount of collateral to receive.
|
||||
</ResponseField>
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Redeem Tokens" icon="hand-holding-dollar" href="/trading/ctf/redeem">
|
||||
Exchange winning tokens for pUSD after resolution
|
||||
</Card>
|
||||
|
||||
<Card title="CTF Overview" icon="book" href="/trading/ctf/overview">
|
||||
Learn more about the Conditional Token Framework
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Conditional Token Framework
|
||||
|
||||
> Onchain token mechanics powering Polymarket positions
|
||||
|
||||
All outcomes on Polymarket are tokenized using the **Conditional Token Framework (CTF)**, an open standard developed by Gnosis. Understanding CTF operations enables advanced trading strategies, market making, and direct smart contract interactions.
|
||||
|
||||
## What is CTF
|
||||
|
||||
The Conditional Token Framework creates **ERC1155 tokens** representing outcomes of prediction markets. Each binary market has two tokens:
|
||||
|
||||
| Token | Redeems for | Condition |
|
||||
| ------- | ----------- | -------------------- |
|
||||
| **Yes** | \$1.00 pUSD | Event occurs |
|
||||
| **No** | \$1.00 pUSD | Event does not occur |
|
||||
|
||||
These tokens are always **fully collateralized** — every Yes/No pair is backed by exactly \$1.00 pUSD locked in the CTF contract.
|
||||
|
||||
## Core Operations
|
||||
|
||||
CTF provides three fundamental operations:
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Split" icon="scissors" href="/trading/ctf/split">
|
||||
Convert pUSD into Yes + No token pairs
|
||||
</Card>
|
||||
|
||||
<Card title="Merge" icon="merge" href="/trading/ctf/merge">
|
||||
Convert Yes + No pairs back to pUSD
|
||||
</Card>
|
||||
|
||||
<Card title="Redeem" icon="hand-holding-dollar" href="/trading/ctf/redeem">
|
||||
Exchange winning tokens for pUSD after resolution
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Token Flow
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/token-flow.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=36f5a57946ac2b83136e17b6c06b358c" alt="" className="dark:hidden" width="1596" height="952" data-path="images/core-concepts/token-flow.png" />
|
||||
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/token-flow.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=69d150ea49ffa18cd7f24689342b1bec" alt="" className="hidden dark:block" width="1596" height="952" data-path="images/dark/core-concepts/token-flow.png" />
|
||||
</Frame>
|
||||
|
||||
## Token Identifiers
|
||||
|
||||
Each outcome token has a unique **position ID** (also called token ID or asset ID), computed onchain in three steps.
|
||||
|
||||
### Step 1 - Condition ID
|
||||
|
||||
```
|
||||
getConditionId(oracle, questionId, outcomeSlotCount)
|
||||
```
|
||||
|
||||
| Parameter | Type | Value |
|
||||
| ------------------ | --------- | ---------------------------------------------------------------- |
|
||||
| `oracle` | `address` | [UMA CTF Adapter](https://github.com/Polymarket/uma-ctf-adapter) |
|
||||
| `questionId` | `bytes32` | Hash of the UMA ancillary data |
|
||||
| `outcomeSlotCount` | `uint` | `2` for all binary markets |
|
||||
|
||||
### Step 2 - Collection IDs
|
||||
|
||||
```
|
||||
getCollectionId(parentCollectionId, conditionId, indexSet)
|
||||
```
|
||||
|
||||
| Parameter | Type | Value |
|
||||
| -------------------- | --------- | --------------------------------------------------------------- |
|
||||
| `parentCollectionId` | `bytes32` | `bytes32(0)` — always zero for top-level positions |
|
||||
| `conditionId` | `bytes32` | The condition ID from step 1 |
|
||||
| `indexSet` | `uint` | `1` (`0b01`) for the first outcome, `2` (`0b10`) for the second |
|
||||
|
||||
The `indexSet` is a bitmask denoting which outcome slots belong to a collection. It must be a nonempty proper subset of the condition's outcome slots. Binary markets always have exactly two collections — one per outcome.
|
||||
|
||||
### Step 3 - Position IDs
|
||||
|
||||
```
|
||||
getPositionId(collateralToken, collectionId)
|
||||
```
|
||||
|
||||
| Parameter | Type | Value |
|
||||
| ----------------- | --------- | ----------------------------------------- |
|
||||
| `collateralToken` | `IERC20` | pUSD contract address on Polygon |
|
||||
| `collectionId` | `bytes32` | One of the two collection IDs from step 2 |
|
||||
|
||||
The two resulting position IDs are the ERC1155 token IDs for the Yes and No outcomes of the market.
|
||||
|
||||
<Note>
|
||||
You can look up token IDs directly via the Gamma API (`GET /markets` or `GET /events`
|
||||
— the `tokens` array on each market contains both outcome token IDs). Computing them
|
||||
manually is only necessary for direct smart contract integration.
|
||||
</Note>
|
||||
|
||||
## Standard vs Neg Risk Markets
|
||||
|
||||
Polymarket has two market types with different CTF configurations:
|
||||
|
||||
| Feature | Standard Markets | Neg Risk Markets |
|
||||
| ----------------- | ------------------- | --------------------- |
|
||||
| CTF Contract | ConditionalTokens | ConditionalTokens |
|
||||
| Exchange Contract | CTF Exchange | Neg Risk CTF Exchange |
|
||||
| Multi-outcome | Independent markets | Linked via conversion |
|
||||
| `negRisk` flag | `false` | `true` |
|
||||
|
||||
For neg risk markets, an additional **conversion** operation allows exchanging a No token for Yes tokens in all other outcomes. See [Negative Risk Markets](/advanced/neg-risk) for details.
|
||||
|
||||
## Contract Addresses
|
||||
|
||||
See [Contracts](/resources/contracts) for all Polymarket smart contract addresses on Polygon.
|
||||
|
||||
## Resources
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="CTF Source Code" icon="github" href="https://github.com/gnosis/conditional-tokens-contracts">
|
||||
Gnosis Conditional Tokens smart contracts
|
||||
</Card>
|
||||
|
||||
<Card title="Code Examples" icon="code" href="https://github.com/Polymarket/examples/tree/main/examples">
|
||||
Python and TypeScript examples for onchain operations
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Split Tokens" icon="scissors" href="/trading/ctf/split">
|
||||
Create outcome token pairs from pUSD
|
||||
</Card>
|
||||
|
||||
<Card title="Merge Tokens" icon="merge" href="/trading/ctf/merge">
|
||||
Convert token pairs back to pUSD
|
||||
</Card>
|
||||
|
||||
<Card title="Redeem Tokens" icon="hand-holding-dollar" href="/trading/ctf/redeem">
|
||||
Collect winnings after resolution
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Redeem Tokens
|
||||
|
||||
> Exchange winning tokens for pUSD after market resolution
|
||||
|
||||
**Redeeming** converts winning outcome tokens into pUSD after a market resolves. Each winning token is worth exactly $1.00 — the losing token is worth $0.
|
||||
|
||||
```
|
||||
Market resolves YES:
|
||||
100 Yes tokens → $100 pUSD
|
||||
100 No tokens → $0
|
||||
```
|
||||
|
||||
## When to Redeem
|
||||
|
||||
Redemption is only available **after a market resolves**. Once the oracle reports the outcome:
|
||||
|
||||
* **Winning tokens** can be redeemed for \$1.00 pUSD each
|
||||
* **Losing tokens** are worth \$0 and produce no payout
|
||||
|
||||
<Note>
|
||||
You can redeem at any time after resolution — there's no deadline. Your
|
||||
winning tokens will always be redeemable.
|
||||
</Note>
|
||||
|
||||
## How Resolution Works
|
||||
|
||||
1. The market's end condition is met (event occurs, date passes, etc.)
|
||||
2. The UMA Adapter oracle reports the outcome via `reportPayouts()`
|
||||
3. The CTF contract records the payout vector
|
||||
4. Redemption becomes available for winning tokens
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before redeeming:
|
||||
|
||||
1. **Market must be resolved** — check the market's `resolved` status
|
||||
2. **Hold winning tokens** — only the winning outcome can be redeemed
|
||||
3. **Know the condition ID** — required for the redemption call
|
||||
|
||||
## Function Parameters
|
||||
|
||||
<ResponseField name="collateralToken" type="IERC20">
|
||||
pUSD (Polymarket USD) contract address: `0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB`
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="parentCollectionId" type="bytes32">
|
||||
Always `0x0000...0000` (32 zero bytes) for Polymarket markets
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="conditionId" type="bytes32">
|
||||
The market's condition ID
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="indexSets" type="uint[]">
|
||||
Array of index sets to redeem: `[1, 2]` redeems both outcomes (only winning
|
||||
pays)
|
||||
</ResponseField>
|
||||
|
||||
<Note>
|
||||
Redemption burns your entire token balance for the condition — there is no
|
||||
amount parameter.
|
||||
</Note>
|
||||
|
||||
## Payout Mechanics
|
||||
|
||||
The CTF uses a **payout vector** to determine redemption values:
|
||||
|
||||
| Outcome | Payout Vector | Redemption |
|
||||
| -------- | ------------- | ----------------- |
|
||||
| Yes wins | `[1, 0]` | Yes = $1, No = $0 |
|
||||
| No wins | `[0, 1]` | Yes = $0, No = $1 |
|
||||
|
||||
When you call `redeemPositions()`:
|
||||
|
||||
* Your token balance is multiplied by the payout
|
||||
* Winning tokens are burned
|
||||
* pUSD is transferred to your wallet
|
||||
* Losing tokens are burned as well, but produce a \$0 payout
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="CTF Overview" icon="book" href="/trading/ctf/overview">
|
||||
Learn more about the Conditional Token Framework
|
||||
</Card>
|
||||
|
||||
<Card title="Resolution Process" icon="gavel" href="/concepts/resolution">
|
||||
Understand how markets are resolved
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Split Tokens
|
||||
|
||||
> Convert pUSD into outcome token pairs
|
||||
|
||||
**Splitting** converts pUSD collateral into a full (position) set of outcome tokens. For every \$1 pUSD you split, you receive 1 Yes token and 1 No token.
|
||||
|
||||
```
|
||||
$100 pUSD → 100 Yes tokens + 100 No tokens
|
||||
```
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before splitting, ensure you have:
|
||||
|
||||
1. **pUSD balance** on Polygon
|
||||
2. **pUSD approval** for the CTF contract to spend your tokens
|
||||
3. **Condition ID** of the market — the condition must already be prepared on the CTF contract (via `prepareCondition`)
|
||||
|
||||
<Note>
|
||||
If the partition is trivial, invalid, or refers to more slots than the
|
||||
condition is prepared with, the transaction will revert.
|
||||
</Note>
|
||||
|
||||
## How It Works
|
||||
|
||||
1. You approve the CTF contract to spend your pUSD
|
||||
2. You call `splitPosition()` with the amount and market details
|
||||
3. The CTF contract transfers pUSD from your wallet and mints both outcome tokens
|
||||
|
||||
The operation is atomic — if any step fails, the entire transaction reverts.
|
||||
|
||||
## Function Parameters
|
||||
|
||||
<ResponseField name="collateralToken" type="IERC20">
|
||||
pUSD (Polymarket USD) contract address: `0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB`
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="parentCollectionId" type="bytes32">
|
||||
Always `0x0000...0000` (32 zero bytes) for Polymarket markets
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="conditionId" type="bytes32">
|
||||
The market's condition ID, available from the Markets API
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="partition" type="uint[]">
|
||||
Array of index sets: `[1, 2]` for binary markets (Yes = 1, No = 2)
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="amount" type="uint256">
|
||||
The amount of collateral or stake to split. Also the number of full sets to
|
||||
receive.
|
||||
</ResponseField>
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Merge Tokens" icon="merge" href="/trading/ctf/merge">
|
||||
Convert token pairs back to pUSD
|
||||
</Card>
|
||||
|
||||
<Card title="Trade on Orderbook" icon="chart-line" href="/trading/orders/create">
|
||||
Place orders using your newly split tokens
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
Reference in New Issue
Block a user