TokenClaimer.sol
1 pragma solidity >=0.5.0 <0.7.0; 2 3 import "../token/ERC20Token.sol"; 4 5 contract TokenClaimer { 6 event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount); 7 8 function claimTokens(address _token) external; 9 /** 10 * @notice This method can be used by the controller to extract mistakenly 11 * sent tokens to this contract. 12 * @param _token The address of the token contract that you want to recover 13 * set to 0 in case you want to extract ether. 14 */ 15 function withdrawBalance(address _token, address payable _destination) 16 internal 17 { 18 uint256 balance; 19 if (_token == address(0)) { 20 balance = address(this).balance; 21 address(_destination).transfer(balance); 22 } else { 23 ERC20Token token = ERC20Token(_token); 24 balance = token.balanceOf(address(this)); 25 token.transfer(_destination, balance); 26 } 27 emit ClaimedTokens(_token, _destination, balance); 28 } 29 }