Skip to content

Latest commit

 

History

History
221 lines (200 loc) · 7.14 KB

WithRecovery.md

File metadata and controls

221 lines (200 loc) · 7.14 KB

WithRecovery.sol

View Source: contracts/core/token/WithRecovery.sol

↗ Extends: Ownable ↘ Derived Contracts: Delayable, NPM

WithRecovery

Functions

recoverEther

Recover all Ether held by the contract.

function recoverEther(address sendTo) external nonpayable onlyOwner 

Arguments

Name Type Description
sendTo address
Source Code
function recoverEther(address sendTo) external onlyOwner {
    // slither-disable-next-line low-level-calls
    (bool success, ) = payable(sendTo).call{value: address(this).balance}(""); // solhint-disable-line avoid-low-level-calls
    require(success, "Recipient may have reverted");
  }

recoverToken

Recover an ERC-20 compatible token sent to this contract.

function recoverToken(IERC20 malicious, address sendTo) external nonpayable onlyOwner 

Arguments

Name Type Description
malicious IERC20 ERC-20 The address of the token contract
sendTo address The address that receives the recovered tokens
Source Code
function recoverToken(IERC20 malicious, address sendTo) external onlyOwner {
    malicious.safeTransfer(sendTo, malicious.balanceOf(address(this)));
  }

Contracts