Guest User

Untitled

a guest
Dec 10th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. pragma solidity ^0.5.0;
  2.  
  3. import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
  4.  
  5. contract WolframAlpha is usingOraclize {
  6.  
  7. string public temperature;
  8.  
  9. event LogNewOraclizeQuery(string description);
  10. event LogNewTemperatureMeasure(string temperature);
  11.  
  12. constructor() public {
  13. update(); // Update on contract creation...
  14. }
  15.  
  16. function __callback(string memory result) public {
  17. require(msg.sender == oraclize_cbAddress());
  18. temperature = result;
  19. emit LogNewTemperatureMeasure(temperature);
  20. // Do something with the temperature measure...
  21. }
  22.  
  23. function update() public payable {
  24. emit LogNewOraclizeQuery("Oraclize query was sent, standing by for the answer...");
  25. oraclize_query("WolframAlpha", "temperature in London");
  26. }
  27. }
Add Comment
Please, Sign In to add comment