-
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.
[SCH-01M] Incorrect Specification of Error & [SCH-04M] Duplicate Emis…
…sion of Event (#879) * Safe Transfer voucher to buyer during ask order * Remove redundant comment (#865) --------- Co-authored-by: Ludovic Levalleux <[email protected]>
- Loading branch information
1 parent
e965d76
commit 06209b1
Showing
6 changed files
with
95 additions
and
4 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