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
proposal.parentCollectionIdis not null).
proposal.parentCollectionId is null:
- Transfer <amount> collateral from the user to
FutarchyRouter. - Call
conditionalTokens.splitPositionto transfer <amount> collateral fromFutarchyRoutertoConditionalTokens, while minting corresponding ERC1155 outcome tokens toFutarchyRouter.
proposal.parentCollectionId is not null:
- Unwrap ERC20 parent outcome tokens back to ERC1155 tokens.
- Call
conditionalTokens.splitPositionto transfer ERC1155 parent outcome tokens fromFutarchyRoutertoConditionalTokens, burning them while minting corresponding conditional outcome tokens toFutarchyRouter.
- Transfer ERC1155 outcome tokens from
FutarchyRoutertoWrapped1155Factorycontract. 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 proposal.
- Unwraps ERC20 outcome tokens (which will burn these tokens and transfer corresponding ERC1155 outcome tokens back to the
FutarchyRoutercontract). - Call
conditionalTokens.mergePositionsto burn ERC1155 outcome tokens. Then:
market.parentCollectionId is null:
- Return collateral to
FutarchyRouter, which will then be sent to the user.
proposal.parentCollectionId is not null:
conditionalTokenswill mint ERC1155 parent outcome tokens and send toFutarchyRouter.FutarchyRouterwill 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 outcome they want to redeem.
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:
proposal.parentCollectionId is null:
- Return collateral to
FutarchyRouter. The return amount is in proportion to theConditionalTokenspayouts.FutarchyRouterwill calculate the collateral difference before and after redeeming and transfer the difference to the user.
proposal.parentCollectionId is not null:
conditionalTokenswill mint ERC1155 parent outcome tokens and send toFutarchyRouter. The amount is in proportion to theConditionalTokenspayouts.FutarchyRouterwill calculate the ERC1155 outcome tokens difference before and after redeeming, wrap the difference to ERC20 and send to the user.
_redeemPositions
redeemProposal
redeemPositions that allows to redeem one or two collateral at the same time.
Parameters
getTokenId
Return Values
getWinningOutcomes
Return Values