Polymarket Conditional Tokens

Polygon PoS Polymarket

0x4d97dcd97ec945f40cf65f87097ace5ea0476045

Solidity v0.5.10+commit.5a6ea5b1

🤖
通过你的 AI 查询此合约
引用: polymarket-conditional-tokens-polygon 0x4d97dcd97ec945f40cf65f87097ace5ea0476045
示例提示词: "Tell me the current state of polymarket-conditional-tokens-polygon"
还没有接入 AI?→ mcp.smarts.md

管理与风险

谁能修改规则?

No admin risk controls detected from the verified ABI.

Polymarket 合约治理
让你的 AI 查询谁可以暂停、升级或更改此 Polymarket 合约的角色。

架构

Polymarket 合约角色

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

概览

读取函数
10
写入函数
8
事件
9

读取函数

balanceOf(owner: address, id: uint256) view

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

开发者: Returns the amount of tokens owned by `account`.

参数

名称 类型 描述
owner address Address owning the outcome tokens.✨ AI
id uint256 ERC-1155 token id encoding the condition and outcome index.✨ AI

返回值

名称 类型 描述
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

开发者: 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.

参数

名称 类型 描述
interfaceId bytes4 Interface identifier to query, as defined by ERC-165.✨ AI

返回值

名称 类型 描述
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 上下文 Stores each outcome's share of the final payout vector for a resolved condition.

参数

名称 类型 描述
bytes32
uint256

返回值

名称 类型 描述
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

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

参数

名称 类型 描述
collateralToken address Collateral token which backs the position.
collectionId bytes32 ID of the outcome collection associated with this position.

返回值

名称 类型 描述
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

开发者: Get the balance of multiple account/token pairs

参数

名称 类型 描述
owners address[] The addresses of the token holders
ids uint256[] IDs of the tokens

返回值

名称 类型 描述
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

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

参数

名称 类型 描述
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.

返回值

名称 类型 描述
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

开发者: Constructs an outcome collection ID from a parent collection and an outcome collection.

参数

名称 类型 描述
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.

返回值

名称 类型 描述
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

开发者: Gets the outcome slot count of a condition.

参数

名称 类型 描述
conditionId bytes32 ID of the condition.

返回值

名称 类型 描述
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 上下文 Non-zero means the condition has a final on-chain payout vector and can be audited from CTF state.

参数

名称 类型 描述
bytes32

返回值

名称 类型 描述
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.

参数

名称 类型 描述
owner address The owner of the Tokens
operator address Address of authorized operator

返回值

名称 类型 描述
bool True if the operator is approved, false if not

写入函数

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 上下文 Redeems winning or partially winning outcome tokens after a condition has resolved.

参数

名称 类型 描述
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

开发者: 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.

参数

名称 类型 描述
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

开发者: 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.

参数

名称 类型 描述
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

参数

名称 类型 描述
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

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

参数

名称 类型 描述
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 上下文 Writes the final outcome payout vector into Conditional Tokens after oracle resolution.

开发者: 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.

参数

名称 类型 描述
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 上下文 Creates the CTF condition that will later hold outcome payout data for a Polymarket market.

开发者: This function prepares a condition by initializing a payout vector associated with the condition.

参数

名称 类型 描述
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

开发者: 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.

参数

名称 类型 描述
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

事件

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

Polymarket 上下文 A new Conditional Tokens condition was prepared for a market.

名称 类型 已索引 描述
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 上下文 A condition received its final on-chain payout vector.

名称 类型 已索引 描述
conditionId bytes32
oracle address
questionId bytes32
outcomeSlotCount uint256
payoutNumerators uint256[]
PositionSplit(stakeholder: address, collateralToken: address, parentCollectionId: bytes32, conditionId: bytes32, partition: uint256[], amount: uint256)
名称 类型 已索引 描述
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)
名称 类型 已索引 描述
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 上下文 Outcome tokens were redeemed after resolution.

名称 类型 已索引 描述
redeemer address
collateralToken address
parentCollectionId bytes32
conditionId bytes32
indexSets uint256[]
payout uint256
TransferSingle(operator: address, from: address, to: address, id: uint256, value: uint256)
名称 类型 已索引 描述
operator address
from address
to address
id uint256
value uint256
TransferBatch(operator: address, from: address, to: address, ids: uint256[], values: uint256[])
名称 类型 已索引 描述
operator address
from address
to address
ids uint256[]
values uint256[]
ApprovalForAll(owner: address, operator: address, approved: bool)
名称 类型 已索引 描述
owner address
operator address
approved bool
URI(value: string, id: uint256)
名称 类型 已索引 描述
value string
id uint256