MarketFactory functions as root markets (e.g. createCategoricalMarket), but you set parentMarket and parentOutcome in CreateMarketParams. Split, merge and redeem use the same Router (or chain-specific router) with the parent’s outcome token as the collateral token for the child market. Redeeming a resolved conditional market returns parent outcome tokens; to get base collateral in one go you can use ConditionalRouter.redeemConditionalToCollateral when the parent is a root market.
Creating a conditional market
Use any of the four market-creation functions on the MarketFactory and pass a parent market address and parent outcome index in the params. The child market is tied to “parent resolves to this outcome.”Split, merge and redeem
The sameRouter (or GnosisRouter / MainnetRouter) is used. The important difference is the collateral token:
- Root market: collateral token = base collateral (e.g. sDAI or sUSDS, or the yield-bearing ERC20 you use on that chain).
- Conditional market: collateral token = parent’s wrapped outcome token (the ERC20 for the parent outcome at index
parentOutcome).
splitFromBase (Gnosis) or splitFromDai (Mainnet); you use splitPosition(collateralToken, market, amount) where collateralToken is the parent outcome ERC20.
Split
You must hold enough parent outcome tokens (from splitting or trading the parent market). Then:- Approve the parent’s wrapped outcome token (for the outcome index the child is conditional on) to the Router.
- Call
router.splitPosition(parentWrappedOutcomeToken, conditionalMarket, amount).
Merge
Hold a full set of child outcome tokens (equal amount of each outcome; e.g. 50 of outcome A and 50 of outcome B). Call:router.mergePositions(parentWrappedOutcomeToken, conditionalMarket, amount).
You receive parent outcome tokens back.
Redeem (after child market is resolved)
Callrouter.redeemPositions(parentWrappedOutcomeToken, conditionalMarket, outcomeIndexes, amounts) with the winning child outcome index(es) and amounts. You receive parent outcome tokens (not base collateral). To get base collateral you must either:
- Redeem the parent market separately (if the parent is resolved), or
- Use
ConditionalRouter.redeemConditionalToCollateral(see below), which redeems child winning positions and then redeems the resulting parent outcome to collateral in one tx. The parent must be a root market (not conditional).
ConditionalRouter: redeem to collateral in one call
ConditionalRouter extends Router and adds:
- outcomeIndexes / amounts: winning child outcome(s) to redeem.
- parentOutcomeIndexes: which parent outcome(s) to redeem when converting the received parent tokens to collateral (e.g.
[0]if the parent resolved to outcome 0).
Nested conditional markets
The framework supports multiple levels: a market can be conditional on another conditional market. Interact with each level the same way (collateral token for a child is always the parent’s wrapped outcome token). If the parent resolves to an outcome different from the one the child is conditional on, the child market (and any deeper nesting) becomes obsolete: no one can redeem that branch for value.Using @seer-pm/sdk
We use the Viem setup and @seer-pm/sdk. For split/merge/redeem on the conditional market usegetRouterAddress(market) and the parent’s wrapped outcome token as collateral (see below). You need a parent market already created; the parent can be root or conditional.
1. Create a conditional categorical market
UsegetCreateMarketExecution as in Create a market, with parentMarket and parentOutcome set to the parent market address and the outcome index this market is conditional on:
2. Get parent wrapped outcome token (for split/merge/redeem)
The “collateral” token for the conditional market in Router calls is the parent’s wrapped outcome ERC20. You can read it from the child market (if the contract exposes it) or from the parent:3. Split on a conditional market
Approve the parent outcome token to the Router, then callsplitPosition with that token and the conditional market. Use addresses.Router (Optimism/Base), addresses.GnosisRouter (Gnosis), or addresses.MainnetRouter (Ethereum) as appropriate for your chain.
4. Merge on a conditional market
You need a full set of child outcome tokens (equal amount of each outcome). Same Router and “collateral” token (parent wrapped outcome). Approve the router to spendamount of each child outcome token before calling merge:
5. Redeem (child resolved) → parent outcome tokens
After the child market is resolved, redeem winning child outcome(s). You receive parent outcome tokens. Approve the router to spend each winning child outcome token for the corresponding amount before calling redeem. Use a Router ABI that includesredeemPositions(collateralToken, market, outcomeIndexes, amounts) (see Split, merge and redeem):
6. Redeem to base collateral in one tx (ConditionalRouter)
If the parent is a root market and is already resolved, you can use ConditionalRouter to redeem child winning positions and get collateral in one call. Useaddresses.ConditionalRouter. Approve the ConditionalRouter to spend each winning child outcome token for the corresponding amount before calling.
Summary
On Gnosis/Mainnet, for conditional markets do not use
splitFromBase / splitFromDai. Use the same router’s splitPosition(parentWrappedOutcomeToken, conditionalMarket, amount) after approving the parent outcome token.