Variables
conditionalTokens
wrapped1155Factory
Functions
constructor
splitPosition
Pre-condition
- The ERC20 associated to each outcome must be previously created on the wrapped1155Factory.
- The caller must have <amount> collateral tokens or ERC20 parent outcome tokens (in the case
market.parentCollectionIdis not null).
market.parentCollectionId is null:
- Transfer <amount> collateral from the user to
Router. - Call
conditionalTokens.splitPositionto transfer <amount> collateral fromRoutertoConditionalTokens, while minting corresponding ERC1155 outcome tokens toRouter.
market.parentCollectionId is not null:
- Unwrap ERC20 parent outcome tokens back to ERC1155 tokens.
- Call
conditionalTokens.splitPositionto transfer ERC1155 parent outcome tokens fromRoutertoConditionalTokens, burning them while minting corresponding conditional outcome tokens toRouter.
- Transfer ERC1155 outcome tokens from
RoutertoWrapped1155Factorycontract. There is a callback function inWrapped1155Factorythat will wrap the tokens into ERC20 tokens, then transfer the wrapped tokens back to the original user.
_splitPosition
mergePositions
Pre-condition
- The ERC20 associated to each outcome must be previously created on the wrapped1155Factory.
- The caller must have <amount> ERC20 tokens of all the outcomes of a market. For example, to call
mergePositionsof a market with 3 outcomes: Yes, No, Invalid, the caller must have <amount> tokens for each outcome.
- Unwraps ERC20 outcome tokens (which will burn these tokens and transfer corresponding ERC1155 outcome tokens back to the
Routercontract). - Call
conditionalTokens.mergePositionsto burn ERC1155 outcome tokens. Then:
market.parentCollectionId is null:
- Return collateral to
Router, which will then be sent to the user.
market.parentCollectionId is not null:
conditionalTokenswill mint ERC1155 parent outcome tokens and send toRouter.Routerwill wrap these tokens to ERC20 and send to the user.
_mergePositions
redeemPositions
Pre-condition
- The ERC20 associated to each outcome must be previously created on the wrapped1155Factory.
- The caller must have ERC20 tokens of the outcomes they want to redeem. For example, to call
redeemPositionsfor outcome Yes of a market with 3 outcomes: Yes, No, Invalid, the caller must have Yes tokens. (The call will still be processed even if the caller does not have tokens, but it will have no effect). conditionalTokens.reportPayoutshas been called by an oracle.
- Unwraps ERC20 outcome tokens (which will burn these tokens and transfer corresponding ERC1155 outcome tokens back to the
Routercontract). - Call
conditionalTokens.redeemPositionsto burn ERC1155 outcome tokens. Then:
market.parentCollectionId is null:
- Return collateral to
Router. The return amount is in proportion to theConditionalTokenspayouts.Routerwill calculate the collateral difference before and after redeeming and transfer the difference to the user.
market.parentCollectionId is not null:
conditionalTokenswill mint ERC1155 parent outcome tokens and send toRouter. The amount is in proportion to theConditionalTokenspayouts.Routerwill calculate the ERC1155 outcome tokens difference before and after redeeming, wrap the difference to ERC20 and send to the user.
_redeemPositions
getPartition
Return Values
getTokenId
Return Values
getWinningOutcomes
Return Values