Variables
sDAI
savingsXDaiAdapter
Functions
constructor
splitFromBase
Pre-condition
- The ERC20 associated to each outcome must be previously created on the wrapped1155Factory.
- The user send native tokens (xDAI), which will be converted to Savings xDAI (sDAI) and transferred to
GnosisRouter. - Call
conditionalTokens.splitPositionto transfer sDAI fromGnosisRoutertoConditionalTokens, while minting corresponding ERC1155 outcome tokens toGnosisRouter. - Transfer ERC1155 outcome tokens from
GnosisRoutertoWrapped1155Factorycontract. There is a callback function inWrapped1155Factorythat will wrap the tokens into ERC20 tokens, then transfer the wrapped tokens back to the original user.
mergeToBase
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
mergeToBaseof 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
GnosisRoutercontract). - Call
conditionalTokens.mergePositionsto burn ERC1155 outcome tokens. - Return sDAI to
GnosisRouter, which will then be converted to xDAI and sent to the user.
redeemToBase
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
redeemToBasefor 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
GnosisRoutercontract). - Call
conditionalTokens.redeemPositionsto burn ERC1155 outcome tokens. - Return sDAI to
GnosisRouter.GnosisRouterwill calculate the sDAI difference before and after redeeming, which will then be converted to xDAI and sent to the user.