BTB
/

Polymarket

Prediction Marketwebsite
Prediction market on Polygon. Agents discover markets with the Gamma API, trade outcome shares through the off-chain CLOB (EIP-712-signed orders settled on-chain by the CTF Exchange contracts), read positions from the Data API, and split/merge/redeem outcome tokens against pUSD collateral directly on-chain.

What you can do

find marketsSearch events/markets and get token idsGET https://gamma-api.polymarket.com/public-search?q=... or /markets/slug/{slug}; read conditionId, clobTokenIds (v1) or positionIds (v2), version; then GET https://clob.polymarket.com/book?token_id= for tick_size and neg_risk.
get pUSDFund the trading wallet with collateralUSDC.e.approve(CollateralOnramp, amt) then CollateralOnramp.wrap(USDC.e, to, amt); or use the Bridge API deposit addresses from other chains (auto-wraps to pUSD).
approve tradingOne-time approvals before tradingpUSD.approve(CTF Exchange / Neg Risk Exchange) for BUY; ConditionalTokens.setApprovalForAll(exchange, true) for SELL; for neg-risk markets also approve the Neg Risk Adapter 0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296 (pUSD and Conditional Tokens). For v2 books: pUSD.approve(ExchangeV3) and PositionManager.setApprovalForAll(ExchangeV3, true). Existing CTF approvals do not carry over to v2.
place orderBuy or sell outcome sharesDerive L2 API creds (L1 ClobAuth signature), build and EIP-712-sign an Order for the correct exchange domain, POST https://clob.polymarket.com/order with L2 headers and {order, owner: apiKey, orderType: GTC|GTD|FOK|FAK}.
cancel orderCancel one, several or all ordersDELETE https://clob.polymarket.com/order {orderID}, DELETE /orders, DELETE /cancel-market-orders, or DELETE /cancel-all, with L2 headers. On-chain emergency: exchange.pauseUser().
read positionsList a wallet's positions and valueGET https://data-api.polymarket.com/v2/positions?user=<address> and /v2/value?user=; on-chain ConditionalTokens.balanceOf(user, tokenId).
split / mergeMint or burn complete YES+NO setsv1 standard: CtfCollateralAdapter.splitPosition/mergePositions(pUSD, 0x0, conditionId, [1,2], amount); v1 neg-risk: NegRiskCtfCollateralAdapter (same signatures); v2: Router.split/merge(bytes31 conditionId, amount).
redeemClaim pUSD for winning shares after resolutionv1: CtfCollateralAdapter or NegRiskCtfCollateralAdapter .redeemPositions(pUSD, 0x0, conditionId, [1,2]) after ConditionalTokens.setApprovalForAll(adapter, true); v2: Router.redeem(conditionId, outcomeIndex, amount) after PositionManager.setApprovalForAll(Router, true).
withdrawTurn pUSD back into USDC.epUSD.approve(CollateralOfframp, amt) then CollateralOfframp.unwrap(USDC.e, to, amt); or use the Bridge API withdraw flow to other chains.
Geographic restrictions (official geoblock docs, 'due to regulatory requirements and compliance with international sanctions'): fully blocked (frontend and API, no new or closing orders) in Iran, Syria, Cuba, North Korea, and Crimea/Donetsk/Luhansk; close-only on frontend AND API in many countries incl. United States, United Kingdom, France, Germany, Italy, Belgium, Poland, Australia, Singapore, Taiwan, Thailand, Russia, Brazil, Argentina, New Zealand, Canada (Ontario, Quebec, British Columbia, Alberta) and others; close-only on frontend only in Ireland, Japan, Netherlands, South Korea, Malta (sports). Check GET https://polymarket.com/api/geoblock before trading.
Polymarket migrated to pUSD collateral and Protocol V2: markets can be v1 (CTF) or v2 (PositionManager); they use different exchanges, EIP-712 domain versions ('2' vs '3'), approvals and split/merge contracts. Check the market's version and neg_risk before acting.
Orders priced off the current tick size are rejected; GTD orders expire one minute before their stated expiration.
Resolution relies on oracles (UMA Optimistic Oracle adapters, OracleAggregator); disputes can delay payouts.

