roberts / standard

Drew Roberts Contract Standard for ERC-20 Tokens
https://DrewRoberts.com
MIT License
0 stars 1 forks source link

withdrawStuckTokens() Function #2

Open drewroberts opened 8 months ago

drewroberts commented 8 months ago

This function withdraws the tokens in the contract.

drewroberts commented 8 months ago

Here is that function in my old contract standard:

    function withdrawStuckTokens(address tkn) public onlyOwner {
        require(IERC20(tkn).balanceOf(address(this)) > 0, "No tokens");
        uint256 amount = IERC20(tkn).balanceOf(address(this));
        IERC20(tkn).transfer(msg.sender, amount);
    }