-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathRecoverERC20.sol
26 lines (23 loc) · 1.01 KB
/
RecoverERC20.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title RecoverERC20
* @dev Allows to recover any ERC-20 token sent into the contract and sends them to a receiver.
*/
abstract contract RecoverERC20 {
/**
* @dev Recovers a `tokenAmount` of the ERC-20 `tokenAddress` locked into this contract
* and sends them to the `tokenReceiver` address.
*
* WARNING: it allows everyone to recover tokens. Access controls MUST be defined in derived contracts.
*
* @param tokenAddress The contract address of the token to recover.
* @param tokenReceiver The address that will receive the recovered tokens.
* @param tokenAmount Number of tokens to be recovered.
*/
function _recoverERC20(address tokenAddress, address tokenReceiver, uint256 tokenAmount) internal virtual {
// slither-disable-next-line unchecked-transfer
IERC20(tokenAddress).transfer(tokenReceiver, tokenAmount);
}
}