-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHint.sol
43 lines (37 loc) · 1.18 KB
/
Hint.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
pragma solidity ^0.5.0;
contract Hint {
bool public assigned;
bool public set;
bytes32 private hint;
bytes private step; // first one
bytes32 private tip;
bytes32 private ethcon;
uint[] private plain;
HintReward public rewardPool;
constructor(bytes32 _hint, bytes32 _tip, bytes32 _ethcon, uint[] memory _plain, address _rewardPool) public {
set = true;
hint = _hint;
tip = _tip;
ethcon = _ethcon;
plain = _plain;
rewardPool = HintReward(_rewardPool);
}
function assign(bytes32 _hint, bytes memory _step) public returns(bool) {
require(!assigned);
require(_hint == hint);
set = true;
assigned = true;
step = _step;
return true;
}
function claim(uint[] memory _answer) public {
(bool success, bytes memory returnedData) = address(rewardPool).call(abi.encodeWithSelector(rewardPool.check.selector, _answer, plain, step));
require(returnedData.length >= 0);
require(success);
}
function help() public payable {
require(msg.value >= 10 ether);
(bool success, ) = address(rewardPool).call(abi.encodeWithSelector(rewardPool.help.selector));
require(success);
}
}