@opensea/seaport-js 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/abi/DomainRegistry.d.ts +40 -0
- package/lib/abi/DomainRegistry.js +145 -0
- package/lib/abi/DomainRegistry.js.map +1 -0
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +2 -1
- package/lib/constants.js.map +1 -1
- package/lib/seaport.d.ts +7 -2
- package/lib/seaport.js +44 -2
- package/lib/seaport.js.map +1 -1
- package/lib/typechain/DomainRegistry.d.ts +97 -0
- package/lib/typechain/{Conduit.js → DomainRegistry.js} +1 -1
- package/lib/typechain/DomainRegistry.js.map +1 -0
- package/lib/types.d.ts +3 -0
- package/package.json +20 -1
- package/lib/__tests__/ascending-descending-amounts.spec.d.ts +0 -1
- package/lib/__tests__/ascending-descending-amounts.spec.js +0 -1016
- package/lib/__tests__/ascending-descending-amounts.spec.js.map +0 -1
- package/lib/__tests__/basic-fulfill.spec.d.ts +0 -1
- package/lib/__tests__/basic-fulfill.spec.js +0 -914
- package/lib/__tests__/basic-fulfill.spec.js.map +0 -1
- package/lib/__tests__/bundle.spec.d.ts +0 -1
- package/lib/__tests__/bundle.spec.js +0 -1226
- package/lib/__tests__/bundle.spec.js.map +0 -1
- package/lib/__tests__/cancel.spec.d.ts +0 -1
- package/lib/__tests__/cancel.spec.js +0 -194
- package/lib/__tests__/cancel.spec.js.map +0 -1
- package/lib/__tests__/create-order.spec.d.ts +0 -1
- package/lib/__tests__/create-order.spec.js +0 -1043
- package/lib/__tests__/create-order.spec.js.map +0 -1
- package/lib/__tests__/criteria-based.spec.d.ts +0 -1
- package/lib/__tests__/criteria-based.spec.js +0 -1593
- package/lib/__tests__/criteria-based.spec.js.map +0 -1
- package/lib/__tests__/fulfill-orders.spec.d.ts +0 -1
- package/lib/__tests__/fulfill-orders.spec.js +0 -1010
- package/lib/__tests__/fulfill-orders.spec.js.map +0 -1
- package/lib/__tests__/gifting.spec.d.ts +0 -1
- package/lib/__tests__/gifting.spec.js +0 -374
- package/lib/__tests__/gifting.spec.js.map +0 -1
- package/lib/__tests__/match-orders.spec.d.ts +0 -1
- package/lib/__tests__/match-orders.spec.js +0 -425
- package/lib/__tests__/match-orders.spec.js.map +0 -1
- package/lib/__tests__/partial-fulfill.spec.d.ts +0 -1
- package/lib/__tests__/partial-fulfill.spec.js +0 -849
- package/lib/__tests__/partial-fulfill.spec.js.map +0 -1
- package/lib/__tests__/sign-order.spec.d.ts +0 -1
- package/lib/__tests__/sign-order.spec.js +0 -147
- package/lib/__tests__/sign-order.spec.js.map +0 -1
- package/lib/__tests__/swap.spec.d.ts +0 -1
- package/lib/__tests__/swap.spec.js +0 -594
- package/lib/__tests__/swap.spec.js.map +0 -1
- package/lib/__tests__/utils/balance.d.ts +0 -22
- package/lib/__tests__/utils/balance.js +0 -271
- package/lib/__tests__/utils/balance.js.map +0 -1
- package/lib/__tests__/utils/examples/privateListings.d.ts +0 -3
- package/lib/__tests__/utils/examples/privateListings.js +0 -139
- package/lib/__tests__/utils/examples/privateListings.js.map +0 -1
- package/lib/__tests__/utils/setup.d.ts +0 -11
- package/lib/__tests__/utils/setup.js +0 -119
- package/lib/__tests__/utils/setup.js.map +0 -1
- package/lib/typechain/AmountDerivationErrors.d.ts +0 -29
- package/lib/typechain/AmountDerivationErrors.js +0 -3
- package/lib/typechain/AmountDerivationErrors.js.map +0 -1
- package/lib/typechain/AmountDeriver.d.ts +0 -29
- package/lib/typechain/AmountDeriver.js +0 -3
- package/lib/typechain/AmountDeriver.js.map +0 -1
- package/lib/typechain/Assertions.d.ts +0 -124
- package/lib/typechain/Assertions.js +0 -3
- package/lib/typechain/Assertions.js.map +0 -1
- package/lib/typechain/BasicOrderFulfiller.d.ts +0 -124
- package/lib/typechain/BasicOrderFulfiller.js +0 -3
- package/lib/typechain/BasicOrderFulfiller.js.map +0 -1
- package/lib/typechain/Conduit.d.ts +0 -156
- package/lib/typechain/Conduit.js.map +0 -1
- package/lib/typechain/ConduitController.d.ts +0 -266
- package/lib/typechain/ConduitController.js +0 -3
- package/lib/typechain/ConduitController.js.map +0 -1
- package/lib/typechain/ConduitControllerInterface.d.ts +0 -266
- package/lib/typechain/ConduitControllerInterface.js +0 -3
- package/lib/typechain/ConduitControllerInterface.js.map +0 -1
- package/lib/typechain/ConduitInterface.d.ts +0 -156
- package/lib/typechain/ConduitInterface.js +0 -3
- package/lib/typechain/ConduitInterface.js.map +0 -1
- package/lib/typechain/Consideration.d.ts +0 -686
- package/lib/typechain/Consideration.js +0 -3
- package/lib/typechain/Consideration.js.map +0 -1
- package/lib/typechain/ConsiderationBase.d.ts +0 -124
- package/lib/typechain/ConsiderationBase.js +0 -3
- package/lib/typechain/ConsiderationBase.js.map +0 -1
- package/lib/typechain/ConsiderationEventsAndErrors.d.ts +0 -124
- package/lib/typechain/ConsiderationEventsAndErrors.js +0 -3
- package/lib/typechain/ConsiderationEventsAndErrors.js.map +0 -1
- package/lib/typechain/ConsiderationInterface.d.ts +0 -612
- package/lib/typechain/ConsiderationInterface.js +0 -3
- package/lib/typechain/ConsiderationInterface.js.map +0 -1
- package/lib/typechain/CounterManager.d.ts +0 -124
- package/lib/typechain/CounterManager.js +0 -3
- package/lib/typechain/CounterManager.js.map +0 -1
- package/lib/typechain/CriteriaResolution.d.ts +0 -29
- package/lib/typechain/CriteriaResolution.js +0 -3
- package/lib/typechain/CriteriaResolution.js.map +0 -1
- package/lib/typechain/CriteriaResolutionErrors.d.ts +0 -29
- package/lib/typechain/CriteriaResolutionErrors.js +0 -3
- package/lib/typechain/CriteriaResolutionErrors.js.map +0 -1
- package/lib/typechain/EIP1271Interface.d.ts +0 -43
- package/lib/typechain/EIP1271Interface.js +0 -3
- package/lib/typechain/EIP1271Interface.js.map +0 -1
- package/lib/typechain/ERC1155Interface.d.ts +0 -67
- package/lib/typechain/ERC1155Interface.js +0 -3
- package/lib/typechain/ERC1155Interface.js.map +0 -1
- package/lib/typechain/ERC1155TokenReceiver.d.ts +0 -67
- package/lib/typechain/ERC1155TokenReceiver.js +0 -3
- package/lib/typechain/ERC1155TokenReceiver.js.map +0 -1
- package/lib/typechain/ERC20Interface.d.ts +0 -51
- package/lib/typechain/ERC20Interface.js +0 -3
- package/lib/typechain/ERC20Interface.js.map +0 -1
- package/lib/typechain/ERC721Interface.d.ts +0 -51
- package/lib/typechain/ERC721Interface.js +0 -3
- package/lib/typechain/ERC721Interface.js.map +0 -1
- package/lib/typechain/ERC721TokenReceiver.d.ts +0 -51
- package/lib/typechain/ERC721TokenReceiver.js +0 -3
- package/lib/typechain/ERC721TokenReceiver.js.map +0 -1
- package/lib/typechain/Executor.d.ts +0 -124
- package/lib/typechain/Executor.js +0 -3
- package/lib/typechain/Executor.js.map +0 -1
- package/lib/typechain/FulfillmentApplicationErrors.d.ts +0 -29
- package/lib/typechain/FulfillmentApplicationErrors.js +0 -3
- package/lib/typechain/FulfillmentApplicationErrors.js.map +0 -1
- package/lib/typechain/FulfillmentApplier.d.ts +0 -29
- package/lib/typechain/FulfillmentApplier.js +0 -3
- package/lib/typechain/FulfillmentApplier.js.map +0 -1
- package/lib/typechain/GettersAndDerivers.d.ts +0 -124
- package/lib/typechain/GettersAndDerivers.js +0 -3
- package/lib/typechain/GettersAndDerivers.js.map +0 -1
- package/lib/typechain/OrderCombiner.d.ts +0 -124
- package/lib/typechain/OrderCombiner.js +0 -3
- package/lib/typechain/OrderCombiner.js.map +0 -1
- package/lib/typechain/OrderFulfiller.d.ts +0 -124
- package/lib/typechain/OrderFulfiller.js +0 -3
- package/lib/typechain/OrderFulfiller.js.map +0 -1
- package/lib/typechain/OrderValidator.d.ts +0 -124
- package/lib/typechain/OrderValidator.js +0 -3
- package/lib/typechain/OrderValidator.js.map +0 -1
- package/lib/typechain/ReentrancyErrors.d.ts +0 -29
- package/lib/typechain/ReentrancyErrors.js +0 -3
- package/lib/typechain/ReentrancyErrors.js.map +0 -1
- package/lib/typechain/ReentrancyGuard.d.ts +0 -29
- package/lib/typechain/ReentrancyGuard.js +0 -3
- package/lib/typechain/ReentrancyGuard.js.map +0 -1
- package/lib/typechain/SignatureVerification.d.ts +0 -29
- package/lib/typechain/SignatureVerification.js +0 -3
- package/lib/typechain/SignatureVerification.js.map +0 -1
- package/lib/typechain/SignatureVerificationErrors.d.ts +0 -29
- package/lib/typechain/SignatureVerificationErrors.js +0 -3
- package/lib/typechain/SignatureVerificationErrors.js.map +0 -1
- package/lib/typechain/TestERC1155.d.ts +0 -205
- package/lib/typechain/TestERC1155.js +0 -3
- package/lib/typechain/TestERC1155.js.map +0 -1
- package/lib/typechain/TestERC20.d.ts +0 -249
- package/lib/typechain/TestERC20.js +0 -3
- package/lib/typechain/TestERC20.js.map +0 -1
- package/lib/typechain/TestERC721.d.ts +0 -236
- package/lib/typechain/TestERC721.js +0 -3
- package/lib/typechain/TestERC721.js.map +0 -1
- package/lib/typechain/TokenTransferrer.d.ts +0 -29
- package/lib/typechain/TokenTransferrer.js +0 -3
- package/lib/typechain/TokenTransferrer.js.map +0 -1
- package/lib/typechain/TokenTransferrerErrors.d.ts +0 -29
- package/lib/typechain/TokenTransferrerErrors.js +0 -3
- package/lib/typechain/TokenTransferrerErrors.js.map +0 -1
- package/lib/typechain/Verifiers.d.ts +0 -124
- package/lib/typechain/Verifiers.js +0 -3
- package/lib/typechain/Verifiers.js.map +0 -1
- package/lib/typechain/ZoneInteraction.d.ts +0 -29
- package/lib/typechain/ZoneInteraction.js +0 -3
- package/lib/typechain/ZoneInteraction.js.map +0 -1
- package/lib/typechain/ZoneInteractionErrors.d.ts +0 -29
- package/lib/typechain/ZoneInteractionErrors.js +0 -3
- package/lib/typechain/ZoneInteractionErrors.js.map +0 -1
- package/lib/typechain/ZoneInterface.d.ts +0 -182
- package/lib/typechain/ZoneInterface.js +0 -3
- package/lib/typechain/ZoneInterface.js.map +0 -1
- package/lib/typechain/factories/AmountDerivationErrors__factory.d.ts +0 -12
- package/lib/typechain/factories/AmountDerivationErrors__factory.js +0 -28
- package/lib/typechain/factories/AmountDerivationErrors__factory.js.map +0 -1
- package/lib/typechain/factories/AmountDeriver__factory.d.ts +0 -26
- package/lib/typechain/factories/AmountDeriver__factory.js +0 -97
- package/lib/typechain/factories/AmountDeriver__factory.js.map +0 -1
- package/lib/typechain/factories/Assertions__factory.d.ts +0 -64
- package/lib/typechain/factories/Assertions__factory.js +0 -526
- package/lib/typechain/factories/Assertions__factory.js.map +0 -1
- package/lib/typechain/factories/BasicOrderFulfiller__factory.d.ts +0 -64
- package/lib/typechain/factories/BasicOrderFulfiller__factory.js +0 -563
- package/lib/typechain/factories/BasicOrderFulfiller__factory.js.map +0 -1
- package/lib/typechain/factories/ConduitControllerInterface__factory.d.ts +0 -46
- package/lib/typechain/factories/ConduitControllerInterface__factory.js +0 -453
- package/lib/typechain/factories/ConduitControllerInterface__factory.js.map +0 -1
- package/lib/typechain/factories/ConduitController__factory.d.ts +0 -67
- package/lib/typechain/factories/ConduitController__factory.js +0 -527
- package/lib/typechain/factories/ConduitController__factory.js.map +0 -1
- package/lib/typechain/factories/ConduitInterface__factory.d.ts +0 -62
- package/lib/typechain/factories/ConduitInterface__factory.js +0 -282
- package/lib/typechain/factories/ConduitInterface__factory.js.map +0 -1
- package/lib/typechain/factories/Conduit__factory.d.ts +0 -83
- package/lib/typechain/factories/Conduit__factory.js +0 -465
- package/lib/typechain/factories/Conduit__factory.js.map +0 -1
- package/lib/typechain/factories/ConsiderationBase__factory.d.ts +0 -64
- package/lib/typechain/factories/ConsiderationBase__factory.js +0 -412
- package/lib/typechain/factories/ConsiderationBase__factory.js.map +0 -1
- package/lib/typechain/factories/ConsiderationEventsAndErrors__factory.d.ts +0 -38
- package/lib/typechain/factories/ConsiderationEventsAndErrors__factory.js +0 -332
- package/lib/typechain/factories/ConsiderationEventsAndErrors__factory.js.map +0 -1
- package/lib/typechain/factories/ConsiderationInterface__factory.d.ts +0 -72
- package/lib/typechain/factories/ConsiderationInterface__factory.js +0 -2064
- package/lib/typechain/factories/ConsiderationInterface__factory.js.map +0 -1
- package/lib/typechain/factories/Consideration__factory.d.ts +0 -132
- package/lib/typechain/factories/Consideration__factory.js +0 -2670
- package/lib/typechain/factories/Consideration__factory.js.map +0 -1
- package/lib/typechain/factories/CounterManager__factory.d.ts +0 -52
- package/lib/typechain/factories/CounterManager__factory.js +0 -406
- package/lib/typechain/factories/CounterManager__factory.js.map +0 -1
- package/lib/typechain/factories/CriteriaResolutionErrors__factory.d.ts +0 -12
- package/lib/typechain/factories/CriteriaResolutionErrors__factory.js +0 -58
- package/lib/typechain/factories/CriteriaResolutionErrors__factory.js.map +0 -1
- package/lib/typechain/factories/CriteriaResolution__factory.d.ts +0 -26
- package/lib/typechain/factories/CriteriaResolution__factory.js +0 -127
- package/lib/typechain/factories/CriteriaResolution__factory.js.map +0 -1
- package/lib/typechain/factories/EIP1271Interface__factory.d.ts +0 -22
- package/lib/typechain/factories/EIP1271Interface__factory.js +0 -47
- package/lib/typechain/factories/EIP1271Interface__factory.js.map +0 -1
- package/lib/typechain/factories/ERC1155Interface__factory.d.ts +0 -18
- package/lib/typechain/factories/ERC1155Interface__factory.js +0 -89
- package/lib/typechain/factories/ERC1155Interface__factory.js.map +0 -1
- package/lib/typechain/factories/ERC1155TokenReceiver__factory.d.ts +0 -22
- package/lib/typechain/factories/ERC1155TokenReceiver__factory.js +0 -101
- package/lib/typechain/factories/ERC1155TokenReceiver__factory.js.map +0 -1
- package/lib/typechain/factories/ERC1155__factory.d.ts +0 -35
- package/lib/typechain/factories/ERC1155__factory.js +0 -335
- package/lib/typechain/factories/ERC1155__factory.js.map +0 -1
- package/lib/typechain/factories/ERC20Interface__factory.d.ts +0 -22
- package/lib/typechain/factories/ERC20Interface__factory.js +0 -52
- package/lib/typechain/factories/ERC20Interface__factory.js.map +0 -1
- package/lib/typechain/factories/ERC20__factory.d.ts +0 -35
- package/lib/typechain/factories/ERC20__factory.js +0 -333
- package/lib/typechain/factories/ERC20__factory.js.map +0 -1
- package/lib/typechain/factories/ERC721Interface__factory.d.ts +0 -18
- package/lib/typechain/factories/ERC721Interface__factory.js +0 -46
- package/lib/typechain/factories/ERC721Interface__factory.js.map +0 -1
- package/lib/typechain/factories/ERC721TokenReceiver__factory.d.ts +0 -22
- package/lib/typechain/factories/ERC721TokenReceiver__factory.js +0 -57
- package/lib/typechain/factories/ERC721TokenReceiver__factory.js.map +0 -1
- package/lib/typechain/factories/ERC721__factory.d.ts +0 -35
- package/lib/typechain/factories/ERC721__factory.js +0 -353
- package/lib/typechain/factories/ERC721__factory.js.map +0 -1
- package/lib/typechain/factories/Executor__factory.d.ts +0 -64
- package/lib/typechain/factories/Executor__factory.js +0 -552
- package/lib/typechain/factories/Executor__factory.js.map +0 -1
- package/lib/typechain/factories/FulfillmentApplicationErrors__factory.d.ts +0 -16
- package/lib/typechain/factories/FulfillmentApplicationErrors__factory.js +0 -49
- package/lib/typechain/factories/FulfillmentApplicationErrors__factory.js.map +0 -1
- package/lib/typechain/factories/FulfillmentApplier__factory.d.ts +0 -30
- package/lib/typechain/factories/FulfillmentApplier__factory.js +0 -118
- package/lib/typechain/factories/FulfillmentApplier__factory.js.map +0 -1
- package/lib/typechain/factories/GettersAndDerivers__factory.d.ts +0 -64
- package/lib/typechain/factories/GettersAndDerivers__factory.js +0 -412
- package/lib/typechain/factories/GettersAndDerivers__factory.js.map +0 -1
- package/lib/typechain/factories/OrderCombiner__factory.d.ts +0 -64
- package/lib/typechain/factories/OrderCombiner__factory.js +0 -629
- package/lib/typechain/factories/OrderCombiner__factory.js.map +0 -1
- package/lib/typechain/factories/OrderFulfiller__factory.d.ts +0 -64
- package/lib/typechain/factories/OrderFulfiller__factory.js +0 -603
- package/lib/typechain/factories/OrderFulfiller__factory.js.map +0 -1
- package/lib/typechain/factories/OrderValidator__factory.d.ts +0 -64
- package/lib/typechain/factories/OrderValidator__factory.js +0 -563
- package/lib/typechain/factories/OrderValidator__factory.js.map +0 -1
- package/lib/typechain/factories/ReentrancyErrors__factory.d.ts +0 -12
- package/lib/typechain/factories/ReentrancyErrors__factory.js +0 -28
- package/lib/typechain/factories/ReentrancyErrors__factory.js.map +0 -1
- package/lib/typechain/factories/ReentrancyGuard__factory.d.ts +0 -32
- package/lib/typechain/factories/ReentrancyGuard__factory.js +0 -102
- package/lib/typechain/factories/ReentrancyGuard__factory.js.map +0 -1
- package/lib/typechain/factories/Seaport__factory.d.ts +0 -132
- package/lib/typechain/factories/Seaport__factory.js +0 -2670
- package/lib/typechain/factories/Seaport__factory.js.map +0 -1
- package/lib/typechain/factories/SignatureVerificationErrors__factory.d.ts +0 -16
- package/lib/typechain/factories/SignatureVerificationErrors__factory.js +0 -49
- package/lib/typechain/factories/SignatureVerificationErrors__factory.js.map +0 -1
- package/lib/typechain/factories/SignatureVerification__factory.d.ts +0 -30
- package/lib/typechain/factories/SignatureVerification__factory.js +0 -118
- package/lib/typechain/factories/SignatureVerification__factory.js.map +0 -1
- package/lib/typechain/factories/TestERC1155__factory.d.ts +0 -49
- package/lib/typechain/factories/TestERC1155__factory.js +0 -433
- package/lib/typechain/factories/TestERC1155__factory.js.map +0 -1
- package/lib/typechain/factories/TestERC20__factory.d.ts +0 -56
- package/lib/typechain/factories/TestERC20__factory.js +0 -457
- package/lib/typechain/factories/TestERC20__factory.js.map +0 -1
- package/lib/typechain/factories/TestERC721__factory.d.ts +0 -49
- package/lib/typechain/factories/TestERC721__factory.js +0 -446
- package/lib/typechain/factories/TestERC721__factory.js.map +0 -1
- package/lib/typechain/factories/TokenTransferrerErrors__factory.d.ts +0 -16
- package/lib/typechain/factories/TokenTransferrerErrors__factory.js +0 -132
- package/lib/typechain/factories/TokenTransferrerErrors__factory.js.map +0 -1
- package/lib/typechain/factories/TokenTransferrer__factory.d.ts +0 -30
- package/lib/typechain/factories/TokenTransferrer__factory.js +0 -201
- package/lib/typechain/factories/TokenTransferrer__factory.js.map +0 -1
- package/lib/typechain/factories/Verifiers__factory.d.ts +0 -64
- package/lib/typechain/factories/Verifiers__factory.js +0 -552
- package/lib/typechain/factories/Verifiers__factory.js.map +0 -1
- package/lib/typechain/factories/ZoneInteractionErrors__factory.d.ts +0 -16
- package/lib/typechain/factories/ZoneInteractionErrors__factory.js +0 -34
- package/lib/typechain/factories/ZoneInteractionErrors__factory.js.map +0 -1
- package/lib/typechain/factories/ZoneInteraction__factory.d.ts +0 -30
- package/lib/typechain/factories/ZoneInteraction__factory.js +0 -103
- package/lib/typechain/factories/ZoneInteraction__factory.js.map +0 -1
- package/lib/typechain/factories/ZoneInterface__factory.d.ts +0 -52
- package/lib/typechain/factories/ZoneInterface__factory.js +0 -266
- package/lib/typechain/factories/ZoneInterface__factory.js.map +0 -1
- package/lib/typechain/index.d.ts +0 -90
- package/lib/typechain/index.js +0 -94
- package/lib/typechain/index.js.map +0 -1
|
@@ -1,1016 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
-
function step(op) {
|
|
50
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
-
while (_) try {
|
|
52
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
53
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
-
switch (op[0]) {
|
|
55
|
-
case 0: case 1: t = op; break;
|
|
56
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
-
default:
|
|
60
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
-
if (t[2]) _.ops.pop();
|
|
65
|
-
_.trys.pop(); continue;
|
|
66
|
-
}
|
|
67
|
-
op = body.call(thisArg, _);
|
|
68
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
73
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
74
|
-
if (!m) return o;
|
|
75
|
-
var i = m.call(o), r, ar = [], e;
|
|
76
|
-
try {
|
|
77
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
78
|
-
}
|
|
79
|
-
catch (error) { e = { error: error }; }
|
|
80
|
-
finally {
|
|
81
|
-
try {
|
|
82
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
83
|
-
}
|
|
84
|
-
finally { if (e) throw e.error; }
|
|
85
|
-
}
|
|
86
|
-
return ar;
|
|
87
|
-
};
|
|
88
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
89
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
90
|
-
};
|
|
91
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
92
|
-
var multicall_1 = require("@0xsequence/multicall");
|
|
93
|
-
var chai_1 = require("chai");
|
|
94
|
-
var ethers_1 = require("ethers");
|
|
95
|
-
var utils_1 = require("ethers/lib/utils");
|
|
96
|
-
var hardhat_1 = require("hardhat");
|
|
97
|
-
var sinon_1 = __importDefault(require("sinon"));
|
|
98
|
-
var constants_1 = require("../constants");
|
|
99
|
-
var fulfill = __importStar(require("../utils/fulfill"));
|
|
100
|
-
var order_1 = require("../utils/order");
|
|
101
|
-
var balance_1 = require("./utils/balance");
|
|
102
|
-
var setup_1 = require("./utils/setup");
|
|
103
|
-
var SECONDS_IN_WEEK = 604800;
|
|
104
|
-
(0, setup_1.describeWithFixture)("As a user I want to create a dutch auction", function (fixture) {
|
|
105
|
-
var offerer;
|
|
106
|
-
var zone;
|
|
107
|
-
var fulfiller;
|
|
108
|
-
var multicallProvider;
|
|
109
|
-
var fulfillStandardOrderSpy;
|
|
110
|
-
var standardCreateOrderInput;
|
|
111
|
-
var startTime;
|
|
112
|
-
var endTime;
|
|
113
|
-
var nftId = "1";
|
|
114
|
-
var erc1155Amount = "5";
|
|
115
|
-
beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
116
|
-
var _a;
|
|
117
|
-
return __generator(this, function (_b) {
|
|
118
|
-
switch (_b.label) {
|
|
119
|
-
case 0: return [4 /*yield*/, hardhat_1.ethers.getSigners()];
|
|
120
|
-
case 1:
|
|
121
|
-
_a = __read.apply(void 0, [_b.sent(), 3]), offerer = _a[0], zone = _a[1], fulfiller = _a[2];
|
|
122
|
-
multicallProvider = new multicall_1.providers.MulticallProvider(hardhat_1.ethers.provider);
|
|
123
|
-
fulfillStandardOrderSpy = sinon_1.default.spy(fulfill, "fulfillStandardOrder");
|
|
124
|
-
return [2 /*return*/];
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}); });
|
|
128
|
-
afterEach(function () {
|
|
129
|
-
fulfillStandardOrderSpy.restore();
|
|
130
|
-
});
|
|
131
|
-
describe("A single ERC721 is to be transferred", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
132
|
-
return __generator(this, function (_a) {
|
|
133
|
-
describe("Ascending dutch auction", function () {
|
|
134
|
-
beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
135
|
-
var testErc721;
|
|
136
|
-
return __generator(this, function (_a) {
|
|
137
|
-
switch (_a.label) {
|
|
138
|
-
case 0:
|
|
139
|
-
testErc721 = fixture.testErc721;
|
|
140
|
-
// Mint ERC721 to offerer
|
|
141
|
-
return [4 /*yield*/, testErc721.mint(offerer.address, nftId)];
|
|
142
|
-
case 1:
|
|
143
|
-
// Mint ERC721 to offerer
|
|
144
|
-
_a.sent();
|
|
145
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock("latest")];
|
|
146
|
-
case 2: return [4 /*yield*/, (_a.sent()).timestamp.toString()];
|
|
147
|
-
case 3:
|
|
148
|
-
startTime = _a.sent();
|
|
149
|
-
// Ends one week from the start date
|
|
150
|
-
endTime = ethers_1.BigNumber.from(startTime).add(SECONDS_IN_WEEK).toString();
|
|
151
|
-
standardCreateOrderInput = {
|
|
152
|
-
startTime: startTime,
|
|
153
|
-
endTime: endTime,
|
|
154
|
-
salt: (0, order_1.generateRandomSalt)(),
|
|
155
|
-
offer: [
|
|
156
|
-
{
|
|
157
|
-
itemType: constants_1.ItemType.ERC721,
|
|
158
|
-
token: testErc721.address,
|
|
159
|
-
identifier: nftId,
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
consideration: [
|
|
163
|
-
{
|
|
164
|
-
amount: (0, utils_1.parseEther)("10").toString(),
|
|
165
|
-
endAmount: (0, utils_1.parseEther)("20").toString(),
|
|
166
|
-
recipient: offerer.address,
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
// 2.5% fee
|
|
170
|
-
fees: [{ recipient: zone.address, basisPoints: 250 }],
|
|
171
|
-
};
|
|
172
|
-
return [2 /*return*/];
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
}); });
|
|
176
|
-
it("ERC721 <=> ETH", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
177
|
-
var seaport, executeAllActions, order, ownerToTokenToIdentifierBalances, nextBlockTimestamp, actions, action, transaction, receipt, currentBlockTimestamp;
|
|
178
|
-
return __generator(this, function (_a) {
|
|
179
|
-
switch (_a.label) {
|
|
180
|
-
case 0:
|
|
181
|
-
seaport = fixture.seaport;
|
|
182
|
-
return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
|
|
183
|
-
case 1:
|
|
184
|
-
executeAllActions = (_a.sent()).executeAllActions;
|
|
185
|
-
return [4 /*yield*/, executeAllActions()];
|
|
186
|
-
case 2:
|
|
187
|
-
order = _a.sent();
|
|
188
|
-
(0, chai_1.expect)(order.parameters.orderType).eq(constants_1.OrderType.FULL_OPEN);
|
|
189
|
-
return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
|
|
190
|
-
case 3:
|
|
191
|
-
ownerToTokenToIdentifierBalances = _a.sent();
|
|
192
|
-
nextBlockTimestamp = ethers_1.BigNumber.from(startTime)
|
|
193
|
-
.add(endTime)
|
|
194
|
-
.div(2)
|
|
195
|
-
.toNumber();
|
|
196
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
197
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_setNextBlockTimestamp", [
|
|
198
|
-
nextBlockTimestamp,
|
|
199
|
-
])];
|
|
200
|
-
case 4:
|
|
201
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
202
|
-
_a.sent();
|
|
203
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_mine", [])];
|
|
204
|
-
case 5:
|
|
205
|
-
_a.sent();
|
|
206
|
-
return [4 /*yield*/, seaport.fulfillOrder({
|
|
207
|
-
order: order,
|
|
208
|
-
accountAddress: fulfiller.address,
|
|
209
|
-
})];
|
|
210
|
-
case 6:
|
|
211
|
-
actions = (_a.sent()).actions;
|
|
212
|
-
(0, chai_1.expect)(actions.length).to.eq(1);
|
|
213
|
-
action = actions[0];
|
|
214
|
-
(0, chai_1.expect)(action).to.deep.equal({
|
|
215
|
-
type: "exchange",
|
|
216
|
-
transactionMethods: action.transactionMethods,
|
|
217
|
-
});
|
|
218
|
-
return [4 /*yield*/, action.transactionMethods.transact()];
|
|
219
|
-
case 7:
|
|
220
|
-
transaction = _a.sent();
|
|
221
|
-
return [4 /*yield*/, transaction.wait()];
|
|
222
|
-
case 8:
|
|
223
|
-
receipt = _a.sent();
|
|
224
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock(receipt.blockNumber)];
|
|
225
|
-
case 9: return [4 /*yield*/, (_a.sent()).timestamp];
|
|
226
|
-
case 10:
|
|
227
|
-
currentBlockTimestamp = _a.sent();
|
|
228
|
-
return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
|
|
229
|
-
ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
|
|
230
|
-
order: order,
|
|
231
|
-
fulfillerAddress: fulfiller.address,
|
|
232
|
-
multicallProvider: multicallProvider,
|
|
233
|
-
fulfillReceipt: receipt,
|
|
234
|
-
timeBasedItemParams: {
|
|
235
|
-
startTime: startTime,
|
|
236
|
-
endTime: endTime,
|
|
237
|
-
currentBlockTimestamp: currentBlockTimestamp,
|
|
238
|
-
ascendingAmountTimestampBuffer: 0,
|
|
239
|
-
},
|
|
240
|
-
})];
|
|
241
|
-
case 11:
|
|
242
|
-
_a.sent();
|
|
243
|
-
(0, chai_1.expect)(fulfillStandardOrderSpy).calledOnce;
|
|
244
|
-
return [2 /*return*/];
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
}); });
|
|
248
|
-
it("ERC721 <=> ERC20", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
249
|
-
var seaport, testErc20, executeAllActions, order, nextBlockTimestamp, ownerToTokenToIdentifierBalances, actions, approvalAction, _a, fulfillAction, transaction, receipt, currentBlockTimestamp;
|
|
250
|
-
return __generator(this, function (_b) {
|
|
251
|
-
switch (_b.label) {
|
|
252
|
-
case 0:
|
|
253
|
-
seaport = fixture.seaport, testErc20 = fixture.testErc20;
|
|
254
|
-
// Use ERC20 instead of eth
|
|
255
|
-
standardCreateOrderInput = __assign(__assign({}, standardCreateOrderInput), { consideration: standardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
|
|
256
|
-
return [4 /*yield*/, testErc20.mint(fulfiller.address, ethers_1.BigNumber.from(standardCreateOrderInput.consideration[0]
|
|
257
|
-
.endAmount))];
|
|
258
|
-
case 1:
|
|
259
|
-
_b.sent();
|
|
260
|
-
return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
|
|
261
|
-
case 2:
|
|
262
|
-
executeAllActions = (_b.sent()).executeAllActions;
|
|
263
|
-
return [4 /*yield*/, executeAllActions()];
|
|
264
|
-
case 3:
|
|
265
|
-
order = _b.sent();
|
|
266
|
-
(0, chai_1.expect)(order.parameters.orderType).eq(constants_1.OrderType.FULL_OPEN);
|
|
267
|
-
nextBlockTimestamp = ethers_1.BigNumber.from(startTime)
|
|
268
|
-
.add(endTime)
|
|
269
|
-
.div(2)
|
|
270
|
-
.toNumber();
|
|
271
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
272
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_setNextBlockTimestamp", [
|
|
273
|
-
nextBlockTimestamp,
|
|
274
|
-
])];
|
|
275
|
-
case 4:
|
|
276
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
277
|
-
_b.sent();
|
|
278
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_mine", [])];
|
|
279
|
-
case 5:
|
|
280
|
-
_b.sent();
|
|
281
|
-
return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
|
|
282
|
-
case 6:
|
|
283
|
-
ownerToTokenToIdentifierBalances = _b.sent();
|
|
284
|
-
return [4 /*yield*/, seaport.fulfillOrder({
|
|
285
|
-
order: order,
|
|
286
|
-
accountAddress: fulfiller.address,
|
|
287
|
-
})];
|
|
288
|
-
case 7:
|
|
289
|
-
actions = (_b.sent()).actions;
|
|
290
|
-
(0, chai_1.expect)(actions.length).to.eq(2);
|
|
291
|
-
approvalAction = actions[0];
|
|
292
|
-
(0, chai_1.expect)(approvalAction).to.deep.equal({
|
|
293
|
-
type: "approval",
|
|
294
|
-
token: testErc20.address,
|
|
295
|
-
identifierOrCriteria: "0",
|
|
296
|
-
itemType: constants_1.ItemType.ERC20,
|
|
297
|
-
transactionMethods: approvalAction.transactionMethods,
|
|
298
|
-
operator: seaport.contract.address,
|
|
299
|
-
});
|
|
300
|
-
return [4 /*yield*/, approvalAction.transactionMethods.transact()];
|
|
301
|
-
case 8:
|
|
302
|
-
_b.sent();
|
|
303
|
-
_a = chai_1.expect;
|
|
304
|
-
return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
|
|
305
|
-
case 9:
|
|
306
|
-
_a.apply(void 0, [_b.sent()]).to.equal(constants_1.MAX_INT);
|
|
307
|
-
fulfillAction = actions[1];
|
|
308
|
-
(0, chai_1.expect)(fulfillAction).to.be.deep.equal({
|
|
309
|
-
type: "exchange",
|
|
310
|
-
transactionMethods: fulfillAction.transactionMethods,
|
|
311
|
-
});
|
|
312
|
-
return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
|
|
313
|
-
case 10:
|
|
314
|
-
transaction = _b.sent();
|
|
315
|
-
return [4 /*yield*/, transaction.wait()];
|
|
316
|
-
case 11:
|
|
317
|
-
receipt = _b.sent();
|
|
318
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock(receipt.blockNumber)];
|
|
319
|
-
case 12: return [4 /*yield*/, (_b.sent()).timestamp];
|
|
320
|
-
case 13:
|
|
321
|
-
currentBlockTimestamp = _b.sent();
|
|
322
|
-
return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
|
|
323
|
-
ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
|
|
324
|
-
order: order,
|
|
325
|
-
fulfillerAddress: fulfiller.address,
|
|
326
|
-
multicallProvider: multicallProvider,
|
|
327
|
-
fulfillReceipt: receipt,
|
|
328
|
-
timeBasedItemParams: {
|
|
329
|
-
startTime: startTime,
|
|
330
|
-
endTime: endTime,
|
|
331
|
-
currentBlockTimestamp: currentBlockTimestamp,
|
|
332
|
-
ascendingAmountTimestampBuffer: 0,
|
|
333
|
-
},
|
|
334
|
-
})];
|
|
335
|
-
case 14:
|
|
336
|
-
_b.sent();
|
|
337
|
-
(0, chai_1.expect)(fulfillStandardOrderSpy).calledOnce;
|
|
338
|
-
return [2 /*return*/];
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
}); });
|
|
342
|
-
});
|
|
343
|
-
describe("Descending dutch auction", function () {
|
|
344
|
-
beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
345
|
-
var testErc721;
|
|
346
|
-
return __generator(this, function (_a) {
|
|
347
|
-
switch (_a.label) {
|
|
348
|
-
case 0:
|
|
349
|
-
testErc721 = fixture.testErc721;
|
|
350
|
-
// Mint 10 ERC1155s to offerer
|
|
351
|
-
return [4 /*yield*/, testErc721.mint(offerer.address, nftId)];
|
|
352
|
-
case 1:
|
|
353
|
-
// Mint 10 ERC1155s to offerer
|
|
354
|
-
_a.sent();
|
|
355
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock("latest")];
|
|
356
|
-
case 2: return [4 /*yield*/, (_a.sent()).timestamp.toString()];
|
|
357
|
-
case 3:
|
|
358
|
-
startTime = _a.sent();
|
|
359
|
-
// Ends one week from the start date
|
|
360
|
-
endTime = ethers_1.BigNumber.from(startTime).add(SECONDS_IN_WEEK).toString();
|
|
361
|
-
standardCreateOrderInput = {
|
|
362
|
-
startTime: startTime,
|
|
363
|
-
endTime: endTime,
|
|
364
|
-
salt: (0, order_1.generateRandomSalt)(),
|
|
365
|
-
offer: [
|
|
366
|
-
{
|
|
367
|
-
itemType: constants_1.ItemType.ERC721,
|
|
368
|
-
token: testErc721.address,
|
|
369
|
-
identifier: nftId,
|
|
370
|
-
},
|
|
371
|
-
],
|
|
372
|
-
consideration: [
|
|
373
|
-
{
|
|
374
|
-
amount: (0, utils_1.parseEther)("20").toString(),
|
|
375
|
-
endAmount: (0, utils_1.parseEther)("10").toString(),
|
|
376
|
-
recipient: offerer.address,
|
|
377
|
-
},
|
|
378
|
-
],
|
|
379
|
-
// 2.5% fee
|
|
380
|
-
fees: [{ recipient: zone.address, basisPoints: 250 }],
|
|
381
|
-
};
|
|
382
|
-
return [2 /*return*/];
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
}); });
|
|
386
|
-
it("ERC721 <=> ETH", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
387
|
-
var seaport, executeAllActions, order, ownerToTokenToIdentifierBalances, nextBlockTimestamp, actions, action, transaction, receipt, currentBlockTimestamp;
|
|
388
|
-
return __generator(this, function (_a) {
|
|
389
|
-
switch (_a.label) {
|
|
390
|
-
case 0:
|
|
391
|
-
seaport = fixture.seaport;
|
|
392
|
-
return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
|
|
393
|
-
case 1:
|
|
394
|
-
executeAllActions = (_a.sent()).executeAllActions;
|
|
395
|
-
return [4 /*yield*/, executeAllActions()];
|
|
396
|
-
case 2:
|
|
397
|
-
order = _a.sent();
|
|
398
|
-
(0, chai_1.expect)(order.parameters.orderType).eq(constants_1.OrderType.FULL_OPEN);
|
|
399
|
-
return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
|
|
400
|
-
case 3:
|
|
401
|
-
ownerToTokenToIdentifierBalances = _a.sent();
|
|
402
|
-
nextBlockTimestamp = ethers_1.BigNumber.from(startTime)
|
|
403
|
-
.add(endTime)
|
|
404
|
-
.div(2)
|
|
405
|
-
.toNumber();
|
|
406
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
407
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_setNextBlockTimestamp", [
|
|
408
|
-
nextBlockTimestamp,
|
|
409
|
-
])];
|
|
410
|
-
case 4:
|
|
411
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
412
|
-
_a.sent();
|
|
413
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_mine", [])];
|
|
414
|
-
case 5:
|
|
415
|
-
_a.sent();
|
|
416
|
-
return [4 /*yield*/, seaport.fulfillOrder({
|
|
417
|
-
order: order,
|
|
418
|
-
accountAddress: fulfiller.address,
|
|
419
|
-
})];
|
|
420
|
-
case 6:
|
|
421
|
-
actions = (_a.sent()).actions;
|
|
422
|
-
(0, chai_1.expect)(actions.length).to.eq(1);
|
|
423
|
-
action = actions[0];
|
|
424
|
-
(0, chai_1.expect)(action).to.deep.equal({
|
|
425
|
-
type: "exchange",
|
|
426
|
-
transactionMethods: action.transactionMethods,
|
|
427
|
-
});
|
|
428
|
-
return [4 /*yield*/, action.transactionMethods.transact()];
|
|
429
|
-
case 7:
|
|
430
|
-
transaction = _a.sent();
|
|
431
|
-
return [4 /*yield*/, transaction.wait()];
|
|
432
|
-
case 8:
|
|
433
|
-
receipt = _a.sent();
|
|
434
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock(receipt.blockNumber)];
|
|
435
|
-
case 9: return [4 /*yield*/, (_a.sent()).timestamp];
|
|
436
|
-
case 10:
|
|
437
|
-
currentBlockTimestamp = _a.sent();
|
|
438
|
-
return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
|
|
439
|
-
ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
|
|
440
|
-
order: order,
|
|
441
|
-
fulfillerAddress: fulfiller.address,
|
|
442
|
-
multicallProvider: multicallProvider,
|
|
443
|
-
fulfillReceipt: receipt,
|
|
444
|
-
timeBasedItemParams: {
|
|
445
|
-
startTime: startTime,
|
|
446
|
-
endTime: endTime,
|
|
447
|
-
currentBlockTimestamp: currentBlockTimestamp,
|
|
448
|
-
ascendingAmountTimestampBuffer: 0,
|
|
449
|
-
},
|
|
450
|
-
})];
|
|
451
|
-
case 11:
|
|
452
|
-
_a.sent();
|
|
453
|
-
(0, chai_1.expect)(fulfillStandardOrderSpy).calledOnce;
|
|
454
|
-
return [2 /*return*/];
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
}); });
|
|
458
|
-
it("ERC721 <=> ERC20", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
459
|
-
var seaport, testErc20, executeAllActions, order, nextBlockTimestamp, ownerToTokenToIdentifierBalances, actions, approvalAction, _a, fulfillAction, transaction, receipt, currentBlockTimestamp;
|
|
460
|
-
return __generator(this, function (_b) {
|
|
461
|
-
switch (_b.label) {
|
|
462
|
-
case 0:
|
|
463
|
-
seaport = fixture.seaport, testErc20 = fixture.testErc20;
|
|
464
|
-
// Use ERC20 instead of eth
|
|
465
|
-
standardCreateOrderInput = __assign(__assign({}, standardCreateOrderInput), { consideration: standardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
|
|
466
|
-
return [4 /*yield*/, testErc20.mint(fulfiller.address, ethers_1.BigNumber.from(standardCreateOrderInput.consideration[0].amount))];
|
|
467
|
-
case 1:
|
|
468
|
-
_b.sent();
|
|
469
|
-
return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
|
|
470
|
-
case 2:
|
|
471
|
-
executeAllActions = (_b.sent()).executeAllActions;
|
|
472
|
-
return [4 /*yield*/, executeAllActions()];
|
|
473
|
-
case 3:
|
|
474
|
-
order = _b.sent();
|
|
475
|
-
(0, chai_1.expect)(order.parameters.orderType).eq(constants_1.OrderType.FULL_OPEN);
|
|
476
|
-
nextBlockTimestamp = ethers_1.BigNumber.from(startTime)
|
|
477
|
-
.add(endTime)
|
|
478
|
-
.div(2)
|
|
479
|
-
.toNumber();
|
|
480
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
481
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_setNextBlockTimestamp", [
|
|
482
|
-
nextBlockTimestamp,
|
|
483
|
-
])];
|
|
484
|
-
case 4:
|
|
485
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
486
|
-
_b.sent();
|
|
487
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_mine", [])];
|
|
488
|
-
case 5:
|
|
489
|
-
_b.sent();
|
|
490
|
-
return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
|
|
491
|
-
case 6:
|
|
492
|
-
ownerToTokenToIdentifierBalances = _b.sent();
|
|
493
|
-
return [4 /*yield*/, seaport.fulfillOrder({
|
|
494
|
-
order: order,
|
|
495
|
-
accountAddress: fulfiller.address,
|
|
496
|
-
})];
|
|
497
|
-
case 7:
|
|
498
|
-
actions = (_b.sent()).actions;
|
|
499
|
-
(0, chai_1.expect)(actions.length).to.eq(2);
|
|
500
|
-
approvalAction = actions[0];
|
|
501
|
-
(0, chai_1.expect)(approvalAction).to.deep.equal({
|
|
502
|
-
type: "approval",
|
|
503
|
-
token: testErc20.address,
|
|
504
|
-
identifierOrCriteria: "0",
|
|
505
|
-
itemType: constants_1.ItemType.ERC20,
|
|
506
|
-
transactionMethods: approvalAction.transactionMethods,
|
|
507
|
-
operator: seaport.contract.address,
|
|
508
|
-
});
|
|
509
|
-
return [4 /*yield*/, approvalAction.transactionMethods.transact()];
|
|
510
|
-
case 8:
|
|
511
|
-
_b.sent();
|
|
512
|
-
_a = chai_1.expect;
|
|
513
|
-
return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
|
|
514
|
-
case 9:
|
|
515
|
-
_a.apply(void 0, [_b.sent()]).to.equal(constants_1.MAX_INT);
|
|
516
|
-
fulfillAction = actions[1];
|
|
517
|
-
(0, chai_1.expect)(fulfillAction).to.be.deep.equal({
|
|
518
|
-
type: "exchange",
|
|
519
|
-
transactionMethods: fulfillAction.transactionMethods,
|
|
520
|
-
});
|
|
521
|
-
return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
|
|
522
|
-
case 10:
|
|
523
|
-
transaction = _b.sent();
|
|
524
|
-
return [4 /*yield*/, transaction.wait()];
|
|
525
|
-
case 11:
|
|
526
|
-
receipt = _b.sent();
|
|
527
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock(receipt.blockNumber)];
|
|
528
|
-
case 12: return [4 /*yield*/, (_b.sent()).timestamp];
|
|
529
|
-
case 13:
|
|
530
|
-
currentBlockTimestamp = _b.sent();
|
|
531
|
-
return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
|
|
532
|
-
ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
|
|
533
|
-
order: order,
|
|
534
|
-
fulfillerAddress: fulfiller.address,
|
|
535
|
-
multicallProvider: multicallProvider,
|
|
536
|
-
fulfillReceipt: receipt,
|
|
537
|
-
timeBasedItemParams: {
|
|
538
|
-
startTime: startTime,
|
|
539
|
-
endTime: endTime,
|
|
540
|
-
currentBlockTimestamp: currentBlockTimestamp,
|
|
541
|
-
ascendingAmountTimestampBuffer: 0,
|
|
542
|
-
},
|
|
543
|
-
})];
|
|
544
|
-
case 14:
|
|
545
|
-
_b.sent();
|
|
546
|
-
(0, chai_1.expect)(fulfillStandardOrderSpy).calledOnce;
|
|
547
|
-
return [2 /*return*/];
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
}); });
|
|
551
|
-
});
|
|
552
|
-
return [2 /*return*/];
|
|
553
|
-
});
|
|
554
|
-
}); });
|
|
555
|
-
describe("Multiple ERC1155s are to be transferred", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
556
|
-
return __generator(this, function (_a) {
|
|
557
|
-
describe("Ascending dutch auction", function () {
|
|
558
|
-
beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
559
|
-
var testErc1155;
|
|
560
|
-
return __generator(this, function (_a) {
|
|
561
|
-
switch (_a.label) {
|
|
562
|
-
case 0:
|
|
563
|
-
testErc1155 = fixture.testErc1155;
|
|
564
|
-
// Mint 5 ERC1155s to offerer
|
|
565
|
-
return [4 /*yield*/, testErc1155.mint(offerer.address, nftId, erc1155Amount)];
|
|
566
|
-
case 1:
|
|
567
|
-
// Mint 5 ERC1155s to offerer
|
|
568
|
-
_a.sent();
|
|
569
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock("latest")];
|
|
570
|
-
case 2: return [4 /*yield*/, (_a.sent()).timestamp.toString()];
|
|
571
|
-
case 3:
|
|
572
|
-
startTime = _a.sent();
|
|
573
|
-
// Ends one week from the start date
|
|
574
|
-
endTime = ethers_1.BigNumber.from(startTime).add(SECONDS_IN_WEEK).toString();
|
|
575
|
-
standardCreateOrderInput = {
|
|
576
|
-
startTime: startTime,
|
|
577
|
-
endTime: endTime,
|
|
578
|
-
salt: (0, order_1.generateRandomSalt)(),
|
|
579
|
-
offer: [
|
|
580
|
-
{
|
|
581
|
-
itemType: constants_1.ItemType.ERC1155,
|
|
582
|
-
token: testErc1155.address,
|
|
583
|
-
amount: "1",
|
|
584
|
-
endAmount: "5",
|
|
585
|
-
identifier: nftId,
|
|
586
|
-
},
|
|
587
|
-
],
|
|
588
|
-
consideration: [
|
|
589
|
-
{
|
|
590
|
-
amount: (0, utils_1.parseEther)("10").toString(),
|
|
591
|
-
endAmount: (0, utils_1.parseEther)("20").toString(),
|
|
592
|
-
recipient: offerer.address,
|
|
593
|
-
},
|
|
594
|
-
],
|
|
595
|
-
// 2.5% fee
|
|
596
|
-
fees: [{ recipient: zone.address, basisPoints: 250 }],
|
|
597
|
-
};
|
|
598
|
-
return [2 /*return*/];
|
|
599
|
-
}
|
|
600
|
-
});
|
|
601
|
-
}); });
|
|
602
|
-
it("ERC1155 <=> ETH", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
603
|
-
var seaport, testErc1155, executeAllActions, order, ownerToTokenToIdentifierBalances, nextBlockTimestamp, actions, action, transaction, receipt, currentBlockTimestamp, _a, offererErc1155Balance, fulfillerErc1155Balance;
|
|
604
|
-
return __generator(this, function (_b) {
|
|
605
|
-
switch (_b.label) {
|
|
606
|
-
case 0:
|
|
607
|
-
seaport = fixture.seaport, testErc1155 = fixture.testErc1155;
|
|
608
|
-
return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
|
|
609
|
-
case 1:
|
|
610
|
-
executeAllActions = (_b.sent()).executeAllActions;
|
|
611
|
-
return [4 /*yield*/, executeAllActions()];
|
|
612
|
-
case 2:
|
|
613
|
-
order = _b.sent();
|
|
614
|
-
(0, chai_1.expect)(order.parameters.orderType).eq(constants_1.OrderType.FULL_OPEN);
|
|
615
|
-
return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
|
|
616
|
-
case 3:
|
|
617
|
-
ownerToTokenToIdentifierBalances = _b.sent();
|
|
618
|
-
nextBlockTimestamp = ethers_1.BigNumber.from(startTime)
|
|
619
|
-
.add(endTime)
|
|
620
|
-
.div(2)
|
|
621
|
-
.toNumber();
|
|
622
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
623
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_setNextBlockTimestamp", [
|
|
624
|
-
nextBlockTimestamp,
|
|
625
|
-
])];
|
|
626
|
-
case 4:
|
|
627
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
628
|
-
_b.sent();
|
|
629
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_mine", [])];
|
|
630
|
-
case 5:
|
|
631
|
-
_b.sent();
|
|
632
|
-
return [4 /*yield*/, seaport.fulfillOrder({
|
|
633
|
-
order: order,
|
|
634
|
-
accountAddress: fulfiller.address,
|
|
635
|
-
})];
|
|
636
|
-
case 6:
|
|
637
|
-
actions = (_b.sent()).actions;
|
|
638
|
-
(0, chai_1.expect)(actions.length).to.eq(1);
|
|
639
|
-
action = actions[0];
|
|
640
|
-
(0, chai_1.expect)(action).to.deep.equal({
|
|
641
|
-
type: "exchange",
|
|
642
|
-
transactionMethods: action.transactionMethods,
|
|
643
|
-
});
|
|
644
|
-
return [4 /*yield*/, action.transactionMethods.transact()];
|
|
645
|
-
case 7:
|
|
646
|
-
transaction = _b.sent();
|
|
647
|
-
return [4 /*yield*/, transaction.wait()];
|
|
648
|
-
case 8:
|
|
649
|
-
receipt = _b.sent();
|
|
650
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock(receipt.blockNumber)];
|
|
651
|
-
case 9: return [4 /*yield*/, (_b.sent()).timestamp];
|
|
652
|
-
case 10:
|
|
653
|
-
currentBlockTimestamp = _b.sent();
|
|
654
|
-
return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
|
|
655
|
-
ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
|
|
656
|
-
order: order,
|
|
657
|
-
fulfillerAddress: fulfiller.address,
|
|
658
|
-
multicallProvider: multicallProvider,
|
|
659
|
-
fulfillReceipt: receipt,
|
|
660
|
-
timeBasedItemParams: {
|
|
661
|
-
startTime: startTime,
|
|
662
|
-
endTime: endTime,
|
|
663
|
-
currentBlockTimestamp: currentBlockTimestamp,
|
|
664
|
-
ascendingAmountTimestampBuffer: 0,
|
|
665
|
-
},
|
|
666
|
-
})];
|
|
667
|
-
case 11:
|
|
668
|
-
_b.sent();
|
|
669
|
-
return [4 /*yield*/, Promise.all([
|
|
670
|
-
testErc1155.balanceOf(offerer.address, nftId),
|
|
671
|
-
testErc1155.balanceOf(fulfiller.address, nftId),
|
|
672
|
-
])];
|
|
673
|
-
case 12:
|
|
674
|
-
_a = __read.apply(void 0, [_b.sent(), 2]), offererErc1155Balance = _a[0], fulfillerErc1155Balance = _a[1];
|
|
675
|
-
(0, chai_1.expect)(offererErc1155Balance).eq(ethers_1.BigNumber.from(2));
|
|
676
|
-
(0, chai_1.expect)(fulfillerErc1155Balance).eq(ethers_1.BigNumber.from(3));
|
|
677
|
-
(0, chai_1.expect)(fulfillStandardOrderSpy).calledOnce;
|
|
678
|
-
return [2 /*return*/];
|
|
679
|
-
}
|
|
680
|
-
});
|
|
681
|
-
}); });
|
|
682
|
-
it("ERC1155 <=> ERC20", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
683
|
-
var seaport, testErc20, testErc1155, executeAllActions, order, nextBlockTimestamp, ownerToTokenToIdentifierBalances, actions, approvalAction, _a, fulfillAction, transaction, receipt, currentBlockTimestamp, _b, offererErc1155Balance, fulfillerErc1155Balance;
|
|
684
|
-
return __generator(this, function (_c) {
|
|
685
|
-
switch (_c.label) {
|
|
686
|
-
case 0:
|
|
687
|
-
seaport = fixture.seaport, testErc20 = fixture.testErc20, testErc1155 = fixture.testErc1155;
|
|
688
|
-
// Use ERC20 instead of eth
|
|
689
|
-
standardCreateOrderInput = __assign(__assign({}, standardCreateOrderInput), { consideration: standardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
|
|
690
|
-
return [4 /*yield*/, testErc20.mint(fulfiller.address, ethers_1.BigNumber.from(standardCreateOrderInput.consideration[0]
|
|
691
|
-
.endAmount))];
|
|
692
|
-
case 1:
|
|
693
|
-
_c.sent();
|
|
694
|
-
return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
|
|
695
|
-
case 2:
|
|
696
|
-
executeAllActions = (_c.sent()).executeAllActions;
|
|
697
|
-
return [4 /*yield*/, executeAllActions()];
|
|
698
|
-
case 3:
|
|
699
|
-
order = _c.sent();
|
|
700
|
-
(0, chai_1.expect)(order.parameters.orderType).eq(constants_1.OrderType.FULL_OPEN);
|
|
701
|
-
nextBlockTimestamp = ethers_1.BigNumber.from(startTime)
|
|
702
|
-
.add(endTime)
|
|
703
|
-
.div(2)
|
|
704
|
-
.toNumber();
|
|
705
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
706
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_setNextBlockTimestamp", [
|
|
707
|
-
nextBlockTimestamp,
|
|
708
|
-
])];
|
|
709
|
-
case 4:
|
|
710
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
711
|
-
_c.sent();
|
|
712
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_mine", [])];
|
|
713
|
-
case 5:
|
|
714
|
-
_c.sent();
|
|
715
|
-
return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
|
|
716
|
-
case 6:
|
|
717
|
-
ownerToTokenToIdentifierBalances = _c.sent();
|
|
718
|
-
return [4 /*yield*/, seaport.fulfillOrder({
|
|
719
|
-
order: order,
|
|
720
|
-
accountAddress: fulfiller.address,
|
|
721
|
-
})];
|
|
722
|
-
case 7:
|
|
723
|
-
actions = (_c.sent()).actions;
|
|
724
|
-
(0, chai_1.expect)(actions.length).to.eq(2);
|
|
725
|
-
approvalAction = actions[0];
|
|
726
|
-
(0, chai_1.expect)(approvalAction).to.deep.equal({
|
|
727
|
-
type: "approval",
|
|
728
|
-
token: testErc20.address,
|
|
729
|
-
identifierOrCriteria: "0",
|
|
730
|
-
itemType: constants_1.ItemType.ERC20,
|
|
731
|
-
transactionMethods: approvalAction.transactionMethods,
|
|
732
|
-
operator: seaport.contract.address,
|
|
733
|
-
});
|
|
734
|
-
return [4 /*yield*/, approvalAction.transactionMethods.transact()];
|
|
735
|
-
case 8:
|
|
736
|
-
_c.sent();
|
|
737
|
-
_a = chai_1.expect;
|
|
738
|
-
return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
|
|
739
|
-
case 9:
|
|
740
|
-
_a.apply(void 0, [_c.sent()]).to.equal(constants_1.MAX_INT);
|
|
741
|
-
fulfillAction = actions[1];
|
|
742
|
-
(0, chai_1.expect)(fulfillAction).to.be.deep.equal({
|
|
743
|
-
type: "exchange",
|
|
744
|
-
transactionMethods: fulfillAction.transactionMethods,
|
|
745
|
-
});
|
|
746
|
-
return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
|
|
747
|
-
case 10:
|
|
748
|
-
transaction = _c.sent();
|
|
749
|
-
return [4 /*yield*/, transaction.wait()];
|
|
750
|
-
case 11:
|
|
751
|
-
receipt = _c.sent();
|
|
752
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock(receipt.blockNumber)];
|
|
753
|
-
case 12: return [4 /*yield*/, (_c.sent()).timestamp];
|
|
754
|
-
case 13:
|
|
755
|
-
currentBlockTimestamp = _c.sent();
|
|
756
|
-
return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
|
|
757
|
-
ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
|
|
758
|
-
order: order,
|
|
759
|
-
fulfillerAddress: fulfiller.address,
|
|
760
|
-
multicallProvider: multicallProvider,
|
|
761
|
-
fulfillReceipt: receipt,
|
|
762
|
-
timeBasedItemParams: {
|
|
763
|
-
startTime: startTime,
|
|
764
|
-
endTime: endTime,
|
|
765
|
-
currentBlockTimestamp: currentBlockTimestamp,
|
|
766
|
-
ascendingAmountTimestampBuffer: 0,
|
|
767
|
-
},
|
|
768
|
-
})];
|
|
769
|
-
case 14:
|
|
770
|
-
_c.sent();
|
|
771
|
-
return [4 /*yield*/, Promise.all([
|
|
772
|
-
testErc1155.balanceOf(offerer.address, nftId),
|
|
773
|
-
testErc1155.balanceOf(fulfiller.address, nftId),
|
|
774
|
-
])];
|
|
775
|
-
case 15:
|
|
776
|
-
_b = __read.apply(void 0, [_c.sent(), 2]), offererErc1155Balance = _b[0], fulfillerErc1155Balance = _b[1];
|
|
777
|
-
(0, chai_1.expect)(offererErc1155Balance).eq(ethers_1.BigNumber.from(2));
|
|
778
|
-
(0, chai_1.expect)(fulfillerErc1155Balance).eq(ethers_1.BigNumber.from(3));
|
|
779
|
-
(0, chai_1.expect)(fulfillStandardOrderSpy).calledOnce;
|
|
780
|
-
return [2 /*return*/];
|
|
781
|
-
}
|
|
782
|
-
});
|
|
783
|
-
}); });
|
|
784
|
-
});
|
|
785
|
-
describe("Descending dutch auction", function () {
|
|
786
|
-
beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
787
|
-
var testErc1155;
|
|
788
|
-
return __generator(this, function (_a) {
|
|
789
|
-
switch (_a.label) {
|
|
790
|
-
case 0:
|
|
791
|
-
testErc1155 = fixture.testErc1155;
|
|
792
|
-
// Mint 5 ERC1155s to offerer
|
|
793
|
-
return [4 /*yield*/, testErc1155.mint(offerer.address, nftId, erc1155Amount)];
|
|
794
|
-
case 1:
|
|
795
|
-
// Mint 5 ERC1155s to offerer
|
|
796
|
-
_a.sent();
|
|
797
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock("latest")];
|
|
798
|
-
case 2: return [4 /*yield*/, (_a.sent()).timestamp.toString()];
|
|
799
|
-
case 3:
|
|
800
|
-
startTime = _a.sent();
|
|
801
|
-
// Ends one week from the start date
|
|
802
|
-
endTime = ethers_1.BigNumber.from(startTime).add(SECONDS_IN_WEEK).toString();
|
|
803
|
-
standardCreateOrderInput = {
|
|
804
|
-
startTime: startTime,
|
|
805
|
-
endTime: endTime,
|
|
806
|
-
salt: (0, order_1.generateRandomSalt)(),
|
|
807
|
-
offer: [
|
|
808
|
-
{
|
|
809
|
-
itemType: constants_1.ItemType.ERC1155,
|
|
810
|
-
token: testErc1155.address,
|
|
811
|
-
amount: "5",
|
|
812
|
-
endAmount: "1",
|
|
813
|
-
identifier: nftId,
|
|
814
|
-
},
|
|
815
|
-
],
|
|
816
|
-
consideration: [
|
|
817
|
-
{
|
|
818
|
-
amount: (0, utils_1.parseEther)("20").toString(),
|
|
819
|
-
endAmount: (0, utils_1.parseEther)("10").toString(),
|
|
820
|
-
recipient: offerer.address,
|
|
821
|
-
},
|
|
822
|
-
],
|
|
823
|
-
// 2.5% fee
|
|
824
|
-
fees: [{ recipient: zone.address, basisPoints: 250 }],
|
|
825
|
-
};
|
|
826
|
-
return [2 /*return*/];
|
|
827
|
-
}
|
|
828
|
-
});
|
|
829
|
-
}); });
|
|
830
|
-
it("ERC1155 <=> ETH", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
831
|
-
var seaport, testErc1155, executeAllActions, order, ownerToTokenToIdentifierBalances, nextBlockTimestamp, actions, action, transaction, receipt, currentBlockTimestamp, _a, offererErc1155Balance, fulfillerErc1155Balance;
|
|
832
|
-
return __generator(this, function (_b) {
|
|
833
|
-
switch (_b.label) {
|
|
834
|
-
case 0:
|
|
835
|
-
seaport = fixture.seaport, testErc1155 = fixture.testErc1155;
|
|
836
|
-
return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
|
|
837
|
-
case 1:
|
|
838
|
-
executeAllActions = (_b.sent()).executeAllActions;
|
|
839
|
-
return [4 /*yield*/, executeAllActions()];
|
|
840
|
-
case 2:
|
|
841
|
-
order = _b.sent();
|
|
842
|
-
(0, chai_1.expect)(order.parameters.orderType).eq(constants_1.OrderType.FULL_OPEN);
|
|
843
|
-
return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
|
|
844
|
-
case 3:
|
|
845
|
-
ownerToTokenToIdentifierBalances = _b.sent();
|
|
846
|
-
nextBlockTimestamp = ethers_1.BigNumber.from(startTime)
|
|
847
|
-
.add(endTime)
|
|
848
|
-
.div(2)
|
|
849
|
-
.toNumber();
|
|
850
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
851
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_setNextBlockTimestamp", [
|
|
852
|
-
nextBlockTimestamp,
|
|
853
|
-
])];
|
|
854
|
-
case 4:
|
|
855
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
856
|
-
_b.sent();
|
|
857
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_mine", [])];
|
|
858
|
-
case 5:
|
|
859
|
-
_b.sent();
|
|
860
|
-
return [4 /*yield*/, seaport.fulfillOrder({
|
|
861
|
-
order: order,
|
|
862
|
-
accountAddress: fulfiller.address,
|
|
863
|
-
})];
|
|
864
|
-
case 6:
|
|
865
|
-
actions = (_b.sent()).actions;
|
|
866
|
-
(0, chai_1.expect)(actions.length).to.eq(1);
|
|
867
|
-
action = actions[0];
|
|
868
|
-
(0, chai_1.expect)(action).to.deep.equal({
|
|
869
|
-
type: "exchange",
|
|
870
|
-
transactionMethods: action.transactionMethods,
|
|
871
|
-
});
|
|
872
|
-
return [4 /*yield*/, action.transactionMethods.transact()];
|
|
873
|
-
case 7:
|
|
874
|
-
transaction = _b.sent();
|
|
875
|
-
return [4 /*yield*/, transaction.wait()];
|
|
876
|
-
case 8:
|
|
877
|
-
receipt = _b.sent();
|
|
878
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock(receipt.blockNumber)];
|
|
879
|
-
case 9: return [4 /*yield*/, (_b.sent()).timestamp];
|
|
880
|
-
case 10:
|
|
881
|
-
currentBlockTimestamp = _b.sent();
|
|
882
|
-
return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
|
|
883
|
-
ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
|
|
884
|
-
order: order,
|
|
885
|
-
fulfillerAddress: fulfiller.address,
|
|
886
|
-
multicallProvider: multicallProvider,
|
|
887
|
-
fulfillReceipt: receipt,
|
|
888
|
-
timeBasedItemParams: {
|
|
889
|
-
startTime: startTime,
|
|
890
|
-
endTime: endTime,
|
|
891
|
-
currentBlockTimestamp: currentBlockTimestamp,
|
|
892
|
-
ascendingAmountTimestampBuffer: 0,
|
|
893
|
-
},
|
|
894
|
-
})];
|
|
895
|
-
case 11:
|
|
896
|
-
_b.sent();
|
|
897
|
-
return [4 /*yield*/, Promise.all([
|
|
898
|
-
testErc1155.balanceOf(offerer.address, nftId),
|
|
899
|
-
testErc1155.balanceOf(fulfiller.address, nftId),
|
|
900
|
-
])];
|
|
901
|
-
case 12:
|
|
902
|
-
_a = __read.apply(void 0, [_b.sent(), 2]), offererErc1155Balance = _a[0], fulfillerErc1155Balance = _a[1];
|
|
903
|
-
(0, chai_1.expect)(offererErc1155Balance).eq(ethers_1.BigNumber.from(3));
|
|
904
|
-
(0, chai_1.expect)(fulfillerErc1155Balance).eq(ethers_1.BigNumber.from(2));
|
|
905
|
-
(0, chai_1.expect)(fulfillStandardOrderSpy).calledOnce;
|
|
906
|
-
return [2 /*return*/];
|
|
907
|
-
}
|
|
908
|
-
});
|
|
909
|
-
}); });
|
|
910
|
-
it("ERC1155 <=> ERC20", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
911
|
-
var seaport, testErc20, testErc1155, executeAllActions, order, nextBlockTimestamp, ownerToTokenToIdentifierBalances, actions, approvalAction, _a, fulfillAction, transaction, receipt, currentBlockTimestamp, _b, offererErc1155Balance, fulfillerErc1155Balance;
|
|
912
|
-
return __generator(this, function (_c) {
|
|
913
|
-
switch (_c.label) {
|
|
914
|
-
case 0:
|
|
915
|
-
seaport = fixture.seaport, testErc20 = fixture.testErc20, testErc1155 = fixture.testErc1155;
|
|
916
|
-
// Use ERC20 instead of eth
|
|
917
|
-
standardCreateOrderInput = __assign(__assign({}, standardCreateOrderInput), { consideration: standardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
|
|
918
|
-
return [4 /*yield*/, testErc20.mint(fulfiller.address, ethers_1.BigNumber.from(standardCreateOrderInput.consideration[0].amount))];
|
|
919
|
-
case 1:
|
|
920
|
-
_c.sent();
|
|
921
|
-
return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
|
|
922
|
-
case 2:
|
|
923
|
-
executeAllActions = (_c.sent()).executeAllActions;
|
|
924
|
-
return [4 /*yield*/, executeAllActions()];
|
|
925
|
-
case 3:
|
|
926
|
-
order = _c.sent();
|
|
927
|
-
(0, chai_1.expect)(order.parameters.orderType).eq(constants_1.OrderType.FULL_OPEN);
|
|
928
|
-
nextBlockTimestamp = ethers_1.BigNumber.from(startTime)
|
|
929
|
-
.add(endTime)
|
|
930
|
-
.div(2)
|
|
931
|
-
.toNumber();
|
|
932
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
933
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_setNextBlockTimestamp", [
|
|
934
|
-
nextBlockTimestamp,
|
|
935
|
-
])];
|
|
936
|
-
case 4:
|
|
937
|
-
// Set the next block to be the halfway point between startTime and endTime
|
|
938
|
-
_c.sent();
|
|
939
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.send("evm_mine", [])];
|
|
940
|
-
case 5:
|
|
941
|
-
_c.sent();
|
|
942
|
-
return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
|
|
943
|
-
case 6:
|
|
944
|
-
ownerToTokenToIdentifierBalances = _c.sent();
|
|
945
|
-
return [4 /*yield*/, seaport.fulfillOrder({
|
|
946
|
-
order: order,
|
|
947
|
-
accountAddress: fulfiller.address,
|
|
948
|
-
})];
|
|
949
|
-
case 7:
|
|
950
|
-
actions = (_c.sent()).actions;
|
|
951
|
-
(0, chai_1.expect)(actions.length).to.eq(2);
|
|
952
|
-
approvalAction = actions[0];
|
|
953
|
-
(0, chai_1.expect)(approvalAction).to.deep.equal({
|
|
954
|
-
type: "approval",
|
|
955
|
-
token: testErc20.address,
|
|
956
|
-
identifierOrCriteria: "0",
|
|
957
|
-
itemType: constants_1.ItemType.ERC20,
|
|
958
|
-
transactionMethods: approvalAction.transactionMethods,
|
|
959
|
-
operator: seaport.contract.address,
|
|
960
|
-
});
|
|
961
|
-
return [4 /*yield*/, approvalAction.transactionMethods.transact()];
|
|
962
|
-
case 8:
|
|
963
|
-
_c.sent();
|
|
964
|
-
_a = chai_1.expect;
|
|
965
|
-
return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
|
|
966
|
-
case 9:
|
|
967
|
-
_a.apply(void 0, [_c.sent()]).to.equal(constants_1.MAX_INT);
|
|
968
|
-
fulfillAction = actions[1];
|
|
969
|
-
(0, chai_1.expect)(fulfillAction).to.be.deep.equal({
|
|
970
|
-
type: "exchange",
|
|
971
|
-
transactionMethods: fulfillAction.transactionMethods,
|
|
972
|
-
});
|
|
973
|
-
return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
|
|
974
|
-
case 10:
|
|
975
|
-
transaction = _c.sent();
|
|
976
|
-
return [4 /*yield*/, transaction.wait()];
|
|
977
|
-
case 11:
|
|
978
|
-
receipt = _c.sent();
|
|
979
|
-
return [4 /*yield*/, hardhat_1.ethers.provider.getBlock(receipt.blockNumber)];
|
|
980
|
-
case 12: return [4 /*yield*/, (_c.sent()).timestamp];
|
|
981
|
-
case 13:
|
|
982
|
-
currentBlockTimestamp = _c.sent();
|
|
983
|
-
return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
|
|
984
|
-
ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
|
|
985
|
-
order: order,
|
|
986
|
-
fulfillerAddress: fulfiller.address,
|
|
987
|
-
multicallProvider: multicallProvider,
|
|
988
|
-
fulfillReceipt: receipt,
|
|
989
|
-
timeBasedItemParams: {
|
|
990
|
-
startTime: startTime,
|
|
991
|
-
endTime: endTime,
|
|
992
|
-
currentBlockTimestamp: currentBlockTimestamp,
|
|
993
|
-
ascendingAmountTimestampBuffer: 0,
|
|
994
|
-
},
|
|
995
|
-
})];
|
|
996
|
-
case 14:
|
|
997
|
-
_c.sent();
|
|
998
|
-
return [4 /*yield*/, Promise.all([
|
|
999
|
-
testErc1155.balanceOf(offerer.address, nftId),
|
|
1000
|
-
testErc1155.balanceOf(fulfiller.address, nftId),
|
|
1001
|
-
])];
|
|
1002
|
-
case 15:
|
|
1003
|
-
_b = __read.apply(void 0, [_c.sent(), 2]), offererErc1155Balance = _b[0], fulfillerErc1155Balance = _b[1];
|
|
1004
|
-
(0, chai_1.expect)(offererErc1155Balance).eq(ethers_1.BigNumber.from(3));
|
|
1005
|
-
(0, chai_1.expect)(fulfillerErc1155Balance).eq(ethers_1.BigNumber.from(2));
|
|
1006
|
-
(0, chai_1.expect)(fulfillStandardOrderSpy).calledOnce;
|
|
1007
|
-
return [2 /*return*/];
|
|
1008
|
-
}
|
|
1009
|
-
});
|
|
1010
|
-
}); });
|
|
1011
|
-
});
|
|
1012
|
-
return [2 /*return*/];
|
|
1013
|
-
});
|
|
1014
|
-
}); });
|
|
1015
|
-
});
|
|
1016
|
-
//# sourceMappingURL=ascending-descending-amounts.spec.js.map
|