Skip to content

Instantly share code, notes, and snippets.

@iisaint
Created April 13, 2017 05:49
Show Gist options
  • Save iisaint/8ffd58a0692fffdd845cb21db06a4dcc to your computer and use it in GitHub Desktop.
Save iisaint/8ffd58a0692fffdd845cb21db06a4dcc to your computer and use it in GitHub Desktop.
Oracle.sol for My Oracle
pragma solidity ^0.4.10;
contract Oracle {
address owner;
address public cbAddress; // callback address
function Oracle() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}
event QueryEvent(bytes32 id, string query);
function setCbAddress(address _cbAddress) onlyOwner {
cbAddress = _cbAddress;
}
function query(string _query) returns (bytes32 id) {
id = sha3(block.number, now, _query, msg.sender);
QueryEvent(id, _query);
return id;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment