Skip to content

Commit

Permalink
fix forge tests to account for new checks
Browse files Browse the repository at this point in the history
  • Loading branch information
stephankmin committed Jul 21, 2022
1 parent de0d9c5 commit 26a56cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 57 deletions.
33 changes: 7 additions & 26 deletions test/foundry/TransferHelperMultipleRecipientsTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1104,24 +1104,15 @@ contract TransferHelperMultipleRecipientsTest is BaseOrderTest {
items,
inputs.recipients
);
try
transferHelper.bulkTransfer(itemsWithRecipient, conduitKeyOne)
returns (
bytes4 /* magicValue */
) {} catch (bytes memory reason) {
returnedData = this.getSelector(reason);
}

_performSingleItemTransferAndCheckBalances(
item,
alice,
inputs.recipients,
true,
true,
abi.encodeWithSignature(
"ConduitErrorRevertBytes(bytes,bytes32,address)",
returnedData,
conduitKeyOne,
conduit
abi.encodePacked(
TokenTransferrerErrors.InvalidERC721TransferAmount.selector
)
);
}
Expand Down Expand Up @@ -1155,25 +1146,15 @@ contract TransferHelperMultipleRecipientsTest is BaseOrderTest {
items,
inputs.recipients
);
try
transferHelper.bulkTransfer(itemsWithRecipient, conduitKeyOne)
returns (
bytes4 /* magicValue */
) {} catch (bytes memory reason) {
returnedData = this.getSelector(reason);
}

_performMultiItemTransferAndCheckBalances(
items,
alice,
inputs.recipients,
true,
true,
abi.encodeWithSignature(
"ConduitErrorRevertBytes(bytes,bytes32,address)",
returnedData,
conduitKeyOne,
conduit
abi.encodePacked(
TokenTransferrerErrors.InvalidERC721TransferAmount.selector
)
);
}
Expand All @@ -1186,7 +1167,7 @@ contract TransferHelperMultipleRecipientsTest is BaseOrderTest {
ConduitItemType.ERC20,
inputs.amounts[0],
inputs.tokenIndex[0],
inputs.identifiers[0],
0,
false
);

Expand Down Expand Up @@ -1226,7 +1207,7 @@ contract TransferHelperMultipleRecipientsTest is BaseOrderTest {
ConduitItemType.ERC20,
inputs.amounts[0],
inputs.tokenIndex[0],
inputs.identifiers[0],
0,
false
);

Expand Down
38 changes: 7 additions & 31 deletions test/foundry/TransferHelperSingleRecipientTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -936,23 +936,14 @@ contract TransferHelperSingleRecipientTest is BaseOrderTest {
items,
bob
);
try
transferHelper.bulkTransfer(itemsWithRecipient, conduitKeyOne)
returns (
bytes4 /* magicValue */
) {} catch (bytes memory reason) {
returnedData = this.getSelector(reason);
}

_performSingleItemTransferAndCheckBalances(
item,
alice,
bob,
true,
abi.encodeWithSignature(
"ConduitErrorRevertBytes(bytes,bytes32,address)",
returnedData,
conduitKeyOne,
conduit
abi.encodePacked(
TokenTransferrerErrors.InvalidERC721TransferAmount.selector
)
);
}
Expand Down Expand Up @@ -982,24 +973,14 @@ contract TransferHelperSingleRecipientTest is BaseOrderTest {
items,
bob
);
try
transferHelper.bulkTransfer(itemsWithRecipient, conduitKeyOne)
returns (
bytes4 /* magicValue */
) {} catch (bytes memory reason) {
returnedData = this.getSelector(reason);
}

_performMultiItemTransferAndCheckBalances(
items,
alice,
bob,
true,
abi.encodeWithSignature(
"ConduitErrorRevertBytes(bytes,bytes32,address)",
returnedData,
conduitKeyOne,
conduit
abi.encodePacked(
TokenTransferrerErrors.InvalidERC721TransferAmount.selector
)
);
}
Expand All @@ -1012,16 +993,11 @@ contract TransferHelperSingleRecipientTest is BaseOrderTest {
ConduitItemType.ERC20,
inputs.amounts[0],
inputs.tokenIndex[0],
inputs.identifiers[0]
0
);

_updateConduitChannel(false);

// try transferHelper.bulkTransfer(items, bob, conduitKeyOne) returns (
// bytes4 magicValue
// ) {} catch (bytes memory reason) {
// returnedData = this.getSelector(reason);
// }
bytes memory returnedData = abi.encodeWithSelector(
0x93daadf2,
address(transferHelper)
Expand Down Expand Up @@ -1055,7 +1031,7 @@ contract TransferHelperSingleRecipientTest is BaseOrderTest {
ConduitItemType.ERC20,
inputs.amounts[0],
inputs.tokenIndex[0],
inputs.identifiers[0]
0
);

// Reassign the conduit key that gets passed into TransferHelper to fuzzConduitKey.
Expand Down

0 comments on commit 26a56cb

Please sign in to comment.