Created
February 22, 2018 22:13
-
-
Save io4/9c8de4c1226b27adf06062efa74b460a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.18; | |
contract CardGuess { | |
address guesser = 0x0; | |
uint256 unlockblock = 0; | |
uint256 window = 10; | |
bytes32 public hash = 0x28c6468c5e6cd0cd9dac3b0cdfe6c9fde6593813f4a83628fa81f7099b4cf4e9; | |
function commit () public { | |
require(unlockblock < block.number); | |
guesser = msg.sender; | |
unlockblock = block.number + window; | |
} | |
function guess (string solution) public { | |
require(guesser == msg.sender); | |
require(keccak256(solution) == hash); | |
msg.sender.transfer(this.balance); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment