Gnosis Developer Portal Conditional Tokens

Gnosis Developer Portal Conditional Tokens

  • Introduction
  • Use Case
  • Documentation
  • Tutorials
  • Support

›Developer Guide

Developer Guide

  • Getting Started
  • Preparing a Condition
  • Outcome Collection
  • Defining Positions
  • Splitting and Merging Positions
  • Querying and Transferring Stake
  • Redeeming Positions

Querying and Transferring Stake

The ConditionalTokens contract implements the ERC1155 multitoken interface. In addition to a holder address, each token is indexed by an ID in this standard. In particular, position IDs are used to index conditional tokens. This is reflected in the balance querying function:

function balanceOf (address owner, uint256 positionId) external view returns (uint256)

To transfer conditional tokens, the following functions may be used, as per ERC1155:

function safeTransferFrom (address from, address to, uint256 positionId, uint256 value, bytes data)  external function safeBatchTransferFrom (address from, address to, uint256[] positionIds, uint256[] values, bytes data)  external

These transfer functions ignore the data parameter.

Note When sending to contract accounts, transfers will be rejected unless the recipient implements the ERC1155TokenReceiver interface and returns the expected magic values. See the ERC1155 multitoken spec for more information.

Approving an operator account to transfer conditional tokens on your behalf may also be done via:

function setApprovalForAll (address operator, bool approved) external

Querying the status of approval can be done with:

function isApprovalForAll (address owner, address operator) external view returns (bool)

← Splitting and Merging PositionsRedeeming Positions →
Gnosis Ltd.
ImprintCopyright
© 2020 Gnosis LTD
Privacy Policy
Copyright © 2025 Gnosis LTD