Guest User

Untitled

a guest
May 21st, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. struct User{
  2. string Uadd;
  3. uint Upay;
  4. }
  5.  
  6. User u0;
  7.  
  8. event newInform(string acc, uint tok);
  9.  
  10. function CoinTransfer() payable {
  11. update(); // first check at contract creation
  12. }
  13.  
  14. function __callback(bytes32 myid, string param_Acc, uint param_Tok) {
  15. if (msg.sender != oraclize_cbAddress()) throw;
  16. u0=User(param_Acc, param_Tok);
  17. }
  18.  
  19. function update() payable {
  20. oraclize_query("URL", "xml(https://~~~~~~~~~~~~).clients.address0");
  21. }
  22.  
  23. function transfer() public {
  24. require(balanceOf[msg.sender] >= u0.Upay); // Check if the sender has enough token
  25. require(map[u0.Uadd] + u0.Upay >= map[u0.Uadd]); // Check for overflows
  26. balanceOf[msg.sender] -= u0.Upay; // Subtract from the sender
  27. map[u0.Uadd] += u0.Upay; // Add the same to the recipient
  28. }
Add Comment
Please, Sign In to add comment