-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ready for review * add interface and natspec * ready for review * rename emergency transfer function * add fuzzing --------- Co-authored-by: defijesus.eth <[email protected]>
- Loading branch information
Showing
4 changed files
with
1,064 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.8; | ||
|
||
import {IRescuable721, IERC721} from './interfaces/IRescuable721.sol'; | ||
import {Rescuable} from './Rescuable.sol'; | ||
|
||
/** | ||
* @title Rescuable721 | ||
* @author defijesus.eth | ||
* @notice abstract contract that extend Rescuable with the methods to rescue ERC721 tokens from a contract | ||
*/ | ||
abstract contract Rescuable721 is Rescuable, IRescuable721 { | ||
|
||
/// @inheritdoc IRescuable721 | ||
function emergency721TokenTransfer( | ||
address erc721Token, | ||
address to, | ||
uint256 tokenId | ||
) external virtual onlyRescueGuardian { | ||
IERC721(erc721Token).transferFrom(address(this), to, tokenId); | ||
|
||
emit ERC721Rescued(msg.sender, erc721Token, to, tokenId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.8; | ||
|
||
/** | ||
* @title IRescuable721 | ||
* @author defijesus.eth | ||
* @notice interface containing the objects, events and methods definitions of the Rescuable721 contract | ||
*/ | ||
interface IRescuable721 { | ||
/** | ||
* @notice emitted when erc721 tokens get rescued | ||
* @param caller address that triggers the rescue | ||
* @param token address of the rescued token | ||
* @param to address that will receive the rescued tokens | ||
* @param tokenId the id of the token rescued | ||
*/ | ||
event ERC721Rescued( | ||
address indexed caller, | ||
address indexed token, | ||
address indexed to, | ||
uint256 tokenId | ||
); | ||
|
||
/** | ||
* @notice method called to rescue a ERC721 token sent erroneously to the contract. Only callable by owner | ||
* @param erc721Token address of the token to rescue | ||
* @param to address to send the token | ||
* @param tokenId of token to rescue | ||
*/ | ||
function emergency721TokenTransfer(address erc721Token, address to, uint256 tokenId) external; | ||
} | ||
|
||
interface IERC721 { | ||
function transferFrom(address from, address to, uint256 tokenId) external; | ||
} |
Oops, something went wrong.