Skip to content

Instantly share code, notes, and snippets.

@k5trismegistus
Created August 17, 2018 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k5trismegistus/ed0cb54fa9fddeb7c4d99b65c6105b70 to your computer and use it in GitHub Desktop.
Save k5trismegistus/ed0cb54fa9fddeb7c4d99b65c6105b70 to your computer and use it in GitHub Desktop.
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