Polymarket Conditional Tokens

Polygon PoS Polymarket

0x4d97dcd97ec945f40cf65f87097ace5ea0476045

Solidity v0.5.10+commit.5a6ea5b1

🤖
Query this contract from your AI
Reference: polymarket-conditional-tokens-polygon 0x4d97dcd97ec945f40cf65f87097ace5ea0476045
Sample prompt: "Tell me the current state of polymarket-conditional-tokens-polygon"
No AI wired up yet? → mcp.smarts.md

Admin & Risk

Who can change the rules?

No admin risk controls detected from the verified ABI.

Polymarket contract governance
Ask your AI who can pause, upgrade, or change roles on this Polymarket contract.

Architecture

Polymarket contract role

Polymarket Conditional Tokens

polymarket-conditional-tokens-polygon

Holds Polymarket outcome balances as ERC-1155 conditional tokens and stores the final payout vector for resolved conditions.

Prepared condition Outcome ERC-1155 balances Resolution payout vector Redemption

Overview

Read Functions
10
Write Functions
8
Events
9

Read Functions

balanceOf(owner: address, id: uint256) view

Get the ERC-1155 balance of a specific outcome token id for a given owner.✨ AI

dev: Returns the amount of tokens owned by `account`.

Parameters

Name Type Description
owner address Address owning the outcome tokens.✨ AI
id uint256 ERC-1155 token id encoding the condition and outcome index.✨ AI

Returns

Name Type Description
uint256 The number of outcome tokens the owner holds for the specified id.✨ AI
supportsInterface(interfaceId: bytes4) view

Reports whether the contract implements a given ERC-165 interface ID.✨ AI

dev: Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.

Parameters

Name Type Description
interfaceId bytes4 Interface identifier to query, as defined by ERC-165.✨ AI

Returns

Name Type Description
bool True if the contract implements the interface with the given id, otherwise false.✨ AI
payoutNumerators(bytes32, uint256) view

Return the payout numerator for a specific condition and outcome.✨ AI

Polymarket context Stores each outcome's share of the final payout vector for a resolved condition.

Parameters

Name Type Description
bytes32
uint256

Returns

Name Type Description
uint256 The uint256 payout numerator for the given condition and outcome.✨ AI
getPositionId(collateralToken: address, collectionId: bytes32) pure

Compute the ERC-1155 position id for a collateral token and an outcome collection.✨ AI

dev: Constructs a position ID from a collateral token and an outcome collection. These IDs are used as the ERC-1155 ID for this contract.

Parameters

Name Type Description
collateralToken address Collateral token which backs the position.
collectionId bytes32 ID of the outcome collection associated with this position.

Returns

Name Type Description
uint256 The ERC-1155 position id that uniquely identifies the position for the given collateral and collection.✨ AI
balanceOfBatch(owners: address[], ids: uint256[]) view

Returns balances for multiple owners and token ids in a single call.✨ AI

dev: Get the balance of multiple account/token pairs

Parameters

Name Type Description
owners address[] The addresses of the token holders
ids uint256[] IDs of the tokens

Returns

Name Type Description
uint256[] Balances for each owner and token id pair
getConditionId(oracle: address, questionId: bytes32, outcomeSlotCount: uint256) pure

Compute the unique condition id used to identify a condition from oracle, questionId, and outcomeSlotCount.✨ AI

dev: Constructs a condition ID from an oracle, a question ID, and the outcome slot count for the question.

Parameters

Name Type Description
oracle address The account assigned to report the result for the prepared condition.
questionId bytes32 An identifier for the question to be answered by the oracle.
outcomeSlotCount uint256 The number of outcome slots which should be used for this condition. Must not exceed 256.

Returns

Name Type Description
bytes32 bytes32 condition id computed from oracle, questionId, and outcomeSlotCount.✨ AI
getCollectionId(parentCollectionId: bytes32, conditionId: bytes32, indexSet: uint256) view

Compute the collection id for a conditional tokens collection.✨ AI

dev: Constructs an outcome collection ID from a parent collection and an outcome collection.

Parameters

Name Type Description
parentCollectionId bytes32 Collection ID of the parent outcome collection, or bytes32(0) if there's no parent.
conditionId bytes32 Condition ID of the outcome collection to combine with the parent outcome collection.
indexSet uint256 Index set of the outcome collection to combine with the parent outcome collection.

Returns

Name Type Description
bytes32 bytes32 collection id derived from parentCollectionId, conditionId, and indexSet.✨ AI
getOutcomeSlotCount(conditionId: bytes32) view

Return the number of outcome slots defined for a given condition.✨ AI

dev: Gets the outcome slot count of a condition.

Parameters

Name Type Description
conditionId bytes32 ID of the condition.

Returns

Name Type Description
uint256 Number of outcome slots associated with a condition, or zero if condition has not been prepared yet.
payoutDenominator(bytes32) view

Get the payout denominator for the given condition ID.✨ AI

Polymarket context Non-zero means the condition has a final on-chain payout vector and can be audited from CTF state.

Parameters

Name Type Description
bytes32

Returns

Name Type Description
uint256 The payout denominator for the condition, used to scale the payout vector (uint256).✨ AI
isApprovedForAll(owner: address, operator: address) view

Queries the approval status of an operator for a given owner.

Parameters

Name Type Description
owner address The owner of the Tokens
operator address Address of authorized operator

Returns

Name Type Description
bool True if the operator is approved, false if not

Write Functions

redeemPositions(collateralToken: address, parentCollectionId: bytes32, conditionId: bytes32, indexSets: uint256[]) nonpayable

Redeem conditional token positions for a resolved condition and receive the underlying collateral.✨ AI

Polymarket context Redeems winning or partially winning outcome tokens after a condition has resolved.

Parameters

Name Type Description
collateralToken address Address of the ERC20 token used as collateral for the condition.✨ AI
parentCollectionId bytes32 ID of the parent collection grouping related partitioned positions.✨ AI
conditionId bytes32 ID of the resolved condition whose payouts are being redeemed.✨ AI
indexSets uint256[] Array of index sets specifying which outcome position tokens to burn and redeem.✨ AI
safeBatchTransferFrom(from: address, to: address, ids: uint256[], values: uint256[], data: bytes) nonpayable

Transfers multiple conditional outcome ERC-1155 tokens from one account to another in a single call.✨ AI

dev: Transfers `values` amount(s) of `ids` from the `from` address to the `to` address specified. Caller must be approved to manage the tokens being transferred out of the `from` account. If `to` is a smart contract, will call `onERC1155BatchReceived` on `to` and act appropriately.

Parameters

Name Type Description
from address Source address
to address Target address
ids uint256[] IDs of each token type
values uint256[] Transfer amounts per token type
data bytes Data forwarded to `onERC1155Received` if `to` is a contract receiver
splitPosition(collateralToken: address, parentCollectionId: bytes32, conditionId: bytes32, partition: uint256[], amount: uint256) nonpayable

Split a collateral position into outcome tokens for a specified condition partition.✨ AI

dev: This function splits a position. If splitting from the collateral, this contract will attempt to transfer `amount` collateral from the message sender to itself. Otherwise, this contract will burn `amount` stake held by the message sender in the position being split worth of EIP 1155 tokens. Regardless, if successful, `amount` stake will be minted in the split target positions. If any of the transfers, mints, or burns fail, the transaction will revert. The transaction will also revert if the given partition is trivial, invalid, or refers to more slots than the condition is prepared with.

Parameters

Name Type Description
collateralToken address The address of the positions' backing collateral token.
parentCollectionId bytes32 The ID of the outcome collections common to the position being split and the split target positions. May be null, in which only the collateral is shared.
conditionId bytes32 The ID of the condition to split on.
partition uint256[] An array of disjoint index sets representing a nontrivial partition of the outcome slots of the given condition. E.g. A|B and C but not A|B and B|C (is not disjoint). Each element's a number which, together with the condition, represents the outcome collection. E.g. 0b110 is A|B, 0b010 is B, etc.
amount uint256 The amount of collateral or stake to split.
mergePositions(collateralToken: address, parentCollectionId: bytes32, conditionId: bytes32, partition: uint256[], amount: uint256) nonpayable

Merge multiple conditional token positions into a single position for the specified condition and collateral.✨ AI

Parameters

Name Type Description
collateralToken address Address of the ERC20 token used as collateral for the positions.✨ AI
parentCollectionId bytes32 Parent collection id that identifies the collection receiving merged tokens.✨ AI
conditionId bytes32 Identifier of the condition whose outcome positions are merged.✨ AI
partition uint256[] Array of outcome index sets (uint256[]) specifying which positions to merge.✨ AI
amount uint256 Amount of each position to merge, denominated in the collateral token.✨ AI
setApprovalForAll(operator: address, approved: bool) nonpayable

Authorize or revoke an operator to manage all of the caller's conditional token balances.✨ AI

dev: Sets or unsets the approval of a given operator An operator is allowed to transfer all tokens of the sender on their behalf

Parameters

