Gnosis Developer Portal Conditional Tokens

Gnosis Developer Portal Conditional Tokens

  • Introduction
  • Use Case
  • Documentation
  • Tutorials
  • Support

›Conditional Tokes Tutorial

Conditional Tokes Tutorial

  • Introduction
  • Setup
  • Conditions
  • Bit Arrays
  • Basic Outcome Collections
  • Positions
  • Splitting From Collateral
  • Splitting Unions
  • Combining Outcome Collections
  • Splitting to Deeper Positions
  • Merging Positions
  • Transferring to EOA addresses
  • Transferring to Contract Addresses
  • Reporting Payouts
  • Basic Redemption
  • Deeper Redemptions
  • Reporting Scalar markets
  • Scalar Redemptions

Merging Positions


The splitPosition() function has a corresponding inverse called mergePosition() which does exactly what it sounds like, merge equal amounts positions into their underlying collateral or positions.

First, let's merge conditional tokens representing (A) and conditional tokens representing (B|C) back into the ToyToken collateral backing those positions.

mergePosition() has the following parameters:

  • colleteralToken: the address of the collateral token.
  • parantCollectionId: the bytes32 ID of the parent collection. Zeros if you are merging back to collateral 0x0000000000000000000000000000000000000000000000000000000000000000, or the collection ID of the position you would like to merge back into.
  • conditionId: the bytes32 ID of the condition who's positions you are be merging.
  • partition: an array of outcome index sets that define how the outcome slots have been partitioned.
  • amount: the amount of each position that you are merging.

After merging (A) and (B|C) into their underlying collateral token, try merging. (A) & (hi) and (A) and (low) to receive the underlying positions (A),(hi), and (low).

Try calling balanceOfBatch() with each of the position IDs before and after each merge to see how it affects the balances of your positions.


← Splitting to Deeper PositionsTransferring to EOA addresses →
Gnosis Ltd.
ImprintCopyright
© 2020 Gnosis LTD
Privacy Policy
Copyright © 2025 Gnosis LTD