Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use fulfillAvailableOrders in place of matchOrders for some Seaport 1.4 tests #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 29 additions & 92 deletions src/marketplaces/seaport-1.4/SeaportOnePointFourConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,16 @@ contract SeaportOnePointFourConfig is
view
returns (
Order[] memory,
Fulfillment[] memory,
FulfillmentComponent[][] memory,
FulfillmentComponent[][] memory,
uint256
)
{
Order[] memory orders = new Order[](nfts.length + 1);
Order[] memory orders = new Order[](nfts.length);

ConsiderationItem[]
memory fulfillerConsiderationItems = new ConsiderationItem[](
nfts.length
);
FulfillmentComponent[][] memory offerFulfillments = new FulfillmentComponent[][](0);

Fulfillment[] memory fullfillments = new Fulfillment[](nfts.length + 1);
FulfillmentComponent[][] memory considerationFulfillments = new FulfillmentComponent[][](nfts.length);

for (uint256 i = 0; i < nfts.length; i++) {
// Build offer orders
Expand Down Expand Up @@ -217,41 +215,21 @@ contract SeaportOnePointFourConfig is
considerationItems
);
}
{
fulfillerConsiderationItems[i] = ConsiderationItem(
ItemType.ERC721,
nfts[i].token,
nfts[i].identifier,
1,
1,
payable(contexts[i].fulfiller)
);
}

{
// Add fulfillment components for each NFT

FulfillmentComponent
memory nftConsiderationComponent = FulfillmentComponent(
nfts.length,
i
);

FulfillmentComponent
memory nftOfferComponent = FulfillmentComponent(i, 0);

FulfillmentComponent[]
memory nftOfferComponents = new FulfillmentComponent[](1);
nftOfferComponents[0] = nftOfferComponent;

FulfillmentComponent[]
memory nftConsiderationComponents = new FulfillmentComponent[](
1
);
nftConsiderationComponents[0] = nftConsiderationComponent;
fullfillments[i] = Fulfillment(
nftOfferComponents,
nftConsiderationComponents
);
considerationFulfillments[i] = nftConsiderationComponents;
}
}

Expand All @@ -261,60 +239,7 @@ contract SeaportOnePointFourConfig is
sumAmounts += amounts[i];
}

{
FulfillmentComponent
memory paymentTokenOfferComponent = FulfillmentComponent(
nfts.length,
0
);

FulfillmentComponent[]
memory paymentTokenOfferComponents = new FulfillmentComponent[](
1
);
paymentTokenOfferComponents[0] = paymentTokenOfferComponent;

FulfillmentComponent[]
memory paymentTokenConsiderationComponents = new FulfillmentComponent[](
nfts.length
);
for (uint256 i = 0; i < nfts.length; i++) {
{
FulfillmentComponent
memory paymentTokenConsiderationComponent = FulfillmentComponent(
i,
0
);
paymentTokenConsiderationComponents[
i
] = paymentTokenConsiderationComponent;
}
}
fullfillments[nfts.length] = Fulfillment(
paymentTokenOfferComponents,
paymentTokenConsiderationComponents
);
}

// Build sweep floor order
OfferItem[] memory fulfillerOfferItems = new OfferItem[](1);
fulfillerOfferItems[0] = OfferItem(
paymentTokenAddress != address(0)
? ItemType.ERC20
: ItemType.NATIVE,
paymentTokenAddress,
0,
sumAmounts,
sumAmounts
);
orders[nfts.length] = buildOrder(
contexts[0].fulfiller,
fulfillerOfferItems,
fulfillerConsiderationItems
);
orders[nfts.length].signature = ""; // Signature isn't needed since fulfiller is msg.sender

return (orders, fullfillments, sumAmounts);
return (orders, offerFulfillments, considerationFulfillments, sumAmounts);
}

function beforeAllPrepareMarketplace(address, address) external override {
Expand Down Expand Up @@ -976,7 +901,8 @@ contract SeaportOnePointFourConfig is

(
Order[] memory orders,
Fulfillment[] memory fullfillments,
FulfillmentComponent[][] memory offerFulfillments,
FulfillmentComponent[][] memory considerationFulfillments,
uint256 sumEthAmount
) = buildOrderAndFulfillmentManyDistinctOrders(
contexts,
Expand Down Expand Up @@ -1007,9 +933,12 @@ contract SeaportOnePointFourConfig is
address(seaport),
sumEthAmount,
abi.encodeWithSelector(
ISeaport.matchOrders.selector,
ISeaport.fulfillAvailableOrders.selector,
orders,
fullfillments
offerFulfillments,
considerationFulfillments,
bytes32(0),
nfts.length
)
);
}
Expand All @@ -1027,7 +956,8 @@ contract SeaportOnePointFourConfig is
);
(
Order[] memory orders,
Fulfillment[] memory fullfillments,
FulfillmentComponent[][] memory offerFulfillments,
FulfillmentComponent[][] memory considerationFulfillments,

) = buildOrderAndFulfillmentManyDistinctOrders(
contexts,
Expand Down Expand Up @@ -1058,9 +988,12 @@ contract SeaportOnePointFourConfig is
address(seaport),
0,
abi.encodeWithSelector(
ISeaport.matchOrders.selector,
ISeaport.fulfillAvailableOrders.selector,
orders,
fullfillments
offerFulfillments,
considerationFulfillments,
bytes32(0),
nfts.length
)
);
}
Expand All @@ -1078,7 +1011,8 @@ contract SeaportOnePointFourConfig is
);
(
Order[] memory orders,
Fulfillment[] memory fullfillments,
FulfillmentComponent[][] memory offerFulfillments,
FulfillmentComponent[][] memory considerationFulfillments,

) = buildOrderAndFulfillmentManyDistinctOrders(
contexts,
Expand Down Expand Up @@ -1109,9 +1043,12 @@ contract SeaportOnePointFourConfig is
address(seaport),
0,
abi.encodeWithSelector(
ISeaport.matchOrders.selector,
ISeaport.fulfillAvailableOrders.selector,
orders,
fullfillments
offerFulfillments,
considerationFulfillments,
bytes32(0),
nfts.length
)
);
}
Expand Down