Reference

Trading contracts

All Trading contracts compile with Solidity 0.8.35 for Osaka. Revert strings are operational diagnostics, not stable compatibility commitments.

TwoWayConstantProductFactory

Canonical validation requires the pool's own securityPoolFactory, the factory's (originId, universeId) lookup, and shareToken.canonicalPoolByUniverse(universeId) all to agree.

CREATE2 pair addresses exist counterfactually before code is deployed, when ERC-1155 receiver checks cannot run. Each factory therefore deploys an ownerless PredeploymentShareSink. A pair constructor transfers any canonical INVALID, YES, or NO already present at its future address into that sink before returning. Those quarantined shares are permanently inaccessible; do not send shares to a predicted pair address.

TwoWayConstantProductPair

Immutable accessors expose factory, securityPool, shareToken, universeId, questionId, invalidTokenId, yesTokenId, noTokenId, and feeBps. LP ERC-20 accessors are name, symbol, decimals, totalSupply, balanceOf, allowance, approve, transfer, and transferFrom.

tradingStatus() is a concise action blocker, not an authoritative settlement summary. The first matching condition wins in this order: Uninitialized, UniverseForked, AwaitingForkContinuation, PoolInactive, QuestionResolved, QuestionEnded, then Open. An uninitialized forked pair therefore reports Uninitialized, and a finalized question reports QuestionResolved even after its end time. Read SecurityPoolForker.getQuestionOutcome(pool) when the finalized outcome itself is required.

PredeploymentShareSink

Accepts ERC-1155 transfers and has no withdrawal or administrative method. It exists only to preserve clean pair initialization and the zero-INVALID invariant after counterfactual-address poisoning attempts.

TwoWayConstantProductMath

The internal library provides exact-input and exact-output quotes, ceil rounding through the repository's full-precision Math.mulDiv, proportional deposits, initial odds, and conditional price basis points. Production paths never multiply reserve products. Rounding directions are listed in Units and rounding.