-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into audit_v2_4_0_flb_01c
- Loading branch information
Showing
8 changed files
with
163 additions
and
5 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
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,40 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity 0.8.22; | ||
|
||
import { IERC721Receiver } from "../interfaces/IERC721Receiver.sol"; | ||
|
||
/** | ||
* @title BuyerContract | ||
* | ||
* @notice Contract that acts as a buyer for testing purposes | ||
*/ | ||
contract BuyerContract is IERC721Receiver { | ||
enum FailType { | ||
None, | ||
Revert, | ||
ReturnWrongSelector | ||
} | ||
|
||
FailType public failType; | ||
|
||
/** | ||
* @dev Set fail type | ||
*/ | ||
function setFailType(FailType _failType) external { | ||
failType = _failType; | ||
} | ||
|
||
/** | ||
* @dev Return wrong selector to test revert | ||
*/ | ||
function onERC721Received( | ||
address operator, | ||
address from, | ||
uint256 tokenId, | ||
bytes calldata data | ||
) external returns (bytes4) { | ||
if (failType == FailType.Revert) revert("BuyerContract: revert"); | ||
if (failType == FailType.ReturnWrongSelector) return 0x12345678; | ||
return IERC721Receiver.onERC721Received.selector; | ||
} | ||
} |
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
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
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
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
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
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