NegRiskAdapter enables multi-outcome prediction markets on top of ConditionalTokens. It is paired with NegRiskCtfExchange.
Why separate from binary
A standard binary market is a single condition with two outcome slots (YES and NO). A neg-risk market with mutually exclusive outcomes consists of binary YES/NO conditions grouped under a singlemarketId (the negRiskMarketId).
Because exactly one outcome can win, NO on every outcome is worth USDC, and NO on any subset of outcomes is economically equivalent to YES on all other outcomes plus USDC. convertPositions performs that exchange atomically on-chain without requiring the trader to execute multiple separate trades.
Market setup
NegRiskAdapter as its oracle and:
prepareMarket, the adapter clones a dedicated WrappedCollateral (WCOL) contract for the market. Read condition IDs with conditionIds(marketId, i) and YES/NO token IDs with getTokenIds(marketId, i).
convertPositions
indexSet selects outcome :
- The caller burns
amountNO tokens for every selected outcome. - The caller receives
amountYES tokens for every unselected outcome. - The caller receives USDC, where is the number of selected outcomes.
0b1110, ):
convertPositions burns NO_1 + NO_2 + NO_3 and mints 1 YES_0 plus USDC into the vault.
Conversion is blocked and reverts if:
- The market has already resolved (
determined == true->MarketAlreadyDetermined). - The market is voided (
MarketIsVoided). - A void is currently queued on the market (
MarketVoidQueued).
Via the API
Partners typically call conversion through the vault’s dual-signed flow:- Request backend signature:
POST /api/vault/convert-signaturewith{ marketId, indexSet, amount }. - Owner signature: Sign the EIP-712
ConvertPositionstyped data:Note: ThenegRiskAdapteraddress is an immutable on the vault and is not part of the signed struct. - On-chain submit: Call
vault.convertPositions(marketId, indexSet, amount, salt, deadline, ownerSig, backendSig).
Resolution & void mechanics
Each outcome condition is resolved throughNegRiskOracle (see Settlement flow):
- Single winner: The oracle calls
reportOutcome(marketId, winnerIndex). The adapter reports[1, 0](YES) for the winning outcome and[0, 1](NO) for every sibling outcome. - Fair-price resolution: The oracle calls
reportOutcomeWithFairPrices(marketId, yesPayouts, noPayouts)with one YES and one NO value per question. - Two-phase voiding:
- The oracle calls
queueVoid(marketId), emittingVoidQueuedand freezingconvertPositions(MarketVoidQueued). - The oracle calls
voidMarket(marketId), reporting[1, 1]payouts to every question. - Protection against unbacked WCOL: If conversions have already occurred on that market (
hasConversions == true), callingvoidMarketreverts withCannotVoidAfterConversions(). The market must be resolved via fair prices (reportOutcomeWithFairPrices) or explicit payouts.
- The oracle calls
vault.redeemPositionsNegRisk(marketId, questionIndex, amount) or through Auto-redeem.
Events
Source
NegRiskAdapter: 0x29e58C3916d1fD235f3d1e7fCF640fd1fA8BDb1e;NegRiskCtfExchange: 0x79ACbb874dd01044FA38a89c1478E60FaAB40D00.