@@ -89,6 +89,7 @@ contract MarketplaceTest is BaseTest {
89
89
}
90
90
91
91
function test_createListing_auctionListing () public {
92
+ vm.warp (0 );
92
93
(uint256 createdListingId , Marketplace.ListingParameters memory createdListing ) = createERC721Listing (
93
94
getActor (0 ),
94
95
NATIVE_TOKEN,
@@ -114,6 +115,7 @@ contract MarketplaceTest is BaseTest {
114
115
vm.deal (getActor (0 ), 100 ether);
115
116
116
117
Marketplace.Offer memory winningBid;
118
+ vm.warp (0 );
117
119
(uint256 listingId , ) = createERC721Listing (
118
120
getActor (0 ),
119
121
NATIVE_TOKEN,
@@ -123,8 +125,8 @@ contract MarketplaceTest is BaseTest {
123
125
124
126
assertEq (getActor (0 ).balance, 100 ether);
125
127
126
- vm.warp (1 );
127
128
vm.prank (getActor (0 ));
129
+ vm.warp (1 );
128
130
marketplace.offer { value: 1 ether }(listingId, 1 , NATIVE_TOKEN, 1 ether, type (uint256 ).max);
129
131
winningBid = getWinningBid (listingId);
130
132
assertEq (getActor (0 ).balance, 99 ether);
@@ -134,8 +136,8 @@ contract MarketplaceTest is BaseTest {
134
136
assertEq (winningBid.currency, NATIVE_TOKEN);
135
137
assertEq (winningBid.pricePerToken, 1 ether);
136
138
137
- vm.warp (2 );
138
139
vm.prank (getActor (0 ));
140
+ vm.warp (2 );
139
141
marketplace.offer { value: 2 ether }(listingId, 1 , NATIVE_TOKEN, 2 ether, type (uint256 ).max);
140
142
winningBid = getWinningBid (listingId);
141
143
assertEq (getActor (0 ).balance, 98 ether);
@@ -152,6 +154,7 @@ contract MarketplaceTest is BaseTest {
152
154
153
155
// Actor-0 creates an auction listing.
154
156
vm.prank (getActor (0 ));
157
+ vm.warp (0 );
155
158
(uint256 listingId , ) = createERC721Listing (
156
159
getActor (0 ),
157
160
NATIVE_TOKEN,
@@ -168,8 +171,8 @@ contract MarketplaceTest is BaseTest {
168
171
* - Actor-1 receives auctioned items escrowed in Marketplace.
169
172
* - Winning bid amount is escrowed in the contract.
170
173
*/
171
- vm.warp (1 );
172
174
vm.prank (getActor (1 ));
175
+ vm.warp (1 );
173
176
marketplace.offer { value: 5 ether }(listingId, 1 , NATIVE_TOKEN, 5 ether, type (uint256 ).max);
174
177
175
178
assertEq (erc721.ownerOf (listing.tokenId), getActor (1 ));
@@ -199,14 +202,14 @@ contract MarketplaceTest is BaseTest {
199
202
200
203
// Actor-0 creates a direct listing with NATIVE_TOKEN as accepted currency.
201
204
vm.prank (getActor (0 ));
205
+ vm.warp (0 );
202
206
(uint256 listingId , ) = createERC721Listing (
203
207
getActor (0 ),
204
208
NATIVE_TOKEN,
205
209
5 ether,
206
210
IMarketplace.ListingType.Direct
207
211
);
208
212
209
- vm.warp (1 );
210
213
vm.startPrank (getActor (1 ));
211
214
212
215
// Actor-1 mints 4 ether worth of WETH
@@ -216,12 +219,13 @@ contract MarketplaceTest is BaseTest {
216
219
217
220
// Actor-1 makes an offer to the direct listing for 4 WETH.
218
221
weth.approve (address (marketplace), 4 ether);
222
+
223
+ vm.warp (1 );
219
224
marketplace.offer (listingId, 1 , NATIVE_TOKEN, 4 ether, type (uint256 ).max);
220
225
221
226
vm.stopPrank ();
222
227
223
228
// Actor-0 successfully accepts the offer.
224
- vm.warp (2 );
225
229
Marketplace.Listing memory listing = getListing (listingId);
226
230
assertEq (erc721.ownerOf (listing.tokenId), getActor (0 ));
227
231
assertEq (weth.balanceOf (getActor (0 )), 0 );
@@ -230,6 +234,7 @@ contract MarketplaceTest is BaseTest {
230
234
uint256 offerValuePostFee = (4 ether * (MAX_BPS - platformFeeBps)) / MAX_BPS;
231
235
232
236
vm.prank (getActor (0 ));
237
+ vm.warp (2 );
233
238
marketplace.acceptOffer (listingId, getActor (1 ), address (weth), 4 ether);
234
239
assertEq (erc721.ownerOf (listing.tokenId), getActor (1 ));
235
240
assertEq (weth.balanceOf (getActor (0 )), offerValuePostFee);
@@ -249,7 +254,6 @@ contract MarketplaceTest is BaseTest {
249
254
IMarketplace.ListingType.Direct
250
255
);
251
256
252
- vm.warp (1 );
253
257
vm.startPrank (getActor (1 ));
254
258
255
259
// Actor-1 mints 4 ether worth of WETH
@@ -259,12 +263,13 @@ contract MarketplaceTest is BaseTest {
259
263
260
264
// Actor-1 makes an offer to the direct listing for 4 WETH.
261
265
weth.approve (address (marketplace), 4 ether);
266
+
267
+ vm.warp (2 );
262
268
marketplace.offer (listingId, 1 , NATIVE_TOKEN, 4 ether, 0 );
263
269
264
270
vm.stopPrank ();
265
271
266
272
// Actor-0 successfully accepts the offer.
267
- vm.warp (2 );
268
273
Marketplace.Listing memory listing = getListing (listingId);
269
274
assertEq (erc721.ownerOf (listing.tokenId), getActor (0 ));
270
275
assertEq (weth.balanceOf (getActor (0 )), 0 );
@@ -275,9 +280,11 @@ contract MarketplaceTest is BaseTest {
275
280
marketplace.acceptOffer (listingId, getActor (1 ), address (weth), 4 ether);
276
281
277
282
vm.prank (getActor (1 ));
278
- marketplace.offer (listingId, 1 , NATIVE_TOKEN, 4 ether, 3 );
283
+ vm.warp (3 );
284
+ marketplace.offer (listingId, 1 , NATIVE_TOKEN, 4 ether, 5 );
279
285
280
286
vm.prank (getActor (0 ));
287
+ vm.warp (4 );
281
288
marketplace.acceptOffer (listingId, getActor (1 ), address (weth), 4 ether);
282
289
}
283
290
0 commit comments