Skip to content

Instantly share code, notes, and snippets.

@saurfang
Created April 15, 2018 01:52
Show Gist options
  • Save saurfang/41823334ab9b66b5896abf91de5dfcba to your computer and use it in GitHub Desktop.
Save saurfang/41823334ab9b66b5896abf91de5dfcba to your computer and use it in GitHub Desktop.
const GuessTheNewNumberChallenge = artifacts.require('GuessTheNewNumberChallenge');
const GuessTheNewNumberSolver = artifacts.require('GuessTheNewNumberSolver');
contract('GuessTheNewNumberSolver', ([account]) => {
it('should solve the challenge', async () => {
let challenge = await GuessTheNewNumberChallenge.new({value: web3.toWei(1, 'ether')});
let solver = await GuessTheNewNumberSolver.new();
assert(
await solver.isComplete(challenge.address) === true,
'Challenge has not been completed!'
);
});
});
pragma solidity ^0.4.21;
import "./GuessTheNewNumberChallenge.sol";
contract GuessTheNewNumberSolver {
function isComplete(address _challenge) public view returns(bool) {
GuessTheNewNumberChallenge challenge = GuessTheNewNumberChallenge(_challenge);
return challenge.isComplete();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment