Explanation

The two-way market

Statoblast Trading is the two-reserve constant-product design from How To Build: Augur Constant Product with Invalid Insurance, adapted to the current Zoltar protocol. This page explains what happens inside one entry.

Mental model

A Zoltar SecurityPool holds ETH collateral for one question in one universe branch. Its canonical ShareToken is ERC-1155: creating one complete set mints equal INVALID, YES, and NO shares for that pool's universe-specific token IDs; redeeming a complete set burns those three shares and returns collateral at the pool's current dynamic rate.

The Trading factory maps the exact SecurityPool address to one immutable-fee pair. The pair is both the YES/NO constant-product reserve and the transferable LP token; it never accepts INVALID. The stateless router coordinates complete-set creation or redemption, pair swaps, and bounded asset delivery. Users and liquidity providers keep INVALID separately in their wallets. The invariant to remember is:

shareToken.balanceOf(pair,invalidTokenId)=0

Trading and added liquidity are open only while the question has not ended, the pool is operational, its universe has not forked, no continuation is pending, and no outcome is final. Raw LP removal remains available after closure. Parent and child SecurityPools are distinct markets and therefore use distinct pairs.

One entry, step by step

The pair maintains k = YES reserve × NO reserve. Entering YES looks like this; entering NO is the mirror image.

  1. User → Router: enterPosition(pair, YES) with ETH
  2. Router → SecurityPool: createCompleteSet{value: ETH}()
  3. SecurityPool → Router: q INVALID + q YES + q NO
  4. Router → Pair: swap q NO for YES
  5. Pair → Router: additional YES
  6. Router → User: q INVALID + total YES
Entering a YES position. The trader ends up holding the INVALID from the complete set; the pair never sees it.

Suppose the reserves are 1,000 YES and 1,000 NO, the fee is zero, and 100 complete-set shares are created. Contract math uses attoShares, where one displayed share is 1018 attoShares. Swapping 100 NO therefore yields 90.909090909090909090 YES after flooring to a whole number of attoShares. The wallet receives 190.909090909090909090 YES and 100 INVALID; the reserves become 909.090909090909090910 YES and 1,100 NO. Flooring the output favors existing liquidity providers.

A NO purchase simply reverses the reserves. No position record is created anywhere: wallet YES, NO, INVALID, and LP balances are the complete accounting state.