Skip to content

Commit 70debe5

Browse files
[GMS-1362] Remove setOperatorAllowlistRegistry from preset nft contracts (#162)
* wip * pass tests
1 parent 1cb96e9 commit 70debe5

File tree

6 files changed

+0
-109
lines changed

6 files changed

+0
-109
lines changed

clients/erc721-mint-by-id.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -542,19 +542,4 @@ export class ERC721MintByIDClient {
542542
...overrides,
543543
});
544544
}
545-
546-
/**
547-
* @returns a populated transaction for the setOperatorAllowlistRegistry contract function
548-
*/
549-
public async populateSetOperatorAllowlistRegistry(
550-
_operatorAllowlist: PromiseOrValue<string>,
551-
overrides: Overrides & {
552-
from?: PromiseOrValue<string>;
553-
} = {}
554-
): Promise<PopulatedTransaction> {
555-
return await this.contract.populateTransaction.setOperatorAllowlistRegistry(_operatorAllowlist, {
556-
...defaultGasOverrides,
557-
...overrides,
558-
});
559-
}
560545
}

clients/erc721.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -655,19 +655,4 @@ export class ERC721Client {
655655
...overrides,
656656
});
657657
}
658-
659-
/**
660-
* @returns a populated transaction for the setOperatorAllowlistRegistry contract function
661-
*/
662-
public async populateSetOperatorAllowlistRegistry(
663-
_operatorAllowlist: PromiseOrValue<string>,
664-
overrides: Overrides & {
665-
from?: PromiseOrValue<string>;
666-
} = {}
667-
): Promise<PopulatedTransaction> {
668-
return await this.contract.populateTransaction.setOperatorAllowlistRegistry(_operatorAllowlist, {
669-
...defaultGasOverrides,
670-
...overrides,
671-
});
672-
}
673658
}

contracts/allowlist/OperatorAllowlistEnforced.sol

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@ abstract contract OperatorAllowlistEnforced is AccessControlEnumerable, Operator
8787

8888
/// ===== External functions =====
8989