Name Type Description
operator address address to set the approval
approved bool representing the status of the approval to be set
reportPayouts(questionId: bytes32, payouts: uint256[]) nonpayable

Report final payouts for a resolved question and store its outcome payout vector.✨ AI

Polymarket context Writes the final outcome payout vector into Conditional Tokens after oracle resolution.

dev: Called by the oracle for reporting results of conditions. Will set the payout vector for the condition with the ID ``keccak256(abi.encodePacked(oracle, questionId, outcomeSlotCount))``, where oracle is the message sender, questionId is one of the parameters of this function, and outcomeSlotCount is the length of the payouts parameter, which contains the payoutNumerators for each outcome slot of the condition.

Parameters

Name Type Description
questionId bytes32 The question ID the oracle is answering for
payouts uint256[] The oracle's answer
prepareCondition(oracle: address, questionId: bytes32, outcomeSlotCount: uint256) nonpayable

Register a new conditional market so outcome ERC-1155 tokens can be created for a given oracle and question.✨ AI

Polymarket context Creates the CTF condition that will later hold outcome payout data for a Polymarket market.

dev: This function prepares a condition by initializing a payout vector associated with the condition.

Parameters

Name Type Description
oracle address The account assigned to report the result for the prepared condition.
questionId bytes32 An identifier for the question to be answered by the oracle.
outcomeSlotCount uint256 The number of outcome slots which should be used for this condition. Must not exceed 256.
safeTransferFrom(from: address, to: address, id: uint256, value: uint256, data: bytes) nonpayable

Safely transfers a specified amount of a conditional outcome ERC-1155 token from one address to another.✨ AI

dev: Transfers `value` amount of an `id` from the `from` address to the `to` address specified. Caller must be approved to manage the tokens being transferred out of the `from` account. If `to` is a smart contract, will call `onERC1155Received` on `to` and act appropriately.

Parameters

Name Type Description
from address Source address
to address Target address
id uint256 ID of the token type
value uint256 Transfer amount
data bytes Data forwarded to `onERC1155Received` if `to` is a contract receiver

Events

ConditionPreparation(conditionId: bytes32, oracle: address, questionId: bytes32, outcomeSlotCount: uint256)

Polymarket context A new Conditional Tokens condition was prepared for a market.

Name Type Indexed Description
conditionId bytes32 The condition's ID. This ID may be derived from the other three parameters via ``keccak256(abi.encodePacked(oracle, questionId, outcomeSlotCount))``.
oracle address The account assigned to report the result for the prepared condition.
questionId bytes32 An identifier for the question to be answered by the oracle.
outcomeSlotCount uint256 The number of outcome slots which should be used for this condition. Must not exceed 256.
ConditionResolution(conditionId: bytes32, oracle: address, questionId: bytes32, outcomeSlotCount: uint256, payoutNumerators: uint256[])

Polymarket context A condition received its final on-chain payout vector.

Name Type Indexed Description
conditionId bytes32
oracle address
questionId bytes32
outcomeSlotCount uint256
payoutNumerators uint256[]
PositionSplit(stakeholder: address, collateralToken: address, parentCollectionId: bytes32, conditionId: bytes32, partition: uint256[], amount: uint256)
Name Type Indexed Description
stakeholder address
collateralToken address
parentCollectionId bytes32
conditionId bytes32
partition uint256[]
amount uint256
PositionsMerge(stakeholder: address, collateralToken: address, parentCollectionId: bytes32, conditionId: bytes32, partition: uint256[], amount: uint256)
Name Type Indexed Description
stakeholder address
collateralToken address
parentCollectionId bytes32
conditionId bytes32
partition uint256[]
amount uint256
PayoutRedemption(redeemer: address, collateralToken: address, parentCollectionId: bytes32, conditionId: bytes32, indexSets: uint256[], payout: uint256)

Polymarket context Outcome tokens were redeemed after resolution.

Name Type Indexed Description
redeemer address
collateralToken address
parentCollectionId bytes32
conditionId bytes32
indexSets uint256[]
payout uint256
TransferSingle(operator: address, from: address, to: address, id: uint256, value: uint256)
Name Type Indexed Description
operator address
from address
to address
id uint256
value uint256
TransferBatch(operator: address, from: address, to: address, ids: uint256[], values: uint256[])
Name Type Indexed Description
operator address
from address
to address
ids uint256[]
values uint256[]
ApprovalForAll(owner: address, operator: address, approved: bool)
Name Type Indexed Description
owner address
operator address
approved bool
URI(value: string, id: uint256)
Name Type Indexed Description
value string
id uint256