Created
September 23, 2018 13:32
-
-
Save Enigmatic331/49ec2c9f9520acb6289db0cd65c29b48 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.21; | |
contract GuessTheNumberChallenge { | |
uint8 answer = 42; | |
function GuessTheNumberChallenge() 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 (n == answer) { | |
msg.sender.transfer(2 ether); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment