Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct User{
- string Uadd;
- uint Upay;
- }
- User u0;
- event newInform(string acc, uint tok);
- function CoinTransfer() payable {
- update(); // first check at contract creation
- }
- function __callback(bytes32 myid, string param_Acc, uint param_Tok) {
- if (msg.sender != oraclize_cbAddress()) throw;
- u0=User(param_Acc, param_Tok);
- }
- function update() payable {
- oraclize_query("URL", "xml(https://~~~~~~~~~~~~).clients.address0");
- }
- function transfer() public {
- require(balanceOf[msg.sender] >= u0.Upay); // Check if the sender has enough token
- require(map[u0.Uadd] + u0.Upay >= map[u0.Uadd]); // Check for overflows
- balanceOf[msg.sender] -= u0.Upay; // Subtract from the sender
- map[u0.Uadd] += u0.Upay; // Add the same to the recipient
- }
Add Comment
Please, Sign In to add comment