Skip to main content

CTWrapper Interaction Guide

The CTWrapper is the primary entry point for converting Conditional Tokens (ERC1155) into tradeable ERC20 assets. This guide covers the key interactions for developers.

Contract Addresses

For deployment addresses, please refer to the Deployments page.

Key Methods

1. Wrapping Tokens

To wrap tokens, you must first have the underlying ERC1155 tokens from the Conditional Tokens Framework.
Parameters:
  • conditionId: The unique identifier of the condition (question).
  • amounts: An array of amounts to wrap for each outcome slot.
Example (Ethers.js):

2. Unwrapping Tokens

Unwrapping burns the ERC20 tokens and returns the underlying ERC1155s.
Note: In the current implementation, unwrap typically unwraps a specific amount of all outcome tokens associated with that condition back to the user’s wallet.

3. Deploying Converted Tokens

Before a condition can be traded, its ERC20 representations must be deployed.
  • Determinism: This uses CREATE3, so the address is deterministic based on the conditionId.
  • First Settler: The first person to call this sets the name/symbol, but the address is constant.

Event Listeners

Listen for TokenDeployed events to discover new markets.
This is indexed by The Graph/Goldsky to populate the frontend.