-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOwnableTokenRecoverer.sol
65 lines (59 loc) · 2.24 KB
/
OwnableTokenRecoverer.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// SPDX-FileCopyrightText: 2023 P2P Validator <info@p2p.org>, Lido <info@lido.fi>
// SPDX-License-Identifier: MIT
// https://github.com/lidofinance/lido-otc-seller/blob/master/contracts/lib/AssetRecoverer.sol
pragma solidity 0.8.18;
import "./TokenRecoverer.sol";
import "../access/OwnableBase.sol";
/// @title Token Recoverer with public functions callable by assetAccessingAddress
/// @notice Recover ERC20, ERC721 and ERC1155 from a derived contract
abstract contract OwnableTokenRecoverer is TokenRecoverer, OwnableBase {
// Functions
/**
* @notice transfer an ERC20 token from this contract
* @dev `SafeERC20.safeTransfer` doesn't always return a bool
* as it performs an internal `require` check
* @param _token address of the ERC20 token
* @param _recipient address to transfer the tokens to
* @param _amount amount of tokens to transfer
*/
function transferERC20(
address _token,
address _recipient,
uint256 _amount
) external onlyOwner {
_transferERC20(_token, _recipient, _amount);
}
/**
* @notice transfer an ERC721 token from this contract
* @dev `IERC721.safeTransferFrom` doesn't always return a bool
* as it performs an internal `require` check
* @param _token address of the ERC721 token
* @param _recipient address to transfer the token to
* @param _tokenId id of the individual token
*/
function transferERC721(
address _token,
address _recipient,
uint256 _tokenId
) external onlyOwner {
_transferERC721(_token, _recipient, _tokenId);
}
/**
* @notice transfer an ERC1155 token from this contract
* @dev see `AssetRecoverer`
* @param _token address of the ERC1155 token that is being recovered
* @param _recipient address to transfer the token to
* @param _tokenId id of the individual token to transfer
* @param _amount amount of tokens to transfer
* @param _data data to transfer along
*/
function transferERC1155(
address _token,
address _recipient,
uint256 _tokenId,
uint256 _amount,
bytes calldata _data
) external onlyOwner {
_transferERC1155(_token, _recipient, _tokenId, _amount, _data);
}
}