pragma solidity ^0.4.19; import "github.com/oraclize/ethereum-api/oraclizeAPI_0.5.sol"; contract SimpleOraclizeContract is usingOraclize { string public ETHXBT; // XBT is a synonym of BTC event LogConstructorInitiated(string nextStep); event LogPriceUpdated(string price); event LogNewOraclizeQuery(string description); function SimpleOraclizeContract() payable { LogConstructorInitiated("Constructor was initiated. Call 'updatePrice()' to send the Oraclize Query."); } function __callback(bytes32 myid, string result) { if (msg.sender != oraclize_cbAddress()) revert(); ETHXBT = result; LogPriceUpdated(result); } function updatePrice() payable { if (oraclize_getPrice("URL") > this.balance) { LogNewOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee"); } else { LogNewOraclizeQuery("Oraclize query was sent, standing by for the answer.."); oraclize_query("URL", "json(https://api.kraken.com/0/public/Ticker?pair=ETHXBT).result.XETHXXBT.c[0]"); } } }
0.4.18