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

Bit Arrays


In order to proceed, we need to talk quickly about bit arrays. Bit arrays are exactly how they sound, they are just an array of bits. They are useful for indicating whether something is included in a set or not.

Let's explore how bitwise operations affect numbers, quickly.

For example, a bit wise AND will only allow the bits that both values share in their respective places.

0b110 & 0b011 = 0b010

Bitwise OR will have a bit switched on every place that is switched on either value.

0b110 | 0b011 = 0b111

A bit wise, exclusive OR will leave a bit on only if exactly one of the bits are on in both values.

0b110 ^ 0b011 = 0b101

We use bit arrays to indicate whether or not an outcome is part of a specific set of outcomes.

One very efficient way to represent bit arrays is with unsigned integers, like so.

0b001 == 1
0b010 == 2
0b011 == 3
0b100 == 4
0b101 == 5
0b111 == 6

Now that we have an idea of what bit arrays are, we can talk about index sets and outcome collections.

← ConditionsBasic Outcome Collections →
Gnosis Ltd.
ImprintCopyright
© 2020 Gnosis LTD
Privacy Policy
Copyright © 2025 Gnosis LTD