Variables
DAI
sDAI
Functions
constructor
splitFromDai
Pre-condition
- The ERC20 associated to each outcome must be previously created on the wrapped1155Factory.
- Transfer DAI from the user to
MainnetRouter, which will be converted to Savings DAI (sDAI). - Call
conditionalTokens.splitPositionto transfer sDAI fromMainnetRoutertoConditionalTokens, while minting corresponding ERC1155 outcome tokens toMainnetRouter. - Transfer ERC1155 outcome tokens from
MainnetRoutertoWrapped1155Factorycontract. There is a callback function inWrapped1155Factorythat will wrap the tokens into ERC20 tokens, then transfer the wrapped tokens back to the original user.
mergeToDai
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
mergeToDaiof 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 tokens back to the
Routercontract). - Call
conditionalTokens.mergePositionsto burn ERC1155 outcome tokens. - Return sDAI to
MainnetRouter, which will then be converted to DAI and sent to the user.
redeemToDai
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
redeemToDaifor 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
MainnetRoutercontract). - Call
conditionalTokens.redeemPositionsto burn ERC1155 outcome tokens. - Return sDAI to
MainnetRouter.MainnetRouterwill calculate the sDAI difference before and after redeeming, which will then be converted to DAI and sent to the user.