-
Notifications
You must be signed in to change notification settings - Fork 66
RefundableOracleLock
The smart contract blocks iDNA deposited by multiple users until a decision is made by oracles. It works similarly to OracleLock: if the voting result matches the expected value, coins are transferred to address A (if specified), otherwise to address B (if specified). However, a refund is provided to all users if the destination address A or B is not specified or oracle voting fails to reach a consensus. The amount of the refund is equal to the initial deposit or proportional to the initial deposit if the RefundableOracleLock address has been funded additionally.
The contractor promises to complete the work by a certain deadline. The community is ready to fund the work. An oracle voting is created so that oracles at some point in the future confirm whether the work is done. Community members fund the work by depositing money from different wallets to RefundableOracleLock. If the result of the oracle voting confirms that the work is done, the money is transferred to the contractor. Otherwise, all contributors get a refund.
An oracle voting is created so that oracles at some point in the future confirm the occurrence or non-occurrence of the event. Bets on the occurrence or non-occurrence of the event are locked on two linked RefundableOracleLock contracts. According to the results of the oracle voting, one of the two contracts will be the RefundableOracleLock-winner and the other will be the RefundableOracleLock-loser. All money locked on the RefundableOracleLock-loser contract is sent to the address of the RefundableOracleLock-winner contract. After that, the money from the RefundableOracleLock-winner is returned to the winning users in the form of a refund in proportion to the bets made.
Default state of the smart contract is locked. Once the voting at the referenced OracleVoting smart contract is finished anyone can call Push method which changes the state as follows:
-
unlocked_successif the result on theOracleVotingsmart contract matches the expectedValueandSuccess addressis specified. Coins are sent to theSuccess address. -
unlocked_failedif the result on theOracleVotingsmart contract does not match the expectedValueandFail addressis specified. Coins are sent to theFail address. -
unlocked_refundotherwise.
...
...
...
...
...