全面优化实盘对接没有验证
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
> ## 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.
|
||||
|
||||
# Markets & Events
|
||||
|
||||
> Understanding the fundamental building blocks of Polymarket
|
||||
|
||||
Every prediction on Polymarket is structured around two core concepts: **markets** and **events**. Understanding how they relate is essential for building on the platform.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event-market.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=4c62bd08a405868307cdd6799b368ca5" alt="" className="dark:hidden" width="1540" height="952" data-path="images/core-concepts/event-market.png" />
|
||||
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event-market.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=2eb5c9b0f8a2afe52bc2e717b7b796a2" alt="" className="hidden dark:block" width="1540" height="952" data-path="images/dark/core-concepts/event-market.png" />
|
||||
</Frame>
|
||||
|
||||
## Markets
|
||||
|
||||
A **market** is the fundamental tradable unit on Polymarket. Each market represents a single binary question with Yes/No outcomes.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/event.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=0c9a264aec9a22ce5a20c4cc7980806d" alt="" className="dark:hidden" width="1540" height="952" data-path="images/core-concepts/event.png" />
|
||||
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/event.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=912e41bebfe8c1a43ef53b89685ca3d2" alt="" className="hidden dark:block" width="1540" height="952" data-path="images/dark/core-concepts/event.png" />
|
||||
</Frame>
|
||||
|
||||
Every market has:
|
||||
|
||||
| Identifier | Description |
|
||||
| ---------------- | ------------------------------------------------------------------------ |
|
||||
| **Condition ID** | Unique identifier for the market's condition in the CTF contracts |
|
||||
| **Question ID** | Hash of the market question used for resolution |
|
||||
| **Token IDs** | ERC1155 token IDs used for trading on the CLOB — one for Yes, one for No |
|
||||
|
||||
<Note>
|
||||
Markets can only be traded via the CLOB if `enableOrderBook` is `true`. Some
|
||||
markets may exist onchain but not be available for order book trading.
|
||||
</Note>
|
||||
|
||||
### Market Example
|
||||
|
||||
A simple market might be:
|
||||
|
||||
> **"Will Bitcoin reach \$150,000 by December 2026?"**
|
||||
|
||||
This creates two outcome tokens:
|
||||
|
||||
* **Yes token** - Redeemable for `$1` if Bitcoin reaches `$150k`
|
||||
* **No token** - Redeemable for `$1` if Bitcoin doesn't reach `$150k`
|
||||
|
||||
## Events
|
||||
|
||||
An **event** is a container that groups one or more related markets together. Events provide organizational structure and enable multi-outcome predictions.
|
||||
|
||||
### Single-Market Events
|
||||
|
||||
When an event contains just one market, it creates a simple market pair. The event and market are essentially equivalent.
|
||||
|
||||
```
|
||||
Event: Will Bitcoin reach $100,000 by December 2024?
|
||||
└── Market: Will Bitcoin reach $100,000 by December 2024? (Yes/No)
|
||||
```
|
||||
|
||||
### Multi-Market Events
|
||||
|
||||
When an event contains two or more markets, it creates a grouped market pair. This enables mutually exclusive multi-outcome predictions.
|
||||
|
||||
```
|
||||
Event: Who will win the 2024 Presidential Election?
|
||||
├── Market: Donald Trump? (Yes/No)
|
||||
├── Market: Joe Biden? (Yes/No)
|
||||
├── Market: Kamala Harris? (Yes/No)
|
||||
└── Market: Other? (Yes/No)
|
||||
```
|
||||
|
||||
## Identifying Markets
|
||||
|
||||
Every market and event has a unique **slug** that appears in the Polymarket URL:
|
||||
|
||||
```
|
||||
https://polymarket.com/event/fed-decision-in-october
|
||||
└── slug: fed-decision-in-october
|
||||
```
|
||||
|
||||
You can use slugs to fetch specific markets or events from the API:
|
||||
|
||||
```bash theme={null}
|
||||
# Fetch event by slug
|
||||
curl "https://gamma-api.polymarket.com/events?slug=fed-decision-in-october"
|
||||
```
|
||||
|
||||
## Sports Markets
|
||||
|
||||
Specifically for sports markets, outstanding limit orders are **automatically cancelled** once the game begins, clearing the order book at the official start time. However, game start times can shift — if a game starts earlier than scheduled, orders may not be cleared in time. Always monitor your orders closely around game start times.
|
||||
|
||||
***
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Prices & Orderbook" icon="chart-line" href="/concepts/prices-orderbook">
|
||||
Learn how prices are determined and how the order book works.
|
||||
</Card>
|
||||
|
||||
<Card title="Fetching Market Data" icon="code" href="/market-data/overview">
|
||||
Start querying markets and events from the API.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,159 @@
|
||||
> ## 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.
|
||||
|
||||
# Order Lifecycle
|
||||
|
||||
> Understanding how orders flow from creation to settlement
|
||||
|
||||
Every trade on Polymarket follows a specific lifecycle. Orders are created offchain, matched by an operator, and settled onchain through smart contracts. This hybrid approach combines the speed of centralized matching with the security of blockchain settlement.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/order-lifecycle.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=4db07008193421bfe359afe44b5f604e" alt="" className="dark:hidden" width="2336" height="952" data-path="images/core-concepts/order-lifecycle.png" />
|
||||
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/order-lifecycle.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=5a0f3eba2f20c44471bae05c0670de4a" alt="" className="hidden dark:block" width="2336" height="952" data-path="images/dark/core-concepts/order-lifecycle.png" />
|
||||
</Frame>
|
||||
|
||||
## How Orders Work
|
||||
|
||||
All orders on Polymarket are **limit orders**. A limit order specifies the price you're willing to pay (or accept) and the quantity you want to trade.
|
||||
|
||||
<Note>
|
||||
"Market orders" are simply limit orders with a price set to execute
|
||||
immediately against the best available resting orders.
|
||||
</Note>
|
||||
|
||||
Orders are **EIP712-signed messages**. When you place an order, you sign a structured message with your private key. This signature authorizes the Exchange contract to execute the trade on your behalf—without ever taking custody of your funds.
|
||||
|
||||
## Order Types
|
||||
|
||||
| Type | Behavior | Use Case |
|
||||
| ------- | ------------------------------------------------------------- | ------------------------ |
|
||||
| **GTC** | Good Till Cancelled — rests on book until filled or cancelled | Standard limit orders |
|
||||
| **GTD** | Good Till Date — auto-expires at specified time | Time-limited orders |
|
||||
| **FOK** | Fill Or Kill — fill entirely or cancel immediately | All-or-nothing execution |
|
||||
| **FAK** | Fill And Kill — fill what's available, cancel the rest | Partial fills acceptable |
|
||||
|
||||
### Post-Only Orders
|
||||
|
||||
Post-only orders will only rest on the book. If a post-only order would match immediately (cross the spread), it's rejected instead of executed. This guarantees you're always the maker, never the taker.
|
||||
|
||||
<Steps>
|
||||
<Step title="Create and Sign">
|
||||
Your client creates an order object containing:
|
||||
|
||||
* Token ID (which outcome you're trading)
|
||||
* Side (buy or sell)
|
||||
* Price and size
|
||||
* Expiration time
|
||||
* Timestamp (in milliseconds, used for order uniqueness)
|
||||
|
||||
You sign this order with your private key, creating an EIP712 signature.
|
||||
</Step>
|
||||
|
||||
<Step title="Submit to CLOB">
|
||||
The signed order is submitted to the Central Limit Order Book (CLOB) operator. The operator validates:
|
||||
|
||||
* Signature is valid
|
||||
* You have sufficient balance
|
||||
* You have set the required allowances
|
||||
* Price meets minimum tick size requirements
|
||||
</Step>
|
||||
|
||||
<Step title="Match or Rest">
|
||||
**If the order is marketable** (your buy price ≥ lowest ask, or your sell price ≤ highest bid), it matches against resting orders. Some markets apply a short taker delay before matching:
|
||||
|
||||
* **Taker delay:** used on selected crypto and finance up/down markets. The order is held for 250 ms, then validation runs again and the order is matched or placed on the book. The API waits for this hold and returns the final order result. To check a specific market, call the public CLOB endpoint `GET https://clob.polymarket.com/clob-markets/{condition_id}` or SDK method `getClobMarketInfo(conditionID)` and look for `itode: true`.
|
||||
* **Sports/game delay:** enabled on configured sports markets around live game conditions. The order waits for the market's configured delay window before matching.
|
||||
|
||||
During either delay, the order is pending and cannot be canceled. If the market, balance, allowance, or risk checks fail when the delay expires, the order is rejected instead of matching.
|
||||
|
||||
**If the order is not marketable**, it rests on the book waiting for a counterparty. It remains open until:
|
||||
|
||||
* Another order matches against it
|
||||
* You cancel it
|
||||
* It expires (GTD orders only)
|
||||
</Step>
|
||||
|
||||
<Step title="Settlement">
|
||||
When orders match, the operator submits the trade to the blockchain. The Exchange contract:
|
||||
|
||||
* Verifies both signatures
|
||||
* Transfers tokens from seller to buyer
|
||||
* Transfers pUSD from buyer to seller
|
||||
|
||||
Settlement is **atomic**—either the entire trade succeeds or nothing happens.
|
||||
</Step>
|
||||
|
||||
<Step title="Confirmation">
|
||||
The trade achieves finality on Polygon. Your token balances update and the trade appears in your history.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Order Statuses
|
||||
|
||||
When you place an order, it receives one of these statuses:
|
||||
|
||||
| Status | Description |
|
||||
| ----------- | ----------------------------------------------------------------------------------------------------------------------- |
|
||||
| `live` | Order is resting on the book |
|
||||
| `matched` | Order matched immediately |
|
||||
| `delayed` | Marketable order accepted into an asynchronous delay window on configured seconds-delay markets, such as sports markets |
|
||||
| `unmatched` | Marketable order placed on the book after the delay expired without a match |
|
||||
|
||||
## Trade Statuses
|
||||
|
||||
After matching, trades progress through these statuses:
|
||||
|
||||
| Status | Terminal | Description |
|
||||
| ----------- | -------- | ------------------------------------------------------ |
|
||||
| `MATCHED` | No | Trade matched, sent to executor for onchain submission |
|
||||
| `MINED` | No | Transaction mined into the blockchain |
|
||||
| `CONFIRMED` | Yes | Trade achieved finality, successful |
|
||||
| `RETRYING` | No | Transaction failed, being retried |
|
||||
| `FAILED` | Yes | Trade failed permanently |
|
||||
|
||||
## Maker vs Taker
|
||||
|
||||
| Role | Description | When |
|
||||
| --------- | ------------------------------- | ----------------------------------------------------- |
|
||||
| **Maker** | Adds liquidity to the book | Your order rests and is later matched |
|
||||
| **Taker** | Removes liquidity from the book | Your order matches immediately against resting orders |
|
||||
|
||||
Price improvement always benefits the taker. If you place a buy order at `$0.55` and it matches against a resting sell at `$0.52`, you pay `$0.52`.
|
||||
|
||||
## Cancellation
|
||||
|
||||
You can cancel orders at any time before they're matched via the CLOB API, except while a marketable order is in a pending delay window.
|
||||
|
||||
Partial fills cannot be cancelled—only the unfilled portion of an order can be cancelled.
|
||||
|
||||
## Requirements
|
||||
|
||||
Before placing orders, ensure:
|
||||
|
||||
| Requirement | Description |
|
||||
| ------------------- | -------------------------------------------------- |
|
||||
| **Balance** | Sufficient pUSD (for buys) or tokens (for sells) |
|
||||
| **Allowance** | Approve the Exchange contract to spend your assets |
|
||||
| **API Credentials** | Valid API key for authenticated endpoints |
|
||||
|
||||
<Info>
|
||||
Order size is limited by your available balance minus any amounts reserved by existing open orders.
|
||||
|
||||
$$
|
||||
\text{maxOrderSize} = \text{balance} - \sum(\text{openOrderSize} - \text{filledAmount})
|
||||
$$
|
||||
</Info>
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Resolution" icon="gavel" href="/concepts/resolution">
|
||||
Learn how markets are resolved and winning tokens redeemed.
|
||||
</Card>
|
||||
|
||||
<Card title="Trading Guide" icon="book" href="/trading/overview">
|
||||
Start placing orders with our step-by-step guide.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,116 @@
|
||||
> ## 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.
|
||||
|
||||
# Positions & Tokens
|
||||
|
||||
> Understanding outcome tokens and how positions work on Polymarket
|
||||
|
||||
Every prediction on Polymarket is represented by **outcome tokens**. When you trade, you're buying and selling these tokens. Your **position** is simply your balance of tokens for a given market.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/token-lifecycle.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=cad279109c43c68c541123c2d348c4c5" alt="" className="dark:hidden" width="1596" height="952" data-path="images/core-concepts/token-lifecycle.png" />
|
||||
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/token-lifecycle.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=204d16c1d89892a3c8573060aa04780e" alt="" className="hidden dark:block" width="1596" height="952" data-path="images/dark/core-concepts/token-lifecycle.png" />
|
||||
</Frame>
|
||||
|
||||
## Outcome Tokens
|
||||
|
||||
Each market has exactly two outcome tokens:
|
||||
|
||||
| Token | Redeems for | If... |
|
||||
| ------- | ----------- | ------------------------ |
|
||||
| **Yes** | \$1.00 | The event occurs |
|
||||
| **No** | \$1.00 | The event does not occur |
|
||||
|
||||
Tokens are **ERC1155** assets on Polygon, using the [Gnosis Conditional Token Framework](https://github.com/gnosis/conditional-tokens-contracts/) (CTF). This means they're fully onchain and function as standard ERC1155 tokens.
|
||||
|
||||
<Note>
|
||||
Outcome tokens are always fully backed. Every Yes/No pair in existence is
|
||||
backed by exactly `$1` of pUSD collateral locked in the CTF contract.
|
||||
</Note>
|
||||
|
||||
### Split
|
||||
|
||||
Convert pUSD into outcome tokens. Splitting \$1 creates 1 Yes token and 1 No token.
|
||||
|
||||
```
|
||||
$100 pUSD → 100 Yes tokens + 100 No tokens
|
||||
```
|
||||
|
||||
Use this when you want to:
|
||||
|
||||
* Create inventory for market making
|
||||
* Obtain both sides of a market
|
||||
|
||||
### Trade
|
||||
|
||||
Buy or sell tokens on the order book. This is how most users acquire positions.
|
||||
|
||||
* **Buy Yes** at `$0.60` → Pay `$0.60`, receive 1 Yes token
|
||||
* **Sell Yes** at `$0.60` → Give up 1 Yes token, receive `$0.60`
|
||||
|
||||
You can sell your position at any time before resolution.
|
||||
|
||||
### Merge
|
||||
|
||||
Convert a complete set of tokens back into pUSD. Merging requires equal amounts of Yes and No tokens.
|
||||
|
||||
```
|
||||
100 Yes tokens + 100 No tokens → $100 pUSD
|
||||
```
|
||||
|
||||
Use this when you want to:
|
||||
|
||||
* Exit a position without trading
|
||||
* Convert accumulated tokens back to collateral
|
||||
|
||||
### Redeem
|
||||
|
||||
After a market resolves, exchange winning tokens for pUSD.
|
||||
|
||||
| Outcome | Yes tokens | No tokens |
|
||||
| ------------------- | -------------- | -------------- |
|
||||
| Event occurs | Worth \$1 each | Worth \$0 |
|
||||
| Event doesn't occur | Worth \$0 | Worth \$1 each |
|
||||
|
||||
```
|
||||
100 winning tokens → $100 pUSD
|
||||
```
|
||||
|
||||
### Position Value
|
||||
|
||||
The value of your position depends on the current market price:
|
||||
|
||||
```
|
||||
Position value = Token balance × Current price
|
||||
```
|
||||
|
||||
If you hold 100 Yes tokens and Yes is trading at \$0.75:
|
||||
|
||||
```
|
||||
Position value = 100 × $0.75 = $75
|
||||
```
|
||||
|
||||
## Profit and Loss
|
||||
|
||||
Your profit depends on how the market resolves compared to your entry price.
|
||||
|
||||
### Example - Buying Yes at 0.40
|
||||
|
||||
| Scenario | Outcome | Return | Profit |
|
||||
| ------------------- | -------- | ------ | ------------------------- |
|
||||
| Event occurs | Yes wins | \$1.00 | +\$0.60 per token (150%) |
|
||||
| Event doesn't occur | No wins | \$0.00 | -\$0.40 per token (-100%) |
|
||||
|
||||
### Holding Rewards
|
||||
|
||||
Polymarket pays a **4.00% annualized** Holding Reward based on your total position value in eligible markets. Your total position value is randomly sampled once each hour, and the reward is distributed daily. The rate is variable and subject to change at Polymarket's discretion.
|
||||
|
||||
### Example - Selling Before Resolution
|
||||
|
||||
You can lock in profits or cut losses by selling before the market resolves:
|
||||
|
||||
* Bought Yes at `$0.40`
|
||||
* Price rises to `$0.70`
|
||||
* Sell at `$0.70` → Profit of `$0.30` per token (75%)
|
||||
@@ -0,0 +1,116 @@
|
||||
> ## 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.
|
||||
|
||||
# Prices & Orderbook
|
||||
|
||||
> How prices work and how the order book enables peer-to-peer trading
|
||||
|
||||
Polymarket uses a **Central Limit Order Book (CLOB)** for trading. Prices aren't set by Polymarket—they emerge from supply and demand as users trade with each other.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/orderbook.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=119174bcaaeb3b9abbd4c2d94b7bdae6" alt="" className="dark:hidden" width="1540" height="952" data-path="images/core-concepts/orderbook.png" />
|
||||
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/orderbook.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=b940f4b5f28ab6ed5845dda2bfe03edb" alt="" className="hidden dark:block" width="1540" height="952" data-path="images/dark/core-concepts/orderbook.png" />
|
||||
</Frame>
|
||||
|
||||
## Prices Are Probabilities
|
||||
|
||||
Every share on Polymarket is priced between `$0.00` and `$1.00`. The price directly represents the market's belief in the probability of that outcome.
|
||||
|
||||
| Price | Implied Probability |
|
||||
| ------ | ------------------- |
|
||||
| \$0.25 | 25% chance |
|
||||
| \$0.50 | 50% chance |
|
||||
| \$0.75 | 75% chance |
|
||||
|
||||
<Note>
|
||||
The displayed price is the **midpoint** of the bid-ask spread. If the spread
|
||||
is wider than \$0.10, the last traded price is shown instead.
|
||||
</Note>
|
||||
|
||||
### Example
|
||||
|
||||
If the best bid for "Yes" is `$0.34` and the best ask is `$0.40`:
|
||||
|
||||
```
|
||||
Displayed price = ($0.34 + $0.40) / 2 = $0.37 (37% probability)
|
||||
```
|
||||
|
||||
You won't necessarily trade at `$0.37`—you'll pay the ask (`$0.40`) when buying or receive the bid (`$0.34`) when selling.
|
||||
|
||||
## The Order Book
|
||||
|
||||
The order book is a list of all open buy and sell orders for a market. It has two sides:
|
||||
|
||||
| Side | Description |
|
||||
| ---- | ----------------------------------------------------------- |
|
||||
| Bids | Buy orders—the highest prices traders are willing to pay |
|
||||
| Asks | Sell orders—the lowest prices traders are willing to accept |
|
||||
|
||||
The **spread** is the gap between the highest bid and lowest ask. Tighter spreads mean more liquid markets.
|
||||
|
||||
## Order Types
|
||||
|
||||
### Market Orders
|
||||
|
||||
Execute immediately at the best available price. Use when you want instant execution and are willing to pay the spread.
|
||||
|
||||
* **Buying**: You pay the lowest ask price
|
||||
* **Selling**: You receive the highest bid price
|
||||
|
||||
### Limit Orders
|
||||
|
||||
Execute only at your specified price or better. Use when you want price control and are willing to wait.
|
||||
|
||||
* Your order sits in the book until someone trades against it
|
||||
* Orders can **partially fill** as different traders match portions of your order
|
||||
* You can cancel unfilled orders at any time
|
||||
|
||||
<Note>
|
||||
All orders on Polymarket are technically limit orders. A "market order" is
|
||||
simply a limit order priced to execute immediately against resting orders.
|
||||
</Note>
|
||||
|
||||
## How Trades Work
|
||||
|
||||
Polymarket's CLOB is **hybrid-decentralized**:
|
||||
|
||||
1. **Offchain matching** — An operator matches compatible orders
|
||||
2. **Onchain settlement** — Matched trades settle via smart contracts
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/trade-lifecycle.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=2acec8befdfbba57fb554170f7d5813c" alt="" className="dark:hidden" width="1540" height="952" data-path="images/core-concepts/trade-lifecycle.png" />
|
||||
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/trade-lifecycle.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=d18b22ad7629820ad554dda8cb83ec18" alt="" className="hidden dark:block" width="1540" height="952" data-path="images/dark/core-concepts/trade-lifecycle.png" />
|
||||
</Frame>
|
||||
|
||||
This design gives you the speed of centralized matching with the security of onchain settlement. You always maintain custody of your funds.
|
||||
|
||||
## Price Discovery
|
||||
|
||||
When a new market launches, there's no initial price. The first price emerges when:
|
||||
|
||||
1. Someone places a limit order to buy Yes at a price (e.g., `$0.60`)
|
||||
2. Someone places a limit order to buy No at the complementary price (e.g., `$0.40`)
|
||||
3. Since `$0.60` + `$0.40` = `$1.00`, the orders match
|
||||
|
||||
When matched, `$1.00` is converted into 1 Yes token and 1 No token, each going to their respective buyers.
|
||||
|
||||
## Next Steps
|
||||
|
||||
<Note>
|
||||
Polymarket's orderbook has **no trading size limits** — it matches willing
|
||||
buyers and sellers of any amount. However, large orders may move the price
|
||||
significantly. Always check orderbook depth before trading in size.
|
||||
</Note>
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Positions & Tokens" icon="coins" href="/concepts/positions-tokens">
|
||||
Learn about outcome tokens and how positions work.
|
||||
</Card>
|
||||
|
||||
<Card title="Order Lifecycle" icon="arrows-spin" href="/concepts/order-lifecycle">
|
||||
Understand what happens from order placement to settlement.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,166 @@
|
||||
> ## 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.
|
||||
|
||||
# Polymarket USD
|
||||
|
||||
> pUSD — the collateral token used for all trading on Polymarket
|
||||
|
||||
**pUSD** (Polymarket USD) is the collateral token used for all trading on Polymarket. It's a standard ERC-20 token on Polygon, backed by USDC. The smart contract — which enables the withdrawal functionality — enforces the backing. No algorithmic peg, no fractional reserve.
|
||||
|
||||
<Note>
|
||||
**Day to day, nothing changes.** You load funds, see a balance, trade, and
|
||||
withdraw. pUSD is the technical settlement layer underneath the same
|
||||
experience you're used to.
|
||||
</Note>
|
||||
|
||||
***
|
||||
|
||||
## Why pUSD
|
||||
|
||||
The protocol settles all trading activity in native USDC, providing a more capital efficient, scalable, and institutionally aligned settlement standard as the platform continues to grow.
|
||||
|
||||
pUSD is a standard ERC-20 wrapper that represents a USDC claim. Wrapping and unwrapping are enforced onchain by the `CollateralOnramp` and `CollateralOfframp` contracts.
|
||||
|
||||
***
|
||||
|
||||
## Key facts
|
||||
|
||||
| | |
|
||||
| -------------- | ----------------------- |
|
||||
| Token standard | ERC-20 |
|
||||
| Network | Polygon mainnet |
|
||||
| Decimals | 6 |
|
||||
| Backing | USDC (enforced onchain) |
|
||||
| Transferable | Yes — standard ERC-20 |
|
||||
|
||||
pUSD is designed to function within Polymarket. There are no current plans to list it on external exchanges.
|
||||
|
||||
See the [Contracts](/resources/contracts) page for all collateral-related contract addresses.
|
||||
|
||||
***
|
||||
|
||||
## Wrapping — USDC.e → pUSD
|
||||
|
||||
Use the **CollateralOnramp** to wrap USDC.e into pUSD.
|
||||
|
||||
```solidity theme={null}
|
||||
function wrap(address _asset, address _to, uint256 _amount) external
|
||||
```
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `_asset` — address of the asset being wrapped. Must be USDC.e.
|
||||
* `_to` — recipient of the minted pUSD. Does not have to be `msg.sender`.
|
||||
* `_amount` — amount to wrap, in USDC.e base units (6 decimals).
|
||||
|
||||
**Requirements**
|
||||
|
||||
* The caller must first approve the **CollateralOnramp** contract (not the pUSD token) to spend USDC.e.
|
||||
* Reverts with `OnlyUnpaused()` if the admin has paused USDC.e.
|
||||
|
||||
### Example
|
||||
|
||||
<CodeGroup>
|
||||
```typescript TypeScript theme={null}
|
||||
import {
|
||||
createWalletClient,
|
||||
createPublicClient,
|
||||
http,
|
||||
parseAbi,
|
||||
parseUnits,
|
||||
} from "viem";
|
||||
import { polygon } from "viem/chains";
|
||||
import { privateKeyToAccount } from "viem/accounts";
|
||||
|
||||
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
|
||||
const walletClient = createWalletClient({ account, chain: polygon, transport: http() });
|
||||
const publicClient = createPublicClient({ chain: polygon, transport: http() });
|
||||
|
||||
const ONRAMP = "0x93070a847efEf7F70739046A929D47a521F5B8ee" as const;
|
||||
const USDCE = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" as const; // USDC.e on Polygon
|
||||
|
||||
const amount = parseUnits("100", 6); // 100 USDC.e
|
||||
|
||||
// 1. Approve the Onramp to spend your USDC.e
|
||||
const approveHash = await walletClient.writeContract({
|
||||
address: USDCE,
|
||||
abi: parseAbi(["function approve(address spender, uint256 amount) returns (bool)"]),
|
||||
functionName: "approve",
|
||||
args: [ONRAMP, amount],
|
||||
});
|
||||
await publicClient.waitForTransactionReceipt({ hash: approveHash });
|
||||
|
||||
// 2. Wrap USDC.e → pUSD
|
||||
const wrapHash = await walletClient.writeContract({
|
||||
address: ONRAMP,
|
||||
abi: parseAbi(["function wrap(address _asset, address _to, uint256 _amount)"]),
|
||||
functionName: "wrap",
|
||||
args: [USDCE, account.address, amount],
|
||||
});
|
||||
await publicClient.waitForTransactionReceipt({ hash: wrapHash });
|
||||
```
|
||||
|
||||
```python Python theme={null}
|
||||
from web3 import Web3
|
||||
|
||||
ONRAMP = "0x93070a847efEf7F70739046A929D47a521F5B8ee"
|
||||
USDCE = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"
|
||||
|
||||
amount = 100 * 10**6 # 100 USDC.e
|
||||
|
||||
# 1. Approve the Onramp to spend your USDC.e
|
||||
usdce = w3.eth.contract(address=USDCE, abi=[{
|
||||
"name": "approve", "type": "function",
|
||||
"inputs": [{"name": "spender", "type": "address"},
|
||||
{"name": "amount", "type": "uint256"}],
|
||||
"outputs": [{"type": "bool"}],
|
||||
}])
|
||||
usdce.functions.approve(ONRAMP, amount).transact({"from": address})
|
||||
|
||||
# 2. Wrap USDC.e → pUSD
|
||||
onramp = w3.eth.contract(address=ONRAMP, abi=[{
|
||||
"name": "wrap", "type": "function",
|
||||
"inputs": [{"name": "_asset", "type": "address"},
|
||||
{"name": "_to", "type": "address"},
|
||||
{"name": "_amount", "type": "uint256"}],
|
||||
"outputs": [],
|
||||
}])
|
||||
onramp.functions.wrap(USDCE, address, amount).transact({"from": address})
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
***
|
||||
|
||||
## Unwrapping — pUSD → USDC.e
|
||||
|
||||
Use the **CollateralOfframp** to unwrap pUSD back into USDC.e.
|
||||
|
||||
```solidity theme={null}
|
||||
function unwrap(address _asset, address _to, uint256 _amount) external
|
||||
```
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `_asset` — asset you want to receive. Must be USDC.e.
|
||||
* `_to` — recipient of the underlying asset.
|
||||
* `_amount` — amount of pUSD to unwrap (6 decimals).
|
||||
|
||||
**Requirements**
|
||||
|
||||
* The caller must first approve the **CollateralOfframp** contract to spend their pUSD.
|
||||
* Same pause gate as the Onramp.
|
||||
|
||||
***
|
||||
|
||||
## Next steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Contracts" icon="file-contract" href="/resources/contracts">
|
||||
All Polymarket contract addresses and audits
|
||||
</Card>
|
||||
|
||||
<Card title="Bridge" icon="arrow-right-arrow-left" href="/trading/bridge/deposit">
|
||||
Deposit from other chains — auto-wraps to pUSD
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -0,0 +1,151 @@
|
||||
> ## 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.
|
||||
|
||||
# Resolution
|
||||
|
||||
> How markets are resolved and winning positions redeemed
|
||||
|
||||
When the outcome of an event becomes known, the market is **resolved**. Resolution determines which outcome won, allowing holders of winning tokens to redeem them for \$1 each. Losing tokens become worthless.
|
||||
|
||||
Polymarket uses the **UMA Optimistic Oracle** for decentralized, permissionless resolution. Anyone can propose an outcome, and anyone can dispute it if they believe it's incorrect.
|
||||
|
||||
<Frame>
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/core-concepts/resolution-lifecycle.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=6726569af3efd6f4fda54528c8eb0d0a" alt="" className="dark:hidden" width="1722" height="952" data-path="images/core-concepts/resolution-lifecycle.png" />
|
||||
|
||||
<img src="https://mintcdn.com/polymarket-292d1b1b/FOMte3ewbG-LVy3k/images/dark/core-concepts/resolution-lifecycle.png?fit=max&auto=format&n=FOMte3ewbG-LVy3k&q=85&s=36e91c655f7f50b18dea3a23b44f8c23" alt="" className="hidden dark:block" width="1722" height="952" data-path="images/dark/core-concepts/resolution-lifecycle.png" />
|
||||
</Frame>
|
||||
|
||||
## Resolution Rules
|
||||
|
||||
Every market has pre-defined resolution rules that specify:
|
||||
|
||||
* **Resolution source** — Where the outcome will be determined from (e.g., official announcements, specific websites)
|
||||
* **End date** — When the market is eligible for resolution
|
||||
* **Edge cases** — How ambiguous situations should be handled
|
||||
|
||||
<Warning>
|
||||
Always read the resolution rules before trading. The market title describes
|
||||
the question, but the **rules** define how it resolves.
|
||||
</Warning>
|
||||
|
||||
<Steps>
|
||||
<Step title="Proposal">
|
||||
Anyone can propose a resolution by:
|
||||
|
||||
1. Selecting the winning outcome
|
||||
2. Posting a bond (typically \$750 pUSD)
|
||||
3. Submitting the proposal to the UMA Oracle
|
||||
|
||||
If the proposal is correct and undisputed, the proposer receives their bond back plus a reward.
|
||||
|
||||
<Warning>
|
||||
If you propose incorrectly or too early, you lose your entire bond. Only
|
||||
propose if you're confident in the outcome and understand the process.
|
||||
</Warning>
|
||||
</Step>
|
||||
|
||||
<Step title="Challenge Period">
|
||||
After a proposal, there's a **2-hour challenge period** where anyone can dispute the outcome.
|
||||
|
||||
* **If no dispute**: The proposal is accepted and the market resolves
|
||||
* **If disputed**: A new proposal round begins. If the second proposal is also disputed, the resolution escalates to UMA's DVM (Data Verification Mechanism) for a token holder vote.
|
||||
|
||||
There are three possible resolution flows:
|
||||
|
||||
1. **No dispute** — Propose then Resolve (fastest, \~2 hours)
|
||||
2. **One dispute** — Propose, Challenge, second Propose, Resolve (second proposal accepted)
|
||||
3. **Two disputes** — Propose, Challenge, second Propose, second Challenge, Resolve via DVM vote
|
||||
</Step>
|
||||
|
||||
<Step title="Dispute - If Challenged">
|
||||
To dispute a proposal:
|
||||
|
||||
1. Post a counter-bond (same amount as proposer, typically \$750)
|
||||
2. The dispute triggers a new proposal round, or if already in the second round, a debate period
|
||||
|
||||
During the **24-48 hour debate period**, evidence can be submitted in UMA's Discord channels (`#evidence-rationale` and `#voting-discussion`).
|
||||
</Step>
|
||||
|
||||
<Step title="UMA Vote">
|
||||
After the debate period, UMA token holders vote on the correct outcome. The voting process takes approximately 48 hours.
|
||||
|
||||
| Outcome | Result | Bond Distribution |
|
||||
| ----------------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
||||
| **Proposer wins** | Original proposal accepted | Proposer gets bond back + half of disputer's bond |
|
||||
| **Disputer wins** | Proposal rejected, new proposal needed | Disputer gets bond back + half of proposer's bond |
|
||||
| **Too Early** | Event hasn't concluded yet | Disputer gets bond back + half of proposer's bond |
|
||||
| **Unknown/50-50** | Neither outcome applicable (rare) | Market resolves 50/50 — each token redeems for \$0.50; disputer gets bond back + half of proposer's bond |
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## After Resolution
|
||||
|
||||
Once a market resolves:
|
||||
|
||||
* **Trading stops** — You can no longer buy or sell tokens for this market
|
||||
* **Winning tokens** become redeemable for \$1.00 each
|
||||
* **Losing tokens** become worthless (\$0.00)
|
||||
|
||||
### Redeeming Tokens
|
||||
|
||||
After resolution, redeem through the CTF collateral adapter to exchange winning tokens for pUSD. The adapter burns your ERC1155 outcome tokens through the CTF contract, receives the released USDC.e collateral, wraps it into pUSD, and returns pUSD to your wallet.
|
||||
|
||||
```
|
||||
100 winning tokens → $100 pUSD
|
||||
```
|
||||
|
||||
## Clarifications
|
||||
|
||||
In rare cases, unforeseen circumstances require clarification of the rules after trading begins. Polymarket may issue an **"Additional context"** update that proposers and voters should consider during resolution.
|
||||
|
||||
Clarifications:
|
||||
|
||||
* Cannot change the fundamental intent of the question
|
||||
* Are published onchain via the bulletin board contract
|
||||
* Should be considered by UMA voters when resolving disputes
|
||||
|
||||
<Tip>
|
||||
If you believe a clarification is needed, request it in the [Polymarket
|
||||
Discord](https://discord.com/invite/polymarket) `#market-review` channel.
|
||||
</Tip>
|
||||
|
||||
## Resolution Timeline
|
||||
|
||||
| Phase | Duration |
|
||||
| --------------------------- | ----------- |
|
||||
| Challenge period | 2 hours |
|
||||
| Debate period (if disputed) | 24-48 hours |
|
||||
| UMA voting (if disputed) | \~48 hours |
|
||||
|
||||
**Undisputed resolution**: \~2 hours after proposal
|
||||
|
||||
**Disputed resolution**: 4-6 days total
|
||||
|
||||
## Contract Addresses
|
||||
|
||||
| Contract | Address | Network |
|
||||
| ---------------------- | -------------------------------------------- | --------------- |
|
||||
| **UmaCtfAdapter v3.0** | `0x157Ce2d672854c848c9b79C49a8Cc6cc89176a49` | Polygon Mainnet |
|
||||
| **UmaCtfAdapter v2.0** | `0x6A9D222616C90FcA5754cd1333cFD9b7fb6a4F74` | Polygon Mainnet |
|
||||
| **UmaCtfAdapter v1.0** | `0xCB1822859cEF82Cd2Eb4E6276C7916e692995130` | Polygon Mainnet |
|
||||
|
||||
## Resources
|
||||
|
||||
* [UMA Oracle Portal](https://oracle.uma.xyz/) — View and interact with proposals
|
||||
* [UMA Documentation](https://docs.uma.xyz/) — Learn more about the Optimistic Oracle
|
||||
* [Polymarket Discord](https://discord.com/invite/polymarket) — Discuss resolutions and request clarifications
|
||||
* [UmaCtfAdapter Source Code](https://github.com/Polymarket/uma-ctf-adapter) — Smart contract source
|
||||
* [UmaCtfAdapter Audit](https://github.com/Polymarket/uma-ctf-adapter/blob/main/audit/Polymarket_UMA_Optimistic_Oracle_Adapter_Audit.pdf) — Security audit report
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Positions & Tokens" icon="coins" href="/concepts/positions-tokens">
|
||||
Learn how to redeem winning tokens after resolution.
|
||||
</Card>
|
||||
|
||||
<Card title="Markets & Events" icon="calendar" href="/concepts/markets-events">
|
||||
Understand how markets are structured.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
Reference in New Issue
Block a user