mirror of openzeppelin-contracts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openzeppelin-contracts/contracts/ownership/HasNoTokens.sol

33 lines
1.0 KiB

8 years ago
pragma solidity ^0.4.8;
import "./Ownable.sol";
import "../token/ERC20Basic.sol";
/** @title Contracts that should not own Tokens
* @author Remco Bloemen <remco@2π.com>
* @dev This blocks incoming ERC23 tokens to prevent accidental loss of tokens.
Should tokens (any ERC20Basic compatible) end up in the contract, it allows the
owner to reclaim the tokens.
*/
8 years ago
contract HasNoTokens is Ownable {
/** @dev Reject all ERC23 compatible tokens
* @param from_ address The address that is transfering the tokens
* @param value_ Uint the amount of the specified token
* @param data_ Bytes The data passed from the caller.
*/
8 years ago
function tokenFallback(address from_, uint value_, bytes data_) external {
throw;
}
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @param tokenAddr address The address of the token contract
*/
8 years ago
function reclaimToken(address tokenAddr) external onlyOwner {
ERC20Basic tokenInst = ERC20Basic(tokenAddr);
uint256 balance = tokenInst.balanceOf(this);
tokenInst.transfer(owner, balance);
}
}