Skip to content

Commit ba842e9

Browse files
authored
Add Seaport v1.5 (#226)
* add seaport v1.5 (default init still v1.4) * simpilfy test setup since we dont need a separate seaport v1.5 instance
1 parent 57b6b11 commit ba842e9

File tree

14 files changed

+40
-2655
lines changed

14 files changed

+40
-2655
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opensea/seaport-js",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "[Seaport](https://github.com/ProjectOpenSea/seaport) is a new marketplace protocol for safely and efficiently buying and selling NFTs. This is a JavaScript library intended to make interfacing with the contract reasonable and easy.",
55
"license": "MIT",
66
"author": "OpenSea Developers",
@@ -91,8 +91,8 @@
9191
"prettier": "^2.5.1",
9292
"prettier-package-json": "^2.6.3",
9393
"prettier-plugin-solidity": "^1.0.0-beta.13",
94-
"seaport": "ProjectOpenSea/seaport#76e508657888e3ec84039e1da269c822826991ef",
9594
"seaport_v1_4": "ProjectOpenSea/seaport#1.4",
95+
"seaport_v1_5": "ProjectOpenSea/seaport#1.5",
9696
"sinon": "^13.0.1",
9797
"sinon-chai": "^3.7.0",
9898
"solhint": "^3.3.7",

src/__tests__/basic-fulfill.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describeWithFixture(
130130
// Should revert because signature is empty
131131
await expect(
132132
action.transactionMethods.transact()
133-
).to.be.revertedWith("InvalidSigner");
133+
).to.be.revertedWith("InvalidSignature");
134134

135135
await seaport.validate([order], offerer.address).transact();
136136

@@ -296,7 +296,7 @@ describeWithFixture(
296296

297297
await expect(
298298
fulfillAction.transactionMethods.transact()
299-
).to.be.revertedWith("InvalidSigner");
299+
).to.be.revertedWith("InvalidSignature");
300300

301301
await seaport.validate([order], offerer.address).transact();
302302

@@ -505,7 +505,7 @@ describeWithFixture(
505505
// Should revert because signature is empty
506506
await expect(
507507
fulfillAction.transactionMethods.transact()
508-
).to.be.revertedWith("InvalidSigner");
508+
).to.be.revertedWith("InvalidSignature");
509509

510510
await seaport.validate([order], offerer.address).transact();
511511

@@ -670,7 +670,7 @@ describeWithFixture(
670670

671671
await expect(
672672
fulfillAction.transactionMethods.transact()
673-
).to.be.revertedWith("InvalidSigner");
673+
).to.be.revertedWith("InvalidSignature");
674674

675675
await seaport.validate([order], offerer.address).transact();
676676

src/__tests__/cancel.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
22
import { expect } from "chai";
3-
import { BigNumber } from "ethers";
43
import { parseEther } from "ethers/lib/utils";
54
import { ethers } from "hardhat";
65
import { ItemType } from "../constants";
@@ -77,9 +76,11 @@ describeWithFixture("As a user I want to cancel an order", (fixture) => {
7776
await expect(executeAllFulfillActionsOffChainOrder()).to.be.reverted;
7877
await expect(executeAllFulfillActionsOnChainOrder()).to.be.reverted;
7978

80-
expect(await seaport.getCounter(offerer.address)).to.deep.equal(
81-
BigNumber.from(offChainOrder.parameters.counter).add(1)
82-
);
79+
expect(
80+
(await seaport.getCounter(offerer.address)).gt(
81+
offChainOrder.parameters.counter
82+
)
83+
).to.be.true;
8384
});
8485

8586
it("validate then cancel single order", async () => {

src/__tests__/create-bulk-orders.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describeWithFixture(
1313
"As a user I want to create bulk orders with one signature",
1414
(fixture) => {
1515
it("should create the orders after setting needed approvals", async () => {
16-
const { seaportv12Contract, seaportv12, testErc721 } = fixture;
16+
const { seaportContract, seaport, testErc721 } = fixture;
1717

1818
const [offerer, zone, randomSigner] = await ethers.getSigners();
1919

@@ -56,7 +56,7 @@ describeWithFixture(
5656
{ ...order, offer: [{ ...order.offer[0], identifier: nftId3 }] },
5757
];
5858

59-
const { actions } = await seaportv12.createBulkOrders(orders);
59+
const { actions } = await seaport.createBulkOrders(orders);
6060

6161
// Expect only one approval action for the collection of tokens nftId1-nftId3
6262
expect(actions.filter((a) => a.type === "approval")).to.have.lengthOf(1);
@@ -69,7 +69,7 @@ describeWithFixture(
6969
identifierOrCriteria: nftId1,
7070
itemType: ItemType.ERC721,
7171
transactionMethods: approvalAction.transactionMethods,
72-
operator: seaportv12Contract.address,
72+
operator: seaportContract.address,
7373
});
7474

7575
await approvalAction.transactionMethods.transact();
@@ -78,7 +78,7 @@ describeWithFixture(
7878
expect(
7979
await testErc721.isApprovedForAll(
8080
offerer.address,
81-
seaportv12Contract.address
81+
seaportContract.address
8282
)
8383
).to.be.true;
8484

@@ -133,7 +133,7 @@ describeWithFixture(
133133
signature: order.signature,
134134
});
135135

136-
const isValid = await seaportv12Contract
136+
const isValid = await seaportContract
137137
.connect(randomSigner)
138138
.callStatic.validate([
139139
{

src/__tests__/create-order.spec.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { expect } from "chai";
22
import { parseEther } from "ethers/lib/utils";
33
import { ethers } from "hardhat";
4-
import { Seaport } from "../seaport";
54
import { ItemType, MAX_INT, NO_CONDUIT, OrderType } from "../constants";
65
import { ApprovalAction, CreateOrderAction } from "../types";
76
import { generateRandomSalt } from "../utils/order";
@@ -514,15 +513,9 @@ describeWithFixture("As a user I want to create an order", (fixture) => {
514513
});
515514

516515
it("skips balance and approval validation if consideration config is set to skip on order creation", async () => {
517-
const { seaportContract, testErc721 } = fixture;
516+
const { seaport, seaportContract, testErc721 } = fixture;
518517

519-
const seaport = new Seaport(ethers.provider, {
520-
balanceAndApprovalChecksOnOrderCreation: false,
521-
overrides: {
522-
contractAddress: seaportContract.address,
523-
},
524-
seaportVersion: "1.1",
525-
});
518+
(seaport as any).config.balanceAndApprovalChecksOnOrderCreation = false;
526519

527520
const [offerer, zone, randomSigner] = await ethers.getSigners();
528521
const nftId = "1";

src/__tests__/utils/setup.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ chai.use(sinonChai);
1616

1717
type Fixture = {
1818
seaportContract: SeaportContract;
19-
seaportv12Contract: SeaportContract;
2019
seaport: Seaport;
21-
seaportv12: Seaport;
2220
domainRegistry: DomainRegistry;
2321
testErc721: TestERC721;
2422
testErc20: TestERC20;
@@ -34,11 +32,7 @@ export const describeWithFixture = (
3432

3533
beforeEach(async () => {
3634
const SeaportFactory = await ethers.getContractFactory(
37-
"seaport/contracts/Seaport.sol:Seaport"
38-
);
39-
40-
const Seaportv12Factory = await ethers.getContractFactory(
41-
"seaport_v1_4/contracts/Seaport.sol:Seaport"
35+
"seaport_v1_5/contracts/Seaport.sol:Seaport"
4236
);
4337

4438
const ConduitControllerFactory = await ethers.getContractFactory(
@@ -51,10 +45,6 @@ export const describeWithFixture = (
5145
conduitController.address
5246
)) as SeaportContract;
5347

54-
const seaportv12Contract = (await Seaportv12Factory.deploy(
55-
conduitController.address
56-
)) as SeaportContract;
57-
5848
await seaportContract.deployed();
5949

6050
const DomainRegistryFactory = await ethers.getContractFactory(
@@ -68,15 +58,7 @@ export const describeWithFixture = (
6858
contractAddress: seaportContract.address,
6959
domainRegistryAddress: domainRegistry.address,
7060
},
71-
seaportVersion: "1.1",
72-
});
73-
74-
const seaportv12 = new Seaport(ethers.provider, {
75-
overrides: {
76-
contractAddress: seaportv12Contract.address,
77-
domainRegistryAddress: domainRegistry.address,
78-
},
79-
seaportVersion: "1.4",
61+
seaportVersion: "1.5",
8062
});
8163

8264
const TestERC721 = await ethers.getContractFactory("TestERC721");
@@ -94,9 +76,7 @@ export const describeWithFixture = (
9476
// In order for cb to get the correct fixture values we have
9577
// to pass a reference to an object that you we mutate.
9678
fixture.seaportContract = seaportContract;
97-
fixture.seaportv12Contract = seaportv12Contract;
9879
fixture.seaport = seaport;
99-
fixture.seaportv12 = seaportv12;
10080
fixture.domainRegistry = domainRegistry;
10181
fixture.testErc721 = testErc721;
10282
fixture.testErc1155 = testErc1155;

0 commit comments

Comments
 (0)