Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
pragma solidity ^0.4.23;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
contract OracleTest is usingOraclize {
bool public isTrue;
event NewOraclizeQuery(string _description);
event NewOracleResultCount(bool _isTrue);
function OracleTest() public {
update();
}
function __callback(bytes32 myid, string result) public {
if (msg.sender != oraclize_cbAddress()) revert();
isTrue = (keccak256(result) == keccak256("true"));
NewOracleResultCount(isTrue);
}
function update() public payable {
NewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
oraclize_query("URL", 'json(https://hogehoge.com/api).isTrue');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment