refactor HasNoTokens.sol
This commit is contained in:
24
contracts/ownership/CanReclaimToken.sol
Normal file
24
contracts/ownership/CanReclaimToken.sol
Normal file
@ -0,0 +1,24 @@
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
import "./Ownable.sol";
|
||||
import "../token/ERC20Basic.sol";
|
||||
|
||||
/**
|
||||
* @title Contracts that should be able to recover tokens
|
||||
* @author SylTi
|
||||
* @dev This allow a contract to recover any ERC20 token received in a contract by transfering the balance to the contract owner.
|
||||
* This will prevent any accidental loss of tokens.
|
||||
*/
|
||||
contract CanReclaimToken is Ownable {
|
||||
|
||||
/**
|
||||
* @dev Reclaim all ERC20Basic compatible tokens
|
||||
* @param tokenAddr address The address of the token contract
|
||||
*/
|
||||
function reclaimToken(address tokenAddr) external onlyOwner {
|
||||
ERC20Basic tokenInst = ERC20Basic(tokenAddr);
|
||||
uint256 balance = tokenInst.balanceOf(this);
|
||||
tokenInst.transfer(owner, balance);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user