From dd8bdbf589ee1e8bbe3a282d2f93e34fd6fc5e65 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Tue, 26 Sep 2023 12:14:43 -0300 Subject: [PATCH] Fixes #4 --- contracts/SNTPlaceHolder.sol | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/contracts/SNTPlaceHolder.sol b/contracts/SNTPlaceHolder.sol index 404f8cd..6d4dfd3 100644 --- a/contracts/SNTPlaceHolder.sol +++ b/contracts/SNTPlaceHolder.sol @@ -62,6 +62,21 @@ contract SNTPlaceHolder is TokenController, Owned { return true; } + /// @notice This method can be used by the controller to extract mistakenly + /// sent tokens to this contract. + /// @param _token The address of the token contract that you want to recover + /// set to 0 in case you want to extract ether. + function claimTokens(MiniMeToken _token) public onlyOwner { + if (address(_token) == address(0)) { + payable(owner).transfer(address(this).balance); + return; + } + + uint256 balance = _token.balanceOf(address(this)); + _token.transfer(owner, balance); + emit ClaimedTokens(address(_token), owner, balance); + } + event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount); event ControllerChanged(address indexed _newController); }