NegRiskAdapter adds multi-outcome market support on top of
ConditionalTokens. Paired with NegRiskCtfExchange.
Why separate from binary
A binary market is one condition with two outcome tokens. A neg-risk market with N outcomes is N binary YES / NO conditions grouped under onemarketId (the market’s negRiskMarketId). Exactly one outcome
can win, so when the market resolves to a winner, NO on every outcome
pays N − 1 USDC, and NO on some outcomes is worth the same as YES on
all the others plus USDC. convertPositions makes that exchange
atomically instead of trading each leg.
Market setup
i becomes its own binary condition with the adapter as its
oracle and questionId = keccak256(abi.encodePacked(marketId, uint8(i))).
Read its conditionId with conditionIds(marketId, i) and its YES / NO
token ids with getTokenIds(marketId, i).
convertPositions
i of indexSet selects outcome i. The caller gives up
amount NO of every selected outcome and receives amount YES of
every other outcome, plus (k − 1) × amount USDC, where k is the
number of selected outcomes.
Example: 4-outcome market; hold 1 NO on each of outcomes 1, 2 and 3
(indexSet 0b1110). convertPositions burns NO_1 + NO_2 + NO_3 and
pays 1 YES_0 plus 2 USDC. Converting through your vault (below), the
YES tokens and USDC land in the vault.
Conversion is not available once the market has a result, is voided,
or has a void queued (MarketVoidQueued).
Via the API
Partners typically call through the vault’s dual-sig path:Resolution
Each outcome is its own binary condition (conditionIds(marketId, i)),
and only the neg-risk oracle (negRiskOracle in
GET /api/platform/contracts) can resolve them — see
Flow → Neg-risk markets.
On finalisation it makes one call, reportOutcome(marketId, winnerIndex),
which reports [1, 0] for the winning question and [0, 1] for every
other question. The platform can instead resolve at fair prices
(reportOutcomeWithFairPrices, one YES / NO pair per question) or void
the market ([1, 1] on every question) — see
Void & delayed.
Redeem through your vault with
vault.redeemPositionsNegRisk(marketId, questionIndex, amount), or let
the platform do it — see Redemption.
Source
0x3BE93B8e19b73e1b21B65adFFEF4ef248715D21B (testnet);
NegRiskCtfExchange at
0x2eB97912c333963a21410Af1eF7E9a0aAB7631bf.