-
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_bbe_01c
- Loading branch information
Showing
18 changed files
with
341 additions
and
57 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity 0.8.22; | ||
|
||
import { DisputeHandlerFacet } from "../protocol/facets/DisputeHandlerFacet.sol"; | ||
|
||
/** | ||
* @title TestDisputeHandlerFacet | ||
* | ||
* @notice Extended DisputeHandlerFacet with additional external functions for testing | ||
*/ | ||
contract TestDisputeHandlerFacet is DisputeHandlerFacet { | ||
/** | ||
* @notice Test function to test invalid final dispute state | ||
* | ||
* @param _exchangeId - the id of the associated exchange | ||
* @param _targetState - target final state | ||
*/ | ||
function finalizeDispute(uint256 _exchangeId, DisputeState _targetState) external { | ||
(, Exchange storage exchange) = fetchExchange(_exchangeId); | ||
(, Dispute storage dispute, DisputeDates storage disputeDates) = fetchDispute(_exchangeId); | ||
finalizeDispute(_exchangeId, exchange, dispute, disputeDates, _targetState, 1000); | ||
} | ||
} |
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
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
Oops, something went wrong.