How-to guide

Seed alternative conditional odds

Use this guide when you call the trading pool contract (the pair) yourself and want a new trading pool to open at a specific Conditional Yes price rather than 50%.

Before you call initialize

Creating the trading pool and initializing it directly are separate transactions, so anyone can initialize it first at another price. Prefer the router's createPairAndInitializeWithEth, which creates and seeds in one transaction and takes the price in basis points; the UI's Initialize form uses it, as Your first Trading market shows. Continue only if you must call initialize yourself.

The pair reference lists the remaining preconditions of initialize.

Seed the trading pool

  1. Create complete sets by sending ETH to the SecurityPool's createCompleteSet(). Let q be the Yes balance it minted to you, in share base units; the ETH-to-share rate is not fixed, so read the balance.
  2. Create the trading pool with the factory's createPair(securityPool), unless it already exists.
  3. Choose the Conditional Yes price p in basis points with 0 < p < 10,000 and compute the deposits:
    • If p ≥ 5,000, deposit all q No and ⌊q × (10,000 − p) / p⌋ Yes.
    • If p < 5,000, deposit all q Yes and ⌊q × p / (10,000 − p)⌋ No.
  4. Approve the trading pool as an operator on the canonical ShareToken with setApprovalForAll; initialize pulls both deposits from the caller.
  5. Call initialize(yesAmount, noAmount, minLiquidity, recipient) on the trading pool with those deposits. Set minLiquidity to the smaller deposit minus 1,000.
  6. Check the result: getReserves() returns your two deposits and tradingStatus() returns Open. If initialize reverted with Already initialized, someone else seeded the trading pool first.

Conditional pricing works through the 70% example and explains why the larger reserve is the side you are betting against.