90-
/**
91-
* @notice Allows admin to set the operator allowlist the calling contract will interface with
92-
* @param _operatorAllowlist the address of the Allowlist registry
93-
*/
94-
function setOperatorAllowlistRegistry(address _operatorAllowlist) public onlyRole(DEFAULT_ADMIN_ROLE) {
95-
_setOperatorAllowlistRegistry(_operatorAllowlist);
96-
}
97-
9890
/**
9991
* @notice ERC-165 interface support
10092
* @param interfaceId The interface identifier, which is a 4-byte selector.

test/allowlist/AllowlistERC721TransfersApprovals.test.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,6 @@ describe("Allowlisted ERC721 Transfers", function () {
4545
it("Should have operatorAllowlist set upon deployment", async function () {
4646
expect(await erc721.operatorAllowlist()).to.equal(operatorAllowlist.address);
4747
});
48-
49-
it("Should not allow contracts that do not implement the IOperatorAllowlist to be set", async function () {
50-
// Deploy another contract that implements IERC165, but not IOperatorAllowlist
51-
const factory = await ethers.getContractFactory("ImmutableERC721MintByID");
52-
const erc721Two = await factory.deploy(
53-
owner.address,
54-
"",
55-
"",
56-
"",
57-
"",
58-
operatorAllowlist.address,
59-
owner.address,
60-
0
61-
);
62-
63-
await expect(erc721.connect(owner).setOperatorAllowlistRegistry(erc721Two.address)).to.be.revertedWith(
64-
"AllowlistDoesNotImplementIOperatorAllowlist"
65-
);
66-
});
67-
68-
it("Should not allow a non-admin to access the function to update the registry", async function () {
69-
await expect(
70-
erc721.connect(registrar).setOperatorAllowlistRegistry(operatorAllowlist.address)
71-
).to.be.revertedWith(
72-
"AccessControl: account 0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc is missing role 0x0000000000000000000000000000000000000000000000000000000000000000"
73-
);
74-
});
7548
});
7649

7750
describe("Approvals", function () {
@@ -128,9 +101,6 @@ describe("Allowlisted ERC721 Transfers", function () {
128101
});
129102

130103
describe("Transfers", function () {
131-
beforeEach(async function () {
132-
await erc721.connect(owner).setOperatorAllowlistRegistry(operatorAllowlist.address);
133-
});
134104
it("Should freely allow transfers between EOAs", async function () {
135105
await erc721.connect(owner).grantMinterRole(accs[0].address);
136106
await erc721.connect(owner).grantMinterRole(accs[1].address);
@@ -214,9 +184,6 @@ describe("Allowlisted ERC721 Transfers", function () {
214184
});
215185

216186
describe("Malicious Contracts", function () {
217-
beforeEach(async function () {
218-
await erc721.connect(owner).setOperatorAllowlistRegistry(operatorAllowlist.address);
219-
});
220187
// The EOA disguise attack vector is a where a pre-computed CREATE2 deterministic address is disguised as an EOA.
221188
// By virtue of this, approvals and transfers to this address will pass. We need to catch actions from this address
222189
// once it is deployed.

test/allowlist/HybridApproval.test.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,6 @@ describe("Royalty Checks with Hybrid ERC721", function () {
4343
it("Should have operatorAllowlist set upon deployment", async function () {
4444
expect(await erc721.operatorAllowlist()).to.equal(operatorAllowlist.address);
4545
});
46-
47-
it("Should not allow contracts that do not implement the IOperatorAllowlist to be set", async function () {
48-
// Deploy another contract that implements IERC165, but not IOperatorAllowlist
49-
const factory = await ethers.getContractFactory("ImmutableERC721");
50-
const erc721Two = await factory.deploy(
51-
owner.address,
52-
"",
53-
"",
54-
"",
55-
"",
56-
operatorAllowlist.address,
57-
owner.address,
58-
0
59-
);
60-
61-
await expect(erc721.connect(owner).setOperatorAllowlistRegistry(erc721Two.address)).to.be.revertedWith(
62-
"AllowlistDoesNotImplementIOperatorAllowlist"
63-
);
64-
});
65-
66-
it("Should not allow a non-admin to access the function to update the registry", async function () {
67-
await expect(
68-
erc721.connect(registrar).setOperatorAllowlistRegistry(operatorAllowlist.address)
69-
).to.be.revertedWith(
70-
"AccessControl: account 0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc is missing role 0x0000000000000000000000000000000000000000000000000000000000000000"
71-
);
72-
});
7346
});
7447

7548
describe("Approvals", function () {
@@ -124,9 +97,6 @@ describe("Royalty Checks with Hybrid ERC721", function () {
12497
});
12598

12699
describe("Transfers", function () {
127-
beforeEach(async function () {
128-
await erc721.connect(owner).setOperatorAllowlistRegistry(operatorAllowlist.address);
129-
});
130100
it("Should freely allow transfers between EOAs", async function () {
131101
const first = await erc721.mintBatchByQuantityThreshold();
132102
await erc721.connect(minter).mintByQuantity(accs[0].address, 1);
@@ -214,9 +184,6 @@ describe("Royalty Checks with Hybrid ERC721", function () {
214184
});
215185

216186
describe("Malicious Contracts", function () {
217-
beforeEach(async function () {
218-
await erc721.connect(owner).setOperatorAllowlistRegistry(operatorAllowlist.address);
219-
});
220187
// The EOA disguise attack vector is a where a pre-computed CREATE2 deterministic address is disguised as an EOA.
221188
// By virtue of this, approvals and transfers to this address will pass. We need to catch actions from this address
222189
// once it is deployed.

test/royalty-enforcement/RoyaltyMarketplace.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ describe("Marketplace Royalty Enforcement", function () {
6464
});
6565

6666
describe("Royalties", function () {
67-
it("Should set a valid OperatorAllowlist registry", async function () {
68-
await erc721.connect(owner).setOperatorAllowlistRegistry(operatorAllowlist.address);
69-
expect(await erc721.operatorAllowlist()).to.be.equal(operatorAllowlist.address);
70-
});
71-
7267
it("Should allow a marketplace contract to be Allowlisted", async function () {
7368
await operatorAllowlist.connect(registrar).addAddressToAllowlist([mockMarketplace.address]);
7469
expect(await operatorAllowlist.isAllowlisted(mockMarketplace.address)).to.be.equal(true);

0 commit comments

Comments
 (0)