Created
April 14, 2018 15:58
-
-
Save xd4rker/4cb7f2da09e0034065cb60d310bb74fe to your computer and use it in GitHub Desktop.
Guess the secret number - capturetheether.com
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.21; | |
contract GuessTheSecretNumberChallenge { | |
bytes32 answerHash = 0xdb81b4d58595fbbbb592d3661a34cdca14d7ab379441400cbfa1b78bc447c365; | |
function GuessTheSecretNumberChallenge() public payable { | |
require(msg.value == 1 ether); | |
} | |
function isComplete() public view returns (bool) { | |
return address(this).balance == 0; | |
} | |
function guess(uint8 n) public payable { | |
require(msg.value == 1 ether); | |
if (keccak256(n) == answerHash) { | |
msg.sender.transfer(2 ether); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment