HasNoTokens.sol 800 B

1234567891011121314151617181920212223242526
  1. pragma solidity ^0.4.8;
  2. import "./Ownable.sol";
  3. import "../token/ERC20Basic.sol";
  4. /// @title Contracts that should not own Tokens
  5. /// @author Remco Bloemen <remco@2π.com>
  6. ///
  7. /// This blocks incoming ERC23 tokens to prevent accidental
  8. /// loss of tokens. Should tokens (any ERC20Basic compatible)
  9. /// end up in the contract, it allows the owner to reclaim
  10. /// the tokens.
  11. contract HasNoTokens is Ownable {
  12. /// Reject all ERC23 compatible tokens
  13. function tokenFallback(address from_, uint value_, bytes data_) external {
  14. throw;
  15. }
  16. /// Reclaim all ERC20Basic compatible tokens
  17. function reclaimToken(address tokenAddr) external onlyOwner {
  18. ERC20Basic tokenInst = ERC20Basic(tokenAddr);
  19. uint256 balance = tokenInst.balanceOf(this);
  20. tokenInst.transfer(owner, balance);
  21. }
  22. }