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 question has not ended, its universe has not forked, and the SecurityPool is
Operationaland unresolved. - The smaller deposit must exceed
MINIMUM_LIQUIDITY(1,000 share base units). The trading pool mints that many LP base units to a lock address that no key controls, so you receive the smaller deposit minus 1,000.
The pair reference lists the remaining preconditions of initialize.
Seed the trading pool
- Create complete sets by sending ETH to the SecurityPool's
createCompleteSet(). Letqbe the Yes balance it minted to you, in share base units; the ETH-to-share rate is not fixed, so read the balance. - Create the trading pool with the factory's
createPair(securityPool), unless it already exists. -
Choose the Conditional Yes price
pin basis points with0 < p < 10,000and compute the deposits:- If
p ≥ 5,000, deposit allqNo and⌊q × (10,000 − p) / p⌋Yes. - If
p < 5,000, deposit allqYes and⌊q × p / (10,000 − p)⌋No.
- If
- Approve the trading pool as an operator on the canonical ShareToken with
setApprovalForAll;initializepulls both deposits from the caller. - Call
initialize(yesAmount, noAmount, minLiquidity, recipient)on the trading pool with those deposits. SetminLiquidityto the smaller deposit minus 1,000. - Check the result:
getReserves()returns your two deposits andtradingStatus()returnsOpen. Ifinitializereverted withAlready 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.