Guest User

Untitled

a guest
Mar 24th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. function destroy() onlyOwner {
  2. // Transfer tokens back to owner
  3. uint256 balance = token.balanceOf(this);
  4. assert(balance > 0);
  5. token.transfer(owner, balance);
  6. }
  7.  
  8. /**
  9. * Internal transfer, only can be called by this contract
  10. */
  11. function _transfer(address _from, address _to, uint _value) internal {
  12. // Prevent transfer to 0x0 address. Use burn() instead
  13. require(_to != 0x0);
  14. // Check if the sender has enough
  15. require(balanceOf[_from] >= _value);
  16. // Check for overflows
  17. require(balanceOf[_to] + _value > balanceOf[_to]);
  18. // Save this for an assertion in the future
  19. uint previousBalances = balanceOf[_from] + balanceOf[_to];
  20. // Subtract from the sender
  21. balanceOf[_from] -= _value;
  22. // Add the same to the recipient
  23. balanceOf[_to] += _value;
  24. Transfer(_from, _to, _value);
  25. // Asserts are used to use static analysis to find bugs in your code. They should never fail
  26. assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
  27. }
Add Comment
Please, Sign In to add comment