Contracts

Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).
CTF Exchange (CTFExchangeV2, standard binary markets)exchange on polygon0xE111180000d2663C0091e4f400237545B87B996B
read getOrderStatus(bytes32)
Fill status of an order by hash: (bool filled, uint248 remaining).
read hashOrder((uint256,address,address,uint256,uint256,uint256,uint8,uint8,uint256,bytes32,bytes32,bytes))
EIP-712 hash of an Order {salt, maker, signer, tokenId, makerAmount, takerAmount, side (0 BUY/1 SELL), signatureType (0 EOA,1 POLY_PROXY,2 POLY_GNOSIS_SAFE,3 POLY_1271), timestamp (ms), metadata, builder, signature}. Domain: name 'Polymarket CTF Exchange', version '2', chainId 137, verifyingContract = this address.
read validateOrder((uint256,address,address,uint256,uint256,uint256,uint8,uint8,uint256,bytes32,bytes32,bytes))
Reverts if the order is invalid (bad signature, filled, paused, etc.). Useful to pre-check before posting to the CLOB.
read isUserPaused(address)
Whether a user has self-paused trading.
write pauseUser()
Self-pause: stops the caller's orders from being matched after a block delay (default 100 blocks). On-chain kill switch; V2 removed nonce-based on-chain cancel - cancel normally via the CLOB API.
write unpauseUser()
Undo pauseUser.
read getCollateral()
Collateral token used for settlement (pUSD).
read getCtf()
Conditional Tokens contract used for outcome tokens.
Neg Risk CTF Exchange (NegRiskCtfExchangeV2, multi-outcome markets)exchange on polygon0xe2222d279d744050d28e00520010520000310F59
read getOrderStatus(bytes32)
Fill status of an order by hash.
read hashOrder((uint256,address,address,uint256,uint256,uint256,uint8,uint8,uint256,bytes32,bytes32,bytes))
EIP-712 order hash. Domain: name 'Polymarket CTF Exchange', version '2', chainId 137, verifyingContract = this address. Used when the book's neg_risk is true.
write pauseUser()
Self-pause the caller's trading (on-chain kill switch).
read isUserPaused(address)
Whether a user has self-paused.
Neg Risk Adapterother on polygon0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296
read getConditionId(bytes32)
CTF conditionId for a neg-risk questionId.
read getPositionId(bytes32,bool)
ERC1155 position (token) id for a questionId and outcome (true = YES).
read balanceOf(address,uint256)
Outcome-token balance (passes through to Conditional Tokens).
write convertPositions(bytes32,uint256,uint256)
Convert NO positions (marketId, indexSet bitmask of questions, amount) into the complementary YES positions plus collateral. With pUSD collateral, docs route conversions through NegRiskCtfCollateralAdapter.convertPositions instead.
Conditional Tokens (CTF, ERC1155 outcome tokens for v1 markets)token on polygon0x4D97DCd97eC945f40cF65F87097ACe5EA0476045
read balanceOf(address,uint256)
Outcome-share balance for a token id (clobTokenIds from Gamma).
write setApprovalForAll(address,bool)
Required approvals: the CTF Exchange / Neg Risk Exchange to SELL, the Neg Risk Adapter for neg-risk markets, and the selected collateral adapter to merge/redeem.
read isApprovedForAll(address,address)
Check operator approval.
write safeTransferFrom(address,address,uint256,uint256,bytes)
Transfer outcome shares.
read payoutDenominator(bytes32)
Non-zero once a condition has resolved.
read payoutNumerators(bytes32,uint256)
Payout weight per outcome index after resolution.
read getOutcomeSlotCount(bytes32)
Number of outcomes of a condition (0 if not prepared).
read getCollectionId(bytes32,bytes32,uint256)
Collection id from parentCollectionId (0x0), conditionId and indexSet.
read getPositionId(address,bytes32)
Position/token id from collateral token and collection id.
pUSD (Polymarket USD, CollateralToken) - trading collateraltoken on polygon0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB
write approve(address,uint256)
Approve the CTF Exchange / Neg Risk Exchange (BUY orders, incl. fees), ExchangeV3 (v2 markets), the Router or a collateral adapter (split), or the Offramp (unwrap). 6 decimals.
read balanceOf(address)
pUSD balance (6 decimals).
read allowance(address,address)
Check an approval.
write transfer(address,uint256)
Standard ERC20 transfer.
CollateralOnramp (USDC.e -> pUSD)other on polygon0x93070a847efEf7F70739046A929D47a521F5B8ee
write wrap(address,address,uint256)
Mint pUSD 1:1. Args: _asset = USDC.e, _to = recipient, _amount (6 decimals). Approve this Onramp (not pUSD) to spend USDC.e first. Reverts OnlyUnpaused() if paused.
CollateralOfframp (pUSD -> USDC.e)other on polygon0x2957922Eb93258b93368531d39fAcCA3B4dC5854
write unwrap(address,address,uint256)
Burn pUSD for USDC.e. Args: _asset = USDC.e, _to = recipient, _amount of pUSD (6 decimals). Approve this Offramp to spend pUSD first.
USDC.e (bridged USDC, Polygon) - asset wrapped into pUSDtoken on polygon0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
write approve(address,uint256)
Approve CollateralOnramp before wrap.
read balanceOf(address)
USDC.e balance (6 decimals).
Router (Polymarket Protocol V2)router on polygon0x12121212006e4CD160D18e3f00711DA5c3372600
write split(bytes31,uint256)
V2 markets: split pUSD into YES+NO. conditionId is the 31-byte V2 id (positionId >> 8); amount in 6 decimals. Approve pUSD to the Router first.
write merge(bytes31,uint256)
V2 markets: merge YES+NO into pUSD. Needs PositionManager setApprovalForAll(Router, true).
write redeem(bytes31,uint256,uint256)
V2 markets: redeem (conditionId, outcomeIndex 0 = YES / 1 = NO, amount); one call per outcome.
PositionManager (Polymarket Protocol V2 position ledger)token on polygon0x006F54F7f9A22e0000CC2AB60031000000ae9fEF
write setApprovalForAll(address,bool)
Approve the Router (merge/redeem), ExchangeV3 (SELL orders on v2 books) or AutoRedeemer as operator.
read getPayout(uint256,uint256)
pUSD payout for redeeming amount of positionId.
ExchangeV3 (Polymarket Protocol V2 order book settlement)exchange on polygon0xe3333700cA9d93003F00f0F71f8515005F6c00Aa
AutoRedeemer (Polymarket Protocol V2)other on polygon0xa1200000d0002264C9a1698e001292D00E1b00af