-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathRecoverERC721.sol
31 lines (28 loc) · 1.1 KB
/
RecoverERC721.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
/**
* @title RecoverERC721
* @dev Allows to recover any ERC-721 token sent into the contract and sends them to a receiver.
*/
abstract contract RecoverERC721 {
/**
* @dev Recovers the `tokenId` of the ERC-721 `tokenAddress` locked into this contract
* and sends it 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 token.
* @param tokenId The identifier for the NFT to be recovered.
* @param data Additional data with no specified format.
*/
function _recoverERC721(
address tokenAddress,
address tokenReceiver,
uint256 tokenId,
bytes memory data
) internal virtual {
IERC721(tokenAddress).safeTransferFrom(address(this), tokenReceiver, tokenId, data);
}
}