Reference

Trading router

Trading deploys one canonical factory and one canonical router. The router handles entry and liquidity operations, share-transfer exits and complete-set redemption, and permit-assisted LP removal. The configured deterministic addresses and factory relationships are authoritative.

Entrypoints

TwoWayConstantProductRouter(factory) fixes the only eligible factory. All user mutations enforce a deadline and a reentrancy guard. The router's receiver callbacks accept only the active pool's canonical share token and universe IDs. receive() accepts ETH only during redemption and only from the expected SecurityPool.

Successful share-custody operations assert that all three router balances equal their starting values, preserving pre-existing forced shares.

Exits and complete-set redemption by share transfer

The router has no exitPosition or redeemCompleteSet entrypoint. Users exit and redeem by calling the ShareToken's safeBatchTransferFrom with themselves as both caller and owner, the router as recipient, and an encoded request in the data field. No setApprovalForAll is required. The versioned payload binds the operation, ShareToken, canonical SecurityPool and pair, universe, question, exact INVALID/YES/NO token IDs, transferred and maximum input, minimum ETH output, payout and refund recipients, and deadline. The router accepts only owner-initiated top-level transfers (operator == from); internal pair callbacks are distinguished from top-level user callbacks.

Both operations measure the ETH the redemption produced, require that delta to be positive and at least minEthOut, and forward exactly that delta to the payout recipient. Pre-existing forced ETH in the router is never mixed into a payout. Every operation also proves that it leaves the router's share balances unchanged.

For LP removal through the router, Safes and integrations without signature support may use ordinary exact allowances instead of a permit. The first-party UI calls the pair directly and needs no router allowance.