diff --git a/.gas-snapshot b/.gas-snapshot
deleted file mode 100644
index 3469cf2..0000000
--- a/.gas-snapshot
+++ /dev/null
@@ -1,162 +0,0 @@
-DefaultOperatorFiltererTest:testFilter() (gas: 41235)
-OperatorFilterRegistryTest:testCodeHashOf() (gas: 8478)
-OperatorFilterRegistryTest:testCopyEntriesOf() (gas: 562154)
-OperatorFilterRegistryTest:testCopyEntriesOf_CannotUpdateWhileSubscribed() (gas: 270730)
-OperatorFilterRegistryTest:testCopyEntriesOf_NotRegistered() (gas: 10834)
-OperatorFilterRegistryTest:testCopyEntriesOf_NotRegistered_registrant() (gas: 35705)
-OperatorFilterRegistryTest:testCopyEntriesOf_OnlyAddressOrOwner() (gas: 67577)
-OperatorFilterRegistryTest:testCopyEntriesOf_cannotCopySelf() (gas: 31131)
-OperatorFilterRegistryTest:testFilteredCodeHashAt_subscription() (gas: 199760)
-OperatorFilterRegistryTest:testFilteredCodeHashes_subscription() (gas: 204697)
-OperatorFilterRegistryTest:testFilteredOperatorAt_subscription() (gas: 199132)
-OperatorFilterRegistryTest:testFilteredOperators_subscription() (gas: 204146)
-OperatorFilterRegistryTest:testIsCodeHashFiltered_subscription() (gas: 203085)
-OperatorFilterRegistryTest:testIsCodeHashOfFiltered() (gas: 111402)
-OperatorFilterRegistryTest:testIsCodeHashOfFiltered_subscription() (gas: 207503)
-OperatorFilterRegistryTest:testIsOperatorAllowed() (gas: 188726)
-OperatorFilterRegistryTest:testIsOperatorAllowed_NotRegistered() (gas: 9988)
-OperatorFilterRegistryTest:testIsOperatorAllowed_subscription() (gas: 284810)
-OperatorFilterRegistryTest:testIsOperatorFiltered_subscription() (gas: 204184)
-OperatorFilterRegistryTest:testIsRegistered() (gas: 35586)
-OperatorFilterRegistryTest:testOnlyAddressOrOwner() (gas: 24488)
-OperatorFilterRegistryTest:testRegisterAndCopyEntries() (gas: 337400)
-OperatorFilterRegistryTest:testRegisterAndCopyEntries_AlreadyRegistered() (gas: 33298)
-OperatorFilterRegistryTest:testRegisterAndCopyEntries_CannotCopyFromSelf() (gas: 31534)
-OperatorFilterRegistryTest:testRegisterAndCopyEntries_NotRegistered() (gas: 14558)
-OperatorFilterRegistryTest:testRegisterAndCopyEntries_OnlyAddressOrOwner() (gas: 16140)
-OperatorFilterRegistryTest:testRegisterAndSubscribe() (gas: 135937)
-OperatorFilterRegistryTest:testRegisterAndSubscribe_AlreadyRegistered() (gas: 33219)
-OperatorFilterRegistryTest:testRegisterAndSubscribe_CannotRegisterToSelf() (gas: 9081)
-OperatorFilterRegistryTest:testRegisterAndSubscribe_CannotSubscribeToRegistrantWithSubscription() (gas: 131752)
-OperatorFilterRegistryTest:testRegisterAndSubscribe_NotRegistered() (gas: 14537)
-OperatorFilterRegistryTest:testRegisterAndSubscribe_OnlyAddressOrOwner() (gas: 17628)
-OperatorFilterRegistryTest:testRegister_alreadyRegistered() (gas: 31593)
-OperatorFilterRegistryTest:testRegister_constructor() (gas: 38270)
-OperatorFilterRegistryTest:testRegister_onlyAddressOrOwner() (gas: 16035)
-OperatorFilterRegistryTest:testSubscribe() (gas: 136406)
-OperatorFilterRegistryTest:testSubscribe_AlreadySubscribed() (gas: 128950)
-OperatorFilterRegistryTest:testSubscribe_CannotSubscribeToRegistrantWithSubscription() (gas: 154402)
-OperatorFilterRegistryTest:testSubscribe_CannotSubscribeToSelf() (gas: 31487)
-OperatorFilterRegistryTest:testSubscribe_CannotSubscribeToZeroAddress() (gas: 31485)
-OperatorFilterRegistryTest:testSubscribe_OnlyAddressOrOwner() (gas: 42598)
-OperatorFilterRegistryTest:testSubscribe_SubscriptionNotRegistered() (gas: 35670)
-OperatorFilterRegistryTest:testSubscribe_notRegistered() (gas: 35820)
-OperatorFilterRegistryTest:testSubscribe_removeOldSubscription() (gas: 188416)
-OperatorFilterRegistryTest:testSubscriptionOf_notRegistered() (gas: 9132)
-OperatorFilterRegistryTest:testUnregister() (gas: 107634)
-OperatorFilterRegistryTest:testUnsubscribe() (gas: 106169)
-OperatorFilterRegistryTest:testUnsubscribe_NotRegistered() (gas: 9199)
-OperatorFilterRegistryTest:testUnsubscribe_NotSubscribed() (gas: 31689)
-OperatorFilterRegistryTest:testUnsubscribe_copyExistingEntries() (gas: 360792)
-OperatorFilterRegistryTest:testUnsubscribe_notRegistered() (gas: 9047)
-OperatorFilterRegistryTest:testUnsubscribe_onlyAddressOrOwner() (gas: 137734)
-OperatorFilterRegistryTest:testUpdateCodeHash() (gas: 105160)
-OperatorFilterRegistryTest:testUpdateCodeHash_CannotFilterEOAs() (gas: 31509)
-OperatorFilterRegistryTest:testUpdateCodeHash_CannotUpdateWhileSubscribed() (gas: 127621)
-OperatorFilterRegistryTest:testUpdateCodeHash_CodeHashAlreadyFiltered() (gas: 102221)
-OperatorFilterRegistryTest:testUpdateCodeHash_CodeHashNotFiltered() (gas: 34307)
-OperatorFilterRegistryTest:testUpdateCodeHash_NotRegistered() (gas: 9275)
-OperatorFilterRegistryTest:testUpdateCodeHash_OnlyAddressOrOwner() (gas: 16062)
-OperatorFilterRegistryTest:testUpdateCodeHash_unfilter() (gas: 83437)
-OperatorFilterRegistryTest:testUpdateCodeHashes() (gas: 149999)
-OperatorFilterRegistryTest:testUpdateCodeHashes_CannotFilterEOAs() (gas: 99404)
-OperatorFilterRegistryTest:testUpdateCodeHashes_CannotUpdateWhileSubscribed() (gas: 128538)
-OperatorFilterRegistryTest:testUpdateCodeHashes_CodeHashAlreadyFiltered() (gas: 151240)
-OperatorFilterRegistryTest:testUpdateCodeHashes_CodeHashNotFiltered() (gas: 35306)
-OperatorFilterRegistryTest:testUpdateCodeHashes_OnlyAddressOrOwner() (gas: 16804)
-OperatorFilterRegistryTest:testUpdateCodeHashes_notRegistered() (gas: 10043)
-OperatorFilterRegistryTest:testUpdateCodeHashes_unfilter() (gas: 127162)
-OperatorFilterRegistryTest:testUpdateOperator() (gas: 111558)
-OperatorFilterRegistryTest:testUpdateOperator_AddressAlreadyFiltered() (gas: 107110)
-OperatorFilterRegistryTest:testUpdateOperator_AddressNotFiltered() (gas: 37525)
-OperatorFilterRegistryTest:testUpdateOperator_CannotUpdateWhileSubscribed() (gas: 129249)
-OperatorFilterRegistryTest:testUpdateOperator_OnlyAddressOrOwner() (gas: 17746)
-OperatorFilterRegistryTest:testUpdateOperator_notRegistered() (gas: 10892)
-OperatorFilterRegistryTest:testUpdateOperator_unfilter() (gas: 88638)
-OperatorFilterRegistryTest:testUpdateOperators() (gas: 160186)
-OperatorFilterRegistryTest:testUpdateOperators_AddressAlreadyFiltered() (gas: 159298)
-OperatorFilterRegistryTest:testUpdateOperators_AddressNotFiltered() (gas: 40093)
-OperatorFilterRegistryTest:testUpdateOperators_CannotUpdateWhileSubscribed() (gas: 131638)
-OperatorFilterRegistryTest:testUpdateOperators_OnlyAddressOrOwner() (gas: 18329)
-OperatorFilterRegistryTest:testUpdateOperators_notRegistered() (gas: 13185)
-OperatorFilterRegistryTest:testUpdateOperators_unfilter() (gas: 132844)
-OperatorFiltererTest:testConstructor_copy() (gas: 257763)
-OperatorFiltererTest:testConstructor_subscribe() (gas: 177081)
-OperatorFiltererTest:testConstructory_noSubscribeOrCopy() (gas: 326674)
-OperatorFiltererTest:testFilter() (gas: 41303)
-OperatorFiltererTest:testRegistryNotDeployedDoesNotRevert() (gas: 298447)
-OperatorFiltererTest:testConstructor() (gas: 87006)
-RevokableDefaultOperatorFiltererTest:testFilter() (gas: 44167)
-RevokableDefaultOperatorFiltererTest:testRevoke() (gas: 38568)
-RevokableOperatorFiltererTest:testConstructor_copy() (gas: 445192)
-RevokableOperatorFiltererTest:testConstructor_revertOnZeroAddress() (gas: 43436)
-RevokableOperatorFiltererTest:testConstructor_subscribe() (gas: 364511)
-RevokableOperatorFiltererTest:testConstructory_noSubscribeOrCopy() (gas: 495785)
-RevokableOperatorFiltererTest:testFilter() (gas: 44230)
-RevokableOperatorFiltererTest:testRegistryNotDeployedDoesNotRevert() (gas: 467790)
-RevokableOperatorFiltererTest:testUpdateRegistry() (gas: 17738)
-RevokableOperatorFiltererTest:testUpdateRegistry_onlyOwner() (gas: 12749)
-RevokableOperatorFiltererTest:testZeroAddressBypass() (gas: 38854)
-UpdatableOperatorFiltererTest:testConstructor_copy() (gas: 361762)
-UpdatableOperatorFiltererTest:testConstructor_subscribe() (gas: 281131)
-UpdatableOperatorFiltererTest:testConstructory_noSubscribeOrCopy() (gas: 405697)
-UpdatableOperatorFiltererTest:testFilter() (gas: 43767)
-UpdatableOperatorFiltererTest:testRegistryNotDeployedDoesNotRevert() (gas: 377615)
-UpdatableOperatorFiltererTest:testUpdateRegistry() (gas: 17623)
-UpdatableOperatorFiltererTest:testUpdateRegistry_onlyOwner() (gas: 12749)
-UpdatableOperatorFiltererTest:testZeroAddressBypass() (gas: 27363)
-ExampleERC1155Test:testExcludeApprovals() (gas: 99392)
-ExampleERC1155Test:testExclusionExceptionDoesNotApplyToOperators() (gas: 131242)
-ExampleERC1155Test:testFilter() (gas: 38329)
-ExampleERC1155Test:testOwnersNotExcluded() (gas: 105862)
-ExampleERC1155Test:testOwnersNotExcludedBatch() (gas: 109044)
-ExampleERC721Test:testExcludeApprovals() (gas: 123377)
-ExampleERC721Test:testExclusionExceptionDoesNotApplyToOperators() (gas: 149528)
-ExampleERC721Test:testFilter() (gas: 48826)
-ExampleERC721Test:testOwnersNotExcluded() (gas: 123566)
-ExampleERC721Test:testOwnersNotExcludedSafeTransfer() (gas: 161425)
-RevokeExampleERC1155Test:testExcludeApprovals() (gas: 101694)
-RevokeExampleERC1155Test:testExclusionExceptionDoesNotApplyToOperators() (gas: 133903)
-RevokeExampleERC1155Test:testFilter() (gas: 42998)
-RevokeExampleERC1155Test:testOwnersNotExcluded() (gas: 105840)
-RevokeExampleERC1155Test:testOwnersNotExcludedBatch() (gas: 109089)
-RevokeExampleERC1155Test:testRevoke() (gas: 139822)
-RevokableExampleERC721Test:testExcludeApprovals() (gas: 127957)
-RevokableExampleERC721Test:testExclusionExceptionDoesNotApplyToOperators() (gas: 152232)
-RevokableExampleERC721Test:testFilter() (gas: 55752)
-RevokableExampleERC721Test:testOwnersNotExcluded() (gas: 123588)
-RevokableExampleERC721Test:testOwnersNotExcludedSafeTransfer() (gas: 161360)
-RevokableExampleERC721Test:testRevoke() (gas: 160542)
-ExampleER1155UpgradeableTest:testExcludeApprovals() (gas: 99399)
-ExampleER1155UpgradeableTest:testExclusionExceptionDoesNotApplyToOperators() (gas: 131327)
-ExampleER1155UpgradeableTest:testFilter() (gas: 38423)
-ExampleER1155UpgradeableTest:testOwnersNotExcluded() (gas: 106035)
-ExampleER1155UpgradeableTest:testOwnersNotExcludedBatch() (gas: 109258)
-ExampleER1155UpgradeableTest:testUpgradeable() (gas: 2381586)
-ExampleERC721UpgradeableTest:testExcludeApprovals() (gas: 123377)
-ExampleERC721UpgradeableTest:testExclusionExceptionDoesNotApplyToOperators() (gas: 149610)
-ExampleERC721UpgradeableTest:testFilter() (gas: 48945)
-ExampleERC721UpgradeableTest:testOwnersNotExcluded() (gas: 123730)
-ExampleERC721UpgradeableTest:testOwnersNotExcludedSafeTransfer() (gas: 161952)
-ExampleERC721UpgradeableTest:testUpgradeable() (gas: 2482571)
-RevokableExampleER1155UpgradeableTest:testExcludeApprovals() (gas: 101609)
-RevokableExampleER1155UpgradeableTest:testExclusionExceptionDoesNotApplyToOperators() (gas: 133680)
-RevokableExampleER1155UpgradeableTest:testFilter() (gas: 42687)
-RevokableExampleER1155UpgradeableTest:testOwnersNotExcluded() (gas: 108222)
-RevokableExampleER1155UpgradeableTest:testOwnersNotExcludedBatch() (gas: 111424)
-RevokableExampleER1155UpgradeableTest:testRevoke() (gas: 142611)
-RevokableExampleER1155UpgradeableTest:testUpgradeable() (gas: 2457993)
-ExampleERC721UpgradeableTest:testExcludeApprovals() (gas: 127663)
-ExampleERC721UpgradeableTest:testExclusionExceptionDoesNotApplyToOperators() (gas: 151962)
-ExampleERC721UpgradeableTest:testFilter() (gas: 55397)
-ExampleERC721UpgradeableTest:testOwnersNotExcluded() (gas: 125939)
-ExampleERC721UpgradeableTest:testOwnersNotExcludedSafeTransfer() (gas: 164361)
-ExampleERC721UpgradeableTest:testRevoke() (gas: 163227)
-ExampleERC721UpgradeableTest:testUpgradeable() (gas: 2568242)
-Filterer:testFilter(address):(bool) (runs: 256, μ: 2952, ~: 3004)
-ExampleERC1155ValidationTest:testERC1155() (gas: 149946)
-ExampleERC1155ValidationTest:testERC721() (gas: 82135)
-ExampleERC721ValidationTest:testERC1155() (gas: 76558)
-ExampleERC721ValidationTest:testERC721() (gas: 219006)
-ValidationTest:testERC1155() (gas: 77094)
-ValidationTest:testERC721() (gas: 230959)
diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
deleted file mode 100644
index 225f0b3..0000000
--- a/.github/workflows/publish.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-name: Publish Package to npmjs
-on:
- release:
- types: [created]
-jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v2
- with:
- node-version: "16.x"
- registry-url: "https://registry.npmjs.org"
- - run: grep -RiIln 'openzeppelin-contracts' src | xargs sed -i 's/openzeppelin\-contracts/@openzeppelin\/contracts/g'
- - run: yarn
- - run: npm publish --access public
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
deleted file mode 100644
index a7ee20c..0000000
--- a/.github/workflows/test.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-name: test
-
-on: [push, pull_request]
-
-env:
- FOUNDRY_PROFILE: ci
-
-jobs:
- check:
- strategy:
- fail-fast: true
-
- name: Foundry project
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- with:
- submodules: recursive
-
- - name: Install Foundry
- uses: foundry-rs/foundry-toolchain@v1
- with:
- version: nightly
-
- - name: Run Forge build
- run: |
- forge --version
- forge build --sizes
- id: build
-
- - name: Run Forge tests
- run: |
- forge test -vvv
- id: test
diff --git a/.prettierrc b/.prettierrc
deleted file mode 100644
index 884f11c..0000000
--- a/.prettierrc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "tabWidth": 4,
- "printWidth": 120,
- "bracketSpacing": false
-}
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 8d4b8ca..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,7 +0,0 @@
-Copyright 2022 Ozone Networks, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
index 1b74f33..3ad3995 100644
--- a/README.md
+++ b/README.md
@@ -1,255 +1,5 @@
# Operator Filter Registry
-## Introduction
+## DEPRECATED
-This repository contains a number of tools to help token contracts manage the operators allowed to transfer tokens on behalf of users - including the smart contracts and delegates of marketplaces that do not respect creator earnings.
-
-This is not a foolproof approach - but it makes bypassing creator earnings less liquid and easy at scale.
-
-## How it works
-
-Token smart contracts may register themselves (or be registered by their "owner") with the `OperatorFilterRegistry`. Token contracts or their "owner"s may then curate lists of operators (specific account addresses) and codehashes (smart contracts deployed with the same code) that should not be allowed to transfer tokens on behalf of users.
-
-## Creator Earnings Enforcement
-
-OpenSea will enforce creator earnings for smart contracts that make best efforts to filter transfers from operators known to not respect creator earnings.
-
-This repository facilitates that process by providing smart contracts that interface with the registry automatically, including automatically subscribing to OpenSea's list of filtered operators.
-
-When filtering operators, use of this registry is not required, nor is it required for a token contract to "subscribe" to OpenSea's list within this registry. Subscriptions can be changed or removed at any time. Filtered operators and codehashes may likewise be added or removed at any time.
-
-Contract owners may implement their own filtering outside of this registry, or they may use this registry to curate their own lists of filtered operators. However, there are certain contracts that are filtered by the default subscription, and must be filtered in order to be eligible for creator earnings enforcement on OpenSea.
-
-## Note on [EIP-2981](https://eips.ethereum.org/EIPS/eip-2981)
-
-Implementing EIP-2981 is not sufficient for a token to be eligible for creator earnings on OpenSea.
-
-While sometimes described as "on-chain," EIP-2981 only provides a method to determine what the appropriate creator earnings should be for a sale. EIP-2981 does not provide any mechanism of on-chain enforcement of those earnings.
-
-## Filtered addresses
-
-Entries in this list are added according to the following criteria:
-
-- If the application most commonly used to interface with the contract gives buyers and sellers the ability to bypass creator earnings when a similar transaction for the same item would require creator earnings payment on OpenSea.io
-- If the contract is facilitating the evasion of on-chain creator earnings enforcement measures. For example, the contract uses a wrapper contract to bypass earnings enforcement.
-
-
-
-| Name |
-Address |
-Network |
-
-
-
-| LooksRare TransferManagerERC721 |
-0xf42aa99F011A1fA7CDA90E5E98b277E306BcA83e |
-Ethereum Mainnet |
-
-
-
-| LooksRare TransferManagerERC1155 |
-0xFED24eC7E22f573c2e08AEF55aA6797Ca2b3A051 |
-Ethereum Mainnet |
-
-
-
-| SudoSwap LSSVMPairEnumerableERC20 |
-0xD42638863462d2F21bb7D4275d7637eE5d5541eB |
-Ethereum Mainnet |
-
-
-
-| SudoSwap LSSVMPairEnumerableETH |
-0x08CE97807A81896E85841d74FB7E7B065ab3ef05 |
-Ethereum Mainnet |
-
-
-
-| SudoSwap LSSVMPairMissingEnumerableERC20 |
-0x92de3a1511EF22AbCf3526c302159882a4755B22 |
-Ethereum Mainnet |
-
-
-
-| SudoSwap LSSVMPairMissingEnumerableETH |
-0xCd80C916B1194beB48aBF007D0b79a7238436D56 |
-Ethereum Mainnet |
-
-
-
-| SudoSwap LSSVMPairFactory |
-0xb16c1342E617A5B6E4b631EB114483FDB289c0A4 |
-Ethereum Mainnet |
-
-
-
-| NFTX NFTXMarketplaceZap |
-0x0fc584529a2aefa997697fafacba5831fac0c22d |
-Ethereum Mainnet |
-
-
-
-| Looksrare V2 TransferManager |
-0x000000000060C4Ca14CfC4325359062ace33Fe3D |
-Ethereum Mainnet |
-
-
-
-
-## Deployments
-
-## Usage
-
-Token contracts that wish to manage lists of filtered operators and restrict transfers from them may integrate with the registry easily with tokens using the [`OperatorFilterer`](src/OperatorFilterer.sol) and [`DefaultOperatorFilterer`](src/DefaultOperatorFilterer.sol) contracts. These contracts provide modifiers (`onlyAllowedOperator` and `onlyAllowedOperatorApproval`) which can be used on the token's transfer methods to restrict transfers from or approvals of filtered operators.
-
-See the [ExampleERC721](src/example/ExampleERC721.sol) and [ExampleERC1155](src/example/ExampleERC1155.sol) contracts for basic implementations that inherit the `DefaultOperatorFilterer`.
-
-## Getting Started with Foundry
-
-This package can be installed into a [Foundry](https://github.com/foundry-rs/foundry#installation) project with the following command
-
-```bash
-forge install ProjectOpenSea/operator-filter-registry
-```
-
-With default remappings provided by `forge remappings`, the default operator filterer can be imported into your project with the following statement
-
-```solidity
-import "operator-filter-registry/DefaultOperatorFilterer.sol";
-```
-
-See NPM section below for further details.
-
-## Getting started with NPM
-
-This package can be found on NPM to integrate with tools like hardhat.
-
-### Installing
-
-with npm
-
-```bash
-npm i operator-filter-registry
-```
-
-with yarn
-
-```bash
-yarn add operator-filter-registry
-```
-
-### Default usage
-
-Add to your smart contract in the import section:
-
-```solidity
-import "operator-filter-registry/src/DefaultOperatorFilterer.sol";
-```
-
-Next extend from `DefaultOperatorFilterer`
-
-```solidity
-contract MyNft is
- DefaultOperatorFilterer,
- // remaining inheritance here
-{
-```
-
-Finally, override the ERC721 transfer and approval methods (modifiers are overridable as needed)
-
-```solidity
- function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
- super.setApprovalForAll(operator, approved);
- }
-
- function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
- super.approve(operator, tokenId);
- }
-
- function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.transferFrom(from, to, tokenId);
- }
-
- function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.safeTransferFrom(from, to, tokenId);
- }
-
- function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
- public
- override
- onlyAllowedOperator(from)
- {
- super.safeTransferFrom(from, to, tokenId, data);
- }
-```
-
-# Smart Contracts
-
-## `OperatorFilterRegistry`
-
-`OperatorFilterRegistry` lets a smart contract or its [EIP-173 `Owner`](https://eips.ethereum.org/EIPS/eip-173) register a list of addresses and code hashes to deny when `isOperatorBlocked` is called.
-
-It also supports "subscriptions," which allow a contract to delegate its operator filtering to another contract. This is useful for contracts that want to allow users to delegate their operator filtering to a trusted third party, who can continuously update the list of filtered operators and code hashes. Subscriptions may be cancelled at any time by the subscriber or its `Owner`.
-
-### updateOperator(address registrant, address operator, bool filtered)
-
-This method will toggle filtering for an operator for a given registrant. If `filtered` is `true`, `isOperatorAllowed` will return `false`. If `filtered` is `false`, `isOperatorAllowed` will return `true`. This can filter known addresses.
-
-### updateCodeHash(address registrant, bytes32 codeHash, bool filtered)
-
-This method will toggle filtering on code hashes of operators given registrant. If an operator's `EXTCODEHASH` matches a filtered code hash, `isOperatorAllowed` will return `true`. Otherwise, `isOperatorAllowed` will return `false`. This can filter smart contract operators with different addresses but the same code.
-
-## `OperatorFilterer`
-
-This smart contract is meant to be inherited by token contracts so they can use the following:
-
-- `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
-- `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
-
-On construction, it takes three parameters:
-
-- `address registry`: the address of the `OperatorFilterRegistry` contract
-- `address subscriptionOrRegistrantToCopy`: the address of the registrant the contract will either subscribe to, or do a one-time copy of that registrant's filters. If the zero address is provided, no subscription or copies will be made.
-- `bool subscribe`: if true, subscribes to the previous address if it was not the zero address. If false, copies existing filtered addresses and codeHashes without subscribing to future updates.
-
-Please note that if your token contract does not provide an owner with [EIP-173](https://eips.ethereum.org/EIPS/eip-173), it must provide administration methods on the contract itself to interact with the registry otherwise the subscription will be locked to the options set during construction.
-
-### `onlyAllowedOperator(address operator)`
-
-This modifier will revert if the `operator` or its code hash is filtered by the `OperatorFilterRegistry` contract.
-
-## `DefaultOperatorFilterer`
-
-This smart contract extends `OperatorFilterer` and automatically configures the token contract that inherits it to subscribe to OpenSea's list of filtered operators and code hashes. This subscription can be updated at any time by the owner by calling `updateSubscription` on the `OperatorFilterRegistry` contract.
-
-Please note that if your token contract does not provide an owner with [EIP-173](https://eips.ethereum.org/EIPS/eip-173), it must provide administration methods on the contract itself to interact with the registry otherwise the subscription will be locked to the options set during construction.
-
-## `OwnedRegistrant`
-
-This `Ownable` smart contract is meant as a simple utility to enable subscription addresses that can easily be transferred to a new owner for administration. For example: an EOA curates a list of filtered operators and code hashes, and then transfers ownership of the `OwnedRegistrant` to a multisig wallet.
-
-# Validation
-
-When the first token is minted on an NFT smart contract, OpenSea checks if the filtered operators on that network (Ethereum Mainnet, Goerli, Polygon, etc.) are allowed to transfer the token. If they are, OpenSea will mark the collection as ineligible for creator earnings. Otherwise, OpenSea will enforce creator earnings on the collection.
-
-If at a later point, OpenSea detects orders being fulfilled by filtered operators, OpenSea will mark the collection as ineligible for creator earnings going forward.
-
-The included [validation test](test/validation/Validation.t.sol) runs the same checks that OpenSea does when first creating a collection page, and can be extended with custom setup for your token contract.
-
-The test can be configured to test against deployed contracts on a network fork with a `.env` file following the [sample.env](sample.env). You may need to supply a custom [`[rpc_endpoints]`](https://book.getfoundry.sh/reference/config/testing#rpc_endpoints) in the `foundry.toml` file for forking to work properly.
-
-To run only the validation tests, run
-
-```bash
-forge test --match-contract ValidationTest -vvv
-```
-
-See the [Foundry project page](https://github.com/foundry-rs/foundry#installation) for Foundry installation instructions.
-
-# Audit
-
-The contracts in this repository have been audited by [OpenZeppelin](https://openzeppelin.com/). You may read the final audit report [here](audit/OpenSea%20Operator%20Filteer%20Audit%20Report.pdf).
-
-# License
-
-[MIT](LICENSE) Copyright 2022 Ozone Networks, Inc.
+Operator filters have been proven to be easily circumvented and go against principles of ownership and decentralization.
\ No newline at end of file
diff --git a/audit/OpenSea Operator Filteer Audit Report.pdf b/audit/OpenSea Operator Filteer Audit Report.pdf
deleted file mode 100644
index e8dfe0c..0000000
Binary files a/audit/OpenSea Operator Filteer Audit Report.pdf and /dev/null differ
diff --git a/foundry.toml b/foundry.toml
deleted file mode 100644
index c605a6d..0000000
--- a/foundry.toml
+++ /dev/null
@@ -1,18 +0,0 @@
-[profile.default]
-src = 'src'
-out = 'out'
-libs = ['lib']
-optimizer_runs = 1_000_000
-solc = '0.8.17'
-remappings = [
- 'openzeppelin-contracts/=lib/openzeppelin-contracts/contracts',
- 'openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts',
- 'forge-std/=lib/forge-std/src/',
- 'ds-test/=lib/ds-test/src/',
-]
-# for compatibility with token contracts deployed with 0.8.20 on Ethereum mainnet
-# should not affect local compilation and simulation of non-Shanghai chains
-evm_version = 'shanghai'
-
-
-# See more config options https://github.com/foundry-rs/foundry/tree/master/config
diff --git a/lib/ds-test b/lib/ds-test
deleted file mode 160000
index e282159..0000000
--- a/lib/ds-test
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e282159d5170298eb2455a6c05280ab5a73a4ef0
diff --git a/lib/forge-std b/lib/forge-std
deleted file mode 160000
index b00f504..0000000
--- a/lib/forge-std
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit b00f504daf0bdd8cf2e67973e2c86bd213cda400
diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts
deleted file mode 160000
index 8c9a831..0000000
--- a/lib/openzeppelin-contracts
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 8c9a831596788f266ec6e5bf8ef2c7d05bb5931b
diff --git a/lib/openzeppelin-contracts-upgradeable b/lib/openzeppelin-contracts-upgradeable
deleted file mode 160000
index 25aabd2..0000000
--- a/lib/openzeppelin-contracts-upgradeable
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 25aabd286e002a1526c345c8db259d57bdf0ad28
diff --git a/package.json b/package.json
deleted file mode 100644
index 0e4da99..0000000
--- a/package.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "name": "operator-filter-registry",
- "version": "1.4.2",
- "repository": "git@github.com:ProjectOpenSea/operator-filter-registry.git",
- "author": "Operator Filterer ",
- "license": "MIT",
- "dependencies": {
- "@openzeppelin/contracts": "^4.7.3",
- "@openzeppelin/contracts-upgradeable": "^4.8.2"
- },
- "files": [
- "node_modules",
- "package.json",
- "src",
- "LICENSE",
- "README.md"
- ]
-}
diff --git a/sample.env b/sample.env
deleted file mode 100644
index 86d483d..0000000
--- a/sample.env
+++ /dev/null
@@ -1,4 +0,0 @@
-NETWORK=mainnet
-CONTRACT_ADDRESS=0xa518286d66f3699ba4f546f3addb75f2b838c307
-TOKEN_ID=4
-OWNER=0xd8fb7fb541e0bfe5863c5be4b1b41bb552933383
\ No newline at end of file
diff --git a/script/ConfigureOwnedRegistrant.s.sol b/script/ConfigureOwnedRegistrant.s.sol
deleted file mode 100644
index d91c2fa..0000000
--- a/script/ConfigureOwnedRegistrant.s.sol
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OwnedRegistrant} from "../src/OwnedRegistrant.sol";
-import {IOperatorFilterRegistry} from "../src/IOperatorFilterRegistry.sol";
-import {DeployRegistry} from "./DeployRegistry.s.sol";
-import {ScriptBase, console2} from "./ScriptBase.sol";
-
-contract ConfigureOwnedRegistrant is ScriptBase {
- function run() public {
- setUp();
- address registryAddress = vm.envAddress("REGISTRY_ADDRESS");
- IOperatorFilterRegistry registry = IOperatorFilterRegistry(registryAddress);
- OwnedRegistrant registrant = OwnedRegistrant(vm.envAddress("REGISTRANT_ADDRESS"));
- address[] memory add = vm.envAddress("NEW_FILTERED_ADDRESSES", ",");
- address[] memory remove = vm.envAddress("REMOVE_FILTERED_ADDRESSES", ",");
-
- string[] memory chains = vm.envString("CHAINS", ",");
- for (uint256 i = 0; i < chains.length; i++) {
- string memory chain = chains[i];
- vm.createSelectFork(getChain(chain).rpcUrl);
- vm.startBroadcast(deployer);
- registry.updateOperators(address(registrant), add, true);
- registry.updateOperators(address(registrant), remove, false);
- vm.stopBroadcast();
- }
- }
-}
diff --git a/script/ConfigureOwnedRegistry.s.sol b/script/ConfigureOwnedRegistry.s.sol
deleted file mode 100644
index 1cf18f9..0000000
--- a/script/ConfigureOwnedRegistry.s.sol
+++ /dev/null
@@ -1,45 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OwnedRegistrant} from "../src/OwnedRegistrant.sol";
-import {IOperatorFilterRegistry} from "../src/IOperatorFilterRegistry.sol";
-import {DeployRegistry} from "./DeployRegistry.s.sol";
-import {ScriptBase, console2} from "./ScriptBase.sol";
-
-contract DeployRegistryAndConfigureOwnedRegistrant is ScriptBase {
- mapping(string => bool) selectedChains;
-
- function run() public {
- setUp();
-
- string[] memory chainNames = vm.envString("BROADCAST_CHAINS", ",");
- for (uint256 i = 0; i < chainNames.length; i++) {
- selectedChains[chainNames[i]] = true;
- }
- string[2][] memory rpcs = vm.rpcUrls();
- for (uint256 i = 0; i < rpcs.length; i++) {
- if (selectedChains[rpcs[i][0]]) {
- console2.log("Configuring registry on chain ", rpcs[i][0]);
- vm.createSelectFork(rpcs[i][1]);
- configure();
- }
- }
- }
-
- function configure() internal {
- address registryAddress = vm.envAddress("REGISTRY_ADDRESS");
- IOperatorFilterRegistry registry = IOperatorFilterRegistry(registryAddress);
- address[] memory addressesToAdd = vm.envAddress("NEW_FILTERED_ADDRESSES", ",");
- address[] memory addressesToRemove = vm.envAddress("REMOVE_FILTERED_ADDRESSES", ",");
- OwnedRegistrant registrant = OwnedRegistrant(vm.envAddress("REGISTRANT_ADDRESS"));
-
- vm.startBroadcast(deployer);
- if (addressesToAdd.length > 0) {
- registry.updateOperators(address(registrant), addressesToAdd, true);
- }
- if (addressesToRemove.length > 0) {
- registry.updateOperators(address(registrant), addressesToRemove, false);
- }
- vm.stopBroadcast();
- }
-}
diff --git a/script/DeployAndConfigureOwnedRegistrant.s.sol b/script/DeployAndConfigureOwnedRegistrant.s.sol
deleted file mode 100644
index 773afef..0000000
--- a/script/DeployAndConfigureOwnedRegistrant.s.sol
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OwnedRegistrant} from "../src/OwnedRegistrant.sol";
-import {IOperatorFilterRegistry} from "../src/IOperatorFilterRegistry.sol";
-import {DeployRegistry} from "./DeployRegistry.s.sol";
-import {ScriptBase, console2} from "./ScriptBase.sol";
-
-contract DeployRegistryAndConfigureOwnedRegistrant is ScriptBase {
- function run() public {
- setUp();
- address registryAddress = vm.envAddress("REGISTRY_ADDRESS");
- IOperatorFilterRegistry registry = IOperatorFilterRegistry(registryAddress);
- address[] memory addressesToFilter = vm.envAddress("FILTERED_ADDRESSES", ",");
-
- bytes memory creationCode = abi.encodePacked(type(OwnedRegistrant).creationCode, abi.encode(deployer));
- bytes32 salt = bytes32(uint256(uint160(deployer)) << 96);
- vm.startBroadcast(deployer);
- OwnedRegistrant registrant = OwnedRegistrant(IMMUTABLE_CREATE2_FACTORY.safeCreate2(salt, creationCode));
- registrant.acceptOwnership();
- registry.updateOperators(address(registrant), addressesToFilter, true);
- }
-}
diff --git a/script/DeployRegistry.s.sol b/script/DeployRegistry.s.sol
deleted file mode 100644
index e268579..0000000
--- a/script/DeployRegistry.s.sol
+++ /dev/null
@@ -1,18 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OperatorFilterRegistry} from "../src/OperatorFilterRegistry.sol";
-import {ScriptBase, console2} from "./ScriptBase.sol";
-
-contract DeployRegistry is ScriptBase {
- function run() public {
- setUp();
- bytes memory creationCode = type(OperatorFilterRegistry).creationCode;
- console2.logBytes32(keccak256(creationCode));
- bytes32 salt = bytes32(0x0000000000000000000000000000000000000000d40ba0de8b5adb1cc4070000);
- // bytes32 salt = bytes32(0);
-
- vm.broadcast(deployer);
- IMMUTABLE_CREATE2_FACTORY.safeCreate2(salt, creationCode);
- }
-}
diff --git a/script/DeployRegistryAndRegistrant.s.sol b/script/DeployRegistryAndRegistrant.s.sol
deleted file mode 100644
index 12356ce..0000000
--- a/script/DeployRegistryAndRegistrant.s.sol
+++ /dev/null
@@ -1,34 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OperatorFilterRegistry} from "../src/OperatorFilterRegistry.sol";
-import {OwnedRegistrant} from "../src/OwnedRegistrant.sol";
-import {ScriptBase, console2} from "./ScriptBase.sol";
-
-contract DeployRegistryAndRegistrant is ScriptBase {
- function run() public {
- setUp();
- bytes memory creationCode =
- hex"608060405234801561001057600080fd5b50613848806100206000396000f3fe608060405234801561001057600080fd5b50600436106101985760003560e01c8063712fc00b116100e3578063b314d4141161008c578063c430880511610066578063c4308805146103d1578063c6171134146103e4578063e4aecb54146103f757600080fd5b8063b314d4141461035b578063bbd652c71461036e578063c3c5a5471461039657600080fd5b8063a14584c1116100bd578063a14584c114610314578063a2f367ab14610327578063a6529eb51461033a57600080fd5b8063712fc00b146102db5780637d3e3dbe146102ee578063a0af29031461030157600080fd5b80633f1cc5fa116101455780635745ae281161011f5780635745ae28146102855780635eae3173146102a55780636af0c315146102c857600080fd5b80633f1cc5fa1461024c5780634420e4861461025f57806355940e511461027257600080fd5b80632ec2c246116101765780632ec2c246146101ee57806334a0dc10146102015780633c5030bb1461021457600080fd5b8063063298b61461019d5780631e06b4b4146101b257806322fa2762146101c5575b600080fd5b6101b06101ab366004613484565b61040a565b005b6101b06101c03660046134eb565b610854565b6101d86101d3366004613524565b610b57565b6040516101e59190613541565b60405180910390f35b6101b06101fc366004613524565b610bec565b6101b061020f366004613585565b610eaa565b610227610222366004613524565b611168565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e5565b61022761025a3660046135ba565b61121b565b6101b061026d366004613524565b6112bc565b6102276102803660046135ba565b6114b7565b610298610293366004613524565b6114e6565b6040516101e591906135e6565b6102b86102b33660046134eb565b611517565b60405190151581526020016101e5565b6102b86102d63660046135ba565b6115be565b6101b06102e9366004613634565b61164d565b6101b06102fc3660046134eb565b6119cd565b6101b061030f3660046134eb565b611da3565b6101b0610322366004613484565b612081565b6101b0610335366004613672565b61244f565b61034d6103483660046135ba565b6127b6565b6040519081526020016101e5565b6101b06103693660046134eb565b612845565b61034d61037c366004613524565b73ffffffffffffffffffffffffffffffffffffffff163f90565b6102b86103a4366004613524565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526002602052604090205416151590565b6102986103df366004613524565b612d63565b6102b86103f23660046134eb565b612df1565b6102b86104053660046134eb565b612f4c565b833373ffffffffffffffffffffffffffffffffffffffff821614610575578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156104ad575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526104aa918101906136b0565b60015b610524573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b606091505b50805160000361051c576040517fb2c1414000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b3373ffffffffffffffffffffffffffffffffffffffff821614610573576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff80861660009081526002602052604090205416806105f1576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871660048201526024015b60405180910390fd5b8573ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461066e576040517f04af4d6900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260016020526040902084846107225760005b8181101561071c5760008888838181106106b8576106b86136cd565b90506020020135905060006106d68286612fdb90919063ffffffff16565b905080610712576040517f478730a8000000000000000000000000000000000000000000000000000000008152600481018390526024016105e8565b505060010161069c565b506107f7565b60005b818110156107f5576000888883818110610741576107416136cd565b9050602002013590507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081036107a3576040517ff575ead800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006107af8583612fe7565b9050806107eb576040517f186bea00000000000000000000000000000000000000000000000000000000008152600481018390526024016105e8565b5050600101610725565b505b8415158873ffffffffffffffffffffffffffffffffffffffff167f34e9f70c5a16a4df2a396cf0cbc4735eb3c7fb6ae40aaa0b34be7720121d1b9689896040516108429291906136fc565b60405180910390a35050505050505050565b813373ffffffffffffffffffffffffffffffffffffffff821614610976578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108f7575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526108f4918101906136b0565b60015b610925573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614610974576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036109db576040517f1acab6b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680610a52576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610acf576040517f04af4d6900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680610b46576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b610b508585612ff3565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff80821660008181526002602052604090205460609216908114610bbe5773ffffffffffffffffffffffffffffffffffffffff81166000908152600160205260409020610bb79061318d565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600160205260409020610bb79061318d565b803373ffffffffffffffffffffffffffffffffffffffff821614610d0e578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610c8f575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610c8c918101906136b0565b60015b610cbd573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614610d0c576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600260205260409020541680610d85576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024016105e8565b8273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610e305773ffffffffffffffffffffffffffffffffffffffff81166000908152600360205260409020610de7908461319a565b5060405160009073ffffffffffffffffffffffffffffffffffffffff80841691908616907e38c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e8908490a45b73ffffffffffffffffffffffffffffffffffffffff831660008181526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055519091907f86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb59908390a3505050565b813373ffffffffffffffffffffffffffffffffffffffff821614610fcc578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610f4d575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610f4a918101906136b0565b60015b610f7b573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614610fca576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680611043576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110a8576040517f237e6c2800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602052604090206110d7908561319a565b5073ffffffffffffffffffffffffffffffffffffffff80851660008181526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055519092841691907e38c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e8908490a48215611162576111628482612ff3565b50505050565b73ffffffffffffffffffffffffffffffffffffffff80821660009081526002602052604090205416806111df576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff831660048201526024016105e8565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611216575060005b919050565b73ffffffffffffffffffffffffffffffffffffffff8083166000818152600260205260408120549092169081146112835773ffffffffffffffffffffffffffffffffffffffff8116600090815260208190526040902061127b90846131bc565b9150506112b6565b73ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090206112b290846131bc565b9150505b92915050565b803373ffffffffffffffffffffffffffffffffffffffff8216146113de578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561135f575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261135c918101906136b0565b60015b61138d573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff8216146113dc576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff828116600090815260026020526040902054161561143d576040517f3a81d6fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168417905551600192917f86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb5991a35050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600360205260408120610bb790836131bc565b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602052604090206060906112b69061318d565b73ffffffffffffffffffffffffffffffffffffffff82811660008181526002602052604081205490928085163f9291169081146115865773ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040902061157d90836131c8565b925050506112b6565b73ffffffffffffffffffffffffffffffffffffffff851660009081526001602052604090206115b590836131c8565b95945050505050565b73ffffffffffffffffffffffffffffffffffffffff80831660008181526002602052604081205490921690811461161e5773ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040902061127b90846131c8565b73ffffffffffffffffffffffffffffffffffffffff841660009081526001602052604090206112b290846131c8565b823373ffffffffffffffffffffffffffffffffffffffff82161461176f578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156116f0575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526116ed918101906136b0565b60015b61171e573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff82161461176d576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47083036117c8576040517ff575ead800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808516600090815260026020526040902054168061183f576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861660048201526024016105e8565b8473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146118bc576040517f04af4d6900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600160205260409020836119345760006118f28287612fdb565b90508061192e576040517f478730a8000000000000000000000000000000000000000000000000000000008152600481018790526024016105e8565b5061197e565b60006119408287612fe7565b90508061197c576040517f186bea00000000000000000000000000000000000000000000000000000000008152600481018790526024016105e8565b505b831515858773ffffffffffffffffffffffffffffffffffffffff167fb8036058bafea884aabc446ca15619fd86f5464a4ad96f64164ad6f77444354d60405160405180910390a4505050505050565b813373ffffffffffffffffffffffffffffffffffffffff821614611aef578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611a70575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252611a6d918101906136b0565b60015b611a9e573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614611aed576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff808416600090815260026020526040902054168015611b4f576040517f3a81d6fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611bb4576040517f347f118f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680611c2b576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611ca8576040517f768e549c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff858116600090815260026020908152604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000001694891694851790559282526003905220611d0f90866131e0565b5060405160019073ffffffffffffffffffffffffffffffffffffffff8716907f86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb5990600090a360405160019073ffffffffffffffffffffffffffffffffffffffff80871691908816907e38c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e890600090a45050505050565b813373ffffffffffffffffffffffffffffffffffffffff821614611ec5578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611e46575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252611e43918101906136b0565b60015b611e74573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614611ec3576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611f2a576040517f1acab6b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600090815260026020526040902054168015611f8a576040517f3a81d6fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680612001576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff851660008181526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168417905551600192917f86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb5991a3610b508585612ff3565b833373ffffffffffffffffffffffffffffffffffffffff8216146121a3578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612124575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252612121918101906136b0565b60015b612152573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff8216146121a1576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff808616600090815260026020526040902054168061221a576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871660048201526024016105e8565b8573ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612297576040517f04af4d6900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260208190526040902084846123655760005b8181101561235f5760008888838181106122e1576122e16136cd565b90506020020160208101906122f69190613524565b90506000612304858361319a565b905080612355576040517f45525c0e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff831660048201526024016105e8565b50506001016122c5565b50612404565b60005b81811015612402576000888883818110612384576123846136cd565b90506020020160208101906123999190613524565b905060006123a785836131e0565b9050806123f8576040517f0bb4423400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff831660048201526024016105e8565b5050600101612368565b505b8415158873ffffffffffffffffffffffffffffffffffffffff167f02b85afdacb82d5512c6f05566b3018677ffcbd7e5f75e498bc64081131cbd6c898960405161084292919061374e565b823373ffffffffffffffffffffffffffffffffffffffff821614612571578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156124f2575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526124ef918101906136b0565b60015b612520573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff82161461256f576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff80851660009081526002602052604090205416806125e8576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861660048201526024016105e8565b8473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612665576040517f04af4d6900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff85166000908152602081905260409020836126f257600061269b828761319a565b9050806126ec576040517f45525c0e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871660048201526024016105e8565b50612751565b60006126fe82876131e0565b90508061274f576040517f0bb4423400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871660048201526024016105e8565b505b8315158573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a60405160405180910390a4505050505050565b73ffffffffffffffffffffffffffffffffffffffff8083166000818152600260205260408120549092169081146128165773ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040902061127b90846131bc565b73ffffffffffffffffffffffffffffffffffffffff841660009081526001602052604090206112b290846131bc565b813373ffffffffffffffffffffffffffffffffffffffff821614612967578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156128e8575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526128e5918101906136b0565b60015b612916573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614612965576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036129cc576040517f347f118f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216612a19576040517fb05574d300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680612a90576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603612b0d576040517f73a4164900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680612b84576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612c01576040517f768e549c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612cac5773ffffffffffffffffffffffffffffffffffffffff82166000908152600360205260409020612c63908661319a565b5060405160009073ffffffffffffffffffffffffffffffffffffffff80851691908816907e38c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e8908490a45b73ffffffffffffffffffffffffffffffffffffffff858116600090815260026020908152604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000001694891694851790559282526003905220612d1390866131e0565b5060405160019073ffffffffffffffffffffffffffffffffffffffff80871691908816907e38c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e890600090a45050505050565b73ffffffffffffffffffffffffffffffffffffffff80821660008181526002602052604090205460609216908114612dc35773ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020610bb79061318d565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020610bb79061318d565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600260205260408120549091168015612f425773ffffffffffffffffffffffffffffffffffffffff81166000908152602081815260408083206001909252909120612e598286613202565b15612ea8576040517fa8cf495d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff85163b15612f3f5773ffffffffffffffffffffffffffffffffffffffff85163f612ee782826131c8565b15612f3d576040517f5f3853a900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87166004820152602481018290526044016105e8565b505b50505b5060019392505050565b73ffffffffffffffffffffffffffffffffffffffff808316600081815260026020526040812054909216908114612fac5773ffffffffffffffffffffffffffffffffffffffff8116600090815260208190526040902061127b9084613202565b73ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090206112b29084613202565b6000610bb78383613231565b6000610bb78383613324565b73ffffffffffffffffffffffffffffffffffffffff811660009081526020818152604080832060019092528220909161302b83613373565b9050600061303883613373565b905060005b828110156130e057600061305186836131bc565b73ffffffffffffffffffffffffffffffffffffffff891660009081526020819052604081209192509061308490836131e0565b905080156130d65760405160019073ffffffffffffffffffffffffffffffffffffffff80851691908c16907f2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a90600090a45b505060010161303d565b5060005b818110156131845760006130f885836131bc565b73ffffffffffffffffffffffffffffffffffffffff891660009081526001602052604081209192509061312b9083612fe7565b9050801561317a57604051600190839073ffffffffffffffffffffffffffffffffffffffff8c16907fb8036058bafea884aabc446ca15619fd86f5464a4ad96f64164ad6f77444354d90600090a45b50506001016130e4565b50505050505050565b60606000610bb78361337d565b6000610bb78373ffffffffffffffffffffffffffffffffffffffff8416613231565b6000610bb783836133d9565b60008181526001830160205260408120541515610bb7565b6000610bb78373ffffffffffffffffffffffffffffffffffffffff8416613324565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001830160205260408120541515610bb7565b6000818152600183016020526040812054801561331a5760006132556001836137a9565b8554909150600090613269906001906137a9565b90508181146132ce576000866000018281548110613289576132896136cd565b90600052602060002001549050808760000184815481106132ac576132ac6136cd565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806132df576132df6137e3565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506112b6565b60009150506112b6565b600081815260018301602052604081205461336b575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556112b6565b5060006112b6565b60006112b6825490565b6060816000018054806020026020016040519081016040528092919081815260200182805480156133cd57602002820191906000526020600020905b8154815260200190600101908083116133b9575b50505050509050919050565b60008260000182815481106133f0576133f06136cd565b9060005260206000200154905092915050565b73ffffffffffffffffffffffffffffffffffffffff8116811461342557600080fd5b50565b60008083601f84011261343a57600080fd5b50813567ffffffffffffffff81111561345257600080fd5b6020830191508360208260051b850101111561346d57600080fd5b9250929050565b8035801515811461121657600080fd5b6000806000806060858703121561349a57600080fd5b84356134a581613403565b9350602085013567ffffffffffffffff8111156134c157600080fd5b6134cd87828801613428565b90945092506134e0905060408601613474565b905092959194509250565b600080604083850312156134fe57600080fd5b823561350981613403565b9150602083013561351981613403565b809150509250929050565b60006020828403121561353657600080fd5b8135610bb781613403565b6020808252825182820181905260009190848201906040850190845b818110156135795783518352928401929184019160010161355d565b50909695505050505050565b6000806040838503121561359857600080fd5b82356135a381613403565b91506135b160208401613474565b90509250929050565b600080604083850312156135cd57600080fd5b82356135d881613403565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b8181101561357957835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101613602565b60008060006060848603121561364957600080fd5b833561365481613403565b92506020840135915061366960408501613474565b90509250925092565b60008060006060848603121561368757600080fd5b833561369281613403565b925060208401356136a281613403565b915061366960408501613474565b6000602082840312156136c257600080fd5b8151610bb781613403565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020815281602082015260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561373557600080fd5b8260051b80856040850137919091016040019392505050565b60208082528181018390526000908460408401835b8681101561379e57823561377681613403565b73ffffffffffffffffffffffffffffffffffffffff1682529183019190830190600101613763565b509695505050505050565b818103818111156112b6577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220d2eb4529f96412ccc09b0c0c04d7ff105932b0b691aea14b7aa158442949a08664736f6c63430008110033";
- console2.logBytes32(keccak256(creationCode));
- bytes32 salt = bytes32(0x0000000000000000000000000000000000000000d40ba0de8b5adb1cc4070000);
- // bytes32 salt = bytes32(0);
- string[] memory chains = vm.envString("CHAINS", ",");
-
- bytes memory registrantCreationCode =
- hex"608060405234801561001057600080fd5b5060405161063b38038061063b83398101604081905261002f916101f2565b610038336100ab565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b15801561007e57600080fd5b505af1158015610092573d6000803e3d6000fd5b505050506100a5816100d260201b60201c565b50610222565b600180546001600160a01b03191690556100cf81610142602090811b61027017901c565b50565b6100da610192565b600180546001600160a01b0319166001600160a01b03831690811790915561010a6000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031633146101f05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b565b60006020828403121561020457600080fd5b81516001600160a01b038116811461021b57600080fd5b9392505050565b61040a806102316000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80638da5cb5b116100505780638da5cb5b1461007e578063e30c3978146100c1578063f2fde38b146100df57600080fd5b8063715018a61461006c57806379ba509714610076575b600080fd5b6100746100f2565b005b610074610106565b60005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b60015473ffffffffffffffffffffffffffffffffffffffff16610098565b6100746100ed366004610397565b6101c0565b6100fa6102e5565b6101046000610366565b565b600154339073ffffffffffffffffffffffffffffffffffffffff1681146101b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e6572000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6101bd81610366565b50565b6101c86102e5565b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915561022b60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610104576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101ab565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556101bd81610270565b6000602082840312156103a957600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146103cd57600080fd5b939250505056fea26469706673582212204f2a6b671e719be38470ca6124ec766d477c6d9dbd2f313eb84f6065c70ad51b64736f6c634300081100330000000000000000000000009aac739c133074db445183a95149880a2156541a";
- bytes32 registrantSalt = 0x9aac739c133074db445183a95149880a2156541a000000000000000000000000;
-
- for (uint256 i; i < chains.length; i++) {
- string memory chain = chains[i];
- console2.log(chain);
- vm.createSelectFork(getChain(chain).rpcUrl);
- vm.startBroadcast(deployer);
- IMMUTABLE_CREATE2_FACTORY.safeCreate2(salt, creationCode);
- OwnedRegistrant registrant =
- OwnedRegistrant(IMMUTABLE_CREATE2_FACTORY.safeCreate2(registrantSalt, registrantCreationCode));
- registrant.acceptOwnership();
- vm.stopBroadcast();
- }
- }
-}
diff --git a/script/ScriptBase.sol b/script/ScriptBase.sol
deleted file mode 100644
index c0bb8a8..0000000
--- a/script/ScriptBase.sol
+++ /dev/null
@@ -1,33 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OperatorFilterRegistry} from "../src/OperatorFilterRegistry.sol";
-import {Script, console2} from "forge-std/Script.sol";
-
-interface ImmutableCreate2Factory {
- function findCreate2Address(bytes32 salt, bytes memory initCode)
- external
- view
- returns (address deploymentAddress);
- function findCreate2AddressViaHash(bytes32 salt, bytes32 initCodeHash)
- external
- view
- returns (address deploymentAddress);
- function hasBeenDeployed(address deploymentAddress) external view returns (bool);
- function safeCreate2(bytes32 salt, bytes memory initializationCode)
- external
- payable
- returns (address deploymentAddress);
-}
-
-contract ScriptBase is Script {
- address deployer;
-
- ImmutableCreate2Factory constant IMMUTABLE_CREATE2_FACTORY =
- ImmutableCreate2Factory(0x0000000000FFe8B47B3e2130213B802212439497);
-
- function setUp() public {
- bytes32 pkey = vm.envBytes32("PRIVATE_KEY");
- deployer = vm.rememberKey(uint256(pkey));
- }
-}
diff --git a/script/cast-deploy.sh b/script/cast-deploy.sh
deleted file mode 100644
index 9979e41..0000000
--- a/script/cast-deploy.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-# As of writing, Forge scripting has issues estimating gas for some networks - for those networks, we can run this
-# script instead.
-
-source .env
-factory=0x0000000000FFe8B47B3e2130213B802212439497
-registrant=0x3cc6cdda760b79bafa08df41ecfa224f810dceb6
-
-salt1=0x0000000000000000000000000000000000000000d40ba0de8b5adb1cc4070000
-salt2=0x9aac739c133074db445183a95149880a2156541a000000000000000000000000
-
-code1=0x608060405234801561001057600080fd5b50613848806100206000396000f3fe608060405234801561001057600080fd5b50600436106101985760003560e01c8063712fc00b116100e3578063b314d4141161008c578063c430880511610066578063c4308805146103d1578063c6171134146103e4578063e4aecb54146103f757600080fd5b8063b314d4141461035b578063bbd652c71461036e578063c3c5a5471461039657600080fd5b8063a14584c1116100bd578063a14584c114610314578063a2f367ab14610327578063a6529eb51461033a57600080fd5b8063712fc00b146102db5780637d3e3dbe146102ee578063a0af29031461030157600080fd5b80633f1cc5fa116101455780635745ae281161011f5780635745ae28146102855780635eae3173146102a55780636af0c315146102c857600080fd5b80633f1cc5fa1461024c5780634420e4861461025f57806355940e511461027257600080fd5b80632ec2c246116101765780632ec2c246146101ee57806334a0dc10146102015780633c5030bb1461021457600080fd5b8063063298b61461019d5780631e06b4b4146101b257806322fa2762146101c5575b600080fd5b6101b06101ab366004613484565b61040a565b005b6101b06101c03660046134eb565b610854565b6101d86101d3366004613524565b610b57565b6040516101e59190613541565b60405180910390f35b6101b06101fc366004613524565b610bec565b6101b061020f366004613585565b610eaa565b610227610222366004613524565b611168565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e5565b61022761025a3660046135ba565b61121b565b6101b061026d366004613524565b6112bc565b6102276102803660046135ba565b6114b7565b610298610293366004613524565b6114e6565b6040516101e591906135e6565b6102b86102b33660046134eb565b611517565b60405190151581526020016101e5565b6102b86102d63660046135ba565b6115be565b6101b06102e9366004613634565b61164d565b6101b06102fc3660046134eb565b6119cd565b6101b061030f3660046134eb565b611da3565b6101b0610322366004613484565b612081565b6101b0610335366004613672565b61244f565b61034d6103483660046135ba565b6127b6565b6040519081526020016101e5565b6101b06103693660046134eb565b612845565b61034d61037c366004613524565b73ffffffffffffffffffffffffffffffffffffffff163f90565b6102b86103a4366004613524565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526002602052604090205416151590565b6102986103df366004613524565b612d63565b6102b86103f23660046134eb565b612df1565b6102b86104053660046134eb565b612f4c565b833373ffffffffffffffffffffffffffffffffffffffff821614610575578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156104ad575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526104aa918101906136b0565b60015b610524573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b606091505b50805160000361051c576040517fb2c1414000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b3373ffffffffffffffffffffffffffffffffffffffff821614610573576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff80861660009081526002602052604090205416806105f1576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871660048201526024015b60405180910390fd5b8573ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461066e576040517f04af4d6900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260016020526040902084846107225760005b8181101561071c5760008888838181106106b8576106b86136cd565b90506020020135905060006106d68286612fdb90919063ffffffff16565b905080610712576040517f478730a8000000000000000000000000000000000000000000000000000000008152600481018390526024016105e8565b505060010161069c565b506107f7565b60005b818110156107f5576000888883818110610741576107416136cd565b9050602002013590507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081036107a3576040517ff575ead800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006107af8583612fe7565b9050806107eb576040517f186bea00000000000000000000000000000000000000000000000000000000008152600481018390526024016105e8565b5050600101610725565b505b8415158873ffffffffffffffffffffffffffffffffffffffff167f34e9f70c5a16a4df2a396cf0cbc4735eb3c7fb6ae40aaa0b34be7720121d1b9689896040516108429291906136fc565b60405180910390a35050505050505050565b813373ffffffffffffffffffffffffffffffffffffffff821614610976578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156108f7575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526108f4918101906136b0565b60015b610925573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614610974576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036109db576040517f1acab6b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680610a52576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610acf576040517f04af4d6900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680610b46576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b610b508585612ff3565b5050505050565b73ffffffffffffffffffffffffffffffffffffffff80821660008181526002602052604090205460609216908114610bbe5773ffffffffffffffffffffffffffffffffffffffff81166000908152600160205260409020610bb79061318d565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600160205260409020610bb79061318d565b803373ffffffffffffffffffffffffffffffffffffffff821614610d0e578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610c8f575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610c8c918101906136b0565b60015b610cbd573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614610d0c576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600260205260409020541680610d85576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024016105e8565b8273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610e305773ffffffffffffffffffffffffffffffffffffffff81166000908152600360205260409020610de7908461319a565b5060405160009073ffffffffffffffffffffffffffffffffffffffff80841691908616907e38c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e8908490a45b73ffffffffffffffffffffffffffffffffffffffff831660008181526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055519091907f86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb59908390a3505050565b813373ffffffffffffffffffffffffffffffffffffffff821614610fcc578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610f4d575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610f4a918101906136b0565b60015b610f7b573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614610fca576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680611043576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110a8576040517f237e6c2800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602052604090206110d7908561319a565b5073ffffffffffffffffffffffffffffffffffffffff80851660008181526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055519092841691907e38c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e8908490a48215611162576111628482612ff3565b50505050565b73ffffffffffffffffffffffffffffffffffffffff80821660009081526002602052604090205416806111df576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff831660048201526024016105e8565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611216575060005b919050565b73ffffffffffffffffffffffffffffffffffffffff8083166000818152600260205260408120549092169081146112835773ffffffffffffffffffffffffffffffffffffffff8116600090815260208190526040902061127b90846131bc565b9150506112b6565b73ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090206112b290846131bc565b9150505b92915050565b803373ffffffffffffffffffffffffffffffffffffffff8216146113de578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561135f575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261135c918101906136b0565b60015b61138d573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff8216146113dc576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff828116600090815260026020526040902054161561143d576040517f3a81d6fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168417905551600192917f86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb5991a35050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600360205260408120610bb790836131bc565b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602052604090206060906112b69061318d565b73ffffffffffffffffffffffffffffffffffffffff82811660008181526002602052604081205490928085163f9291169081146115865773ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040902061157d90836131c8565b925050506112b6565b73ffffffffffffffffffffffffffffffffffffffff851660009081526001602052604090206115b590836131c8565b95945050505050565b73ffffffffffffffffffffffffffffffffffffffff80831660008181526002602052604081205490921690811461161e5773ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040902061127b90846131c8565b73ffffffffffffffffffffffffffffffffffffffff841660009081526001602052604090206112b290846131c8565b823373ffffffffffffffffffffffffffffffffffffffff82161461176f578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156116f0575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526116ed918101906136b0565b60015b61171e573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff82161461176d576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47083036117c8576040517ff575ead800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808516600090815260026020526040902054168061183f576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861660048201526024016105e8565b8473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146118bc576040517f04af4d6900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600160205260409020836119345760006118f28287612fdb565b90508061192e576040517f478730a8000000000000000000000000000000000000000000000000000000008152600481018790526024016105e8565b5061197e565b60006119408287612fe7565b90508061197c576040517f186bea00000000000000000000000000000000000000000000000000000000008152600481018790526024016105e8565b505b831515858773ffffffffffffffffffffffffffffffffffffffff167fb8036058bafea884aabc446ca15619fd86f5464a4ad96f64164ad6f77444354d60405160405180910390a4505050505050565b813373ffffffffffffffffffffffffffffffffffffffff821614611aef578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611a70575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252611a6d918101906136b0565b60015b611a9e573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614611aed576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff808416600090815260026020526040902054168015611b4f576040517f3a81d6fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611bb4576040517f347f118f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680611c2b576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611ca8576040517f768e549c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff858116600090815260026020908152604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000001694891694851790559282526003905220611d0f90866131e0565b5060405160019073ffffffffffffffffffffffffffffffffffffffff8716907f86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb5990600090a360405160019073ffffffffffffffffffffffffffffffffffffffff80871691908816907e38c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e890600090a45050505050565b813373ffffffffffffffffffffffffffffffffffffffff821614611ec5578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611e46575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252611e43918101906136b0565b60015b611e74573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614611ec3576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611f2a576040517f1acab6b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600090815260026020526040902054168015611f8a576040517f3a81d6fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680612001576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff851660008181526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168417905551600192917f86d03f430c7616021073d7a71766f632f1ce19f289aa989534d9f4732253eb5991a3610b508585612ff3565b833373ffffffffffffffffffffffffffffffffffffffff8216146121a3578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612124575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252612121918101906136b0565b60015b612152573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff8216146121a1576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff808616600090815260026020526040902054168061221a576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871660048201526024016105e8565b8573ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612297576040517f04af4d6900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260208190526040902084846123655760005b8181101561235f5760008888838181106122e1576122e16136cd565b90506020020160208101906122f69190613524565b90506000612304858361319a565b905080612355576040517f45525c0e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff831660048201526024016105e8565b50506001016122c5565b50612404565b60005b81811015612402576000888883818110612384576123846136cd565b90506020020160208101906123999190613524565b905060006123a785836131e0565b9050806123f8576040517f0bb4423400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff831660048201526024016105e8565b5050600101612368565b505b8415158873ffffffffffffffffffffffffffffffffffffffff167f02b85afdacb82d5512c6f05566b3018677ffcbd7e5f75e498bc64081131cbd6c898960405161084292919061374e565b823373ffffffffffffffffffffffffffffffffffffffff821614612571578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156124f2575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526124ef918101906136b0565b60015b612520573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff82161461256f576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b73ffffffffffffffffffffffffffffffffffffffff80851660009081526002602052604090205416806125e8576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861660048201526024016105e8565b8473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612665576040517f04af4d6900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff85166000908152602081905260409020836126f257600061269b828761319a565b9050806126ec576040517f45525c0e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871660048201526024016105e8565b50612751565b60006126fe82876131e0565b90508061274f576040517f0bb4423400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871660048201526024016105e8565b505b8315158573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a60405160405180910390a4505050505050565b73ffffffffffffffffffffffffffffffffffffffff8083166000818152600260205260408120549092169081146128165773ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040902061127b90846131bc565b73ffffffffffffffffffffffffffffffffffffffff841660009081526001602052604090206112b290846131bc565b813373ffffffffffffffffffffffffffffffffffffffff821614612967578073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156128e8575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526128e5918101906136b0565b60015b612916573d8080156104db576040519150601f19603f3d011682016040523d82523d6000602084013e6104e0565b3373ffffffffffffffffffffffffffffffffffffffff821614612965576040517ffcf5eff800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036129cc576040517f347f118f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216612a19576040517fb05574d300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680612a90576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603612b0d576040517f73a4164900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260409020541680612b84576040517fbfc6c33700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612c01576040517f768e549c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016105e8565b8473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612cac5773ffffffffffffffffffffffffffffffffffffffff82166000908152600360205260409020612c63908661319a565b5060405160009073ffffffffffffffffffffffffffffffffffffffff80851691908816907e38c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e8908490a45b73ffffffffffffffffffffffffffffffffffffffff858116600090815260026020908152604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000001694891694851790559282526003905220612d1390866131e0565b5060405160019073ffffffffffffffffffffffffffffffffffffffff80871691908816907e38c54977604f1a5c0a3604cbbecd0153c81e3131799ead95755e8bb5d5b9e890600090a45050505050565b73ffffffffffffffffffffffffffffffffffffffff80821660008181526002602052604090205460609216908114612dc35773ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020610bb79061318d565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020610bb79061318d565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600260205260408120549091168015612f425773ffffffffffffffffffffffffffffffffffffffff81166000908152602081815260408083206001909252909120612e598286613202565b15612ea8576040517fa8cf495d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861660048201526024016105e8565b73ffffffffffffffffffffffffffffffffffffffff85163b15612f3f5773ffffffffffffffffffffffffffffffffffffffff85163f612ee782826131c8565b15612f3d576040517f5f3853a900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87166004820152602481018290526044016105e8565b505b50505b5060019392505050565b73ffffffffffffffffffffffffffffffffffffffff808316600081815260026020526040812054909216908114612fac5773ffffffffffffffffffffffffffffffffffffffff8116600090815260208190526040902061127b9084613202565b73ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090206112b29084613202565b6000610bb78383613231565b6000610bb78383613324565b73ffffffffffffffffffffffffffffffffffffffff811660009081526020818152604080832060019092528220909161302b83613373565b9050600061303883613373565b905060005b828110156130e057600061305186836131bc565b73ffffffffffffffffffffffffffffffffffffffff891660009081526020819052604081209192509061308490836131e0565b905080156130d65760405160019073ffffffffffffffffffffffffffffffffffffffff80851691908c16907f2738289d9deecdc30eb8ffc42876633caecca1ffa166e4efa89f408e17373a1a90600090a45b505060010161303d565b5060005b818110156131845760006130f885836131bc565b73ffffffffffffffffffffffffffffffffffffffff891660009081526001602052604081209192509061312b9083612fe7565b9050801561317a57604051600190839073ffffffffffffffffffffffffffffffffffffffff8c16907fb8036058bafea884aabc446ca15619fd86f5464a4ad96f64164ad6f77444354d90600090a45b50506001016130e4565b50505050505050565b60606000610bb78361337d565b6000610bb78373ffffffffffffffffffffffffffffffffffffffff8416613231565b6000610bb783836133d9565b60008181526001830160205260408120541515610bb7565b6000610bb78373ffffffffffffffffffffffffffffffffffffffff8416613324565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001830160205260408120541515610bb7565b6000818152600183016020526040812054801561331a5760006132556001836137a9565b8554909150600090613269906001906137a9565b90508181146132ce576000866000018281548110613289576132896136cd565b90600052602060002001549050808760000184815481106132ac576132ac6136cd565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806132df576132df6137e3565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506112b6565b60009150506112b6565b600081815260018301602052604081205461336b575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556112b6565b5060006112b6565b60006112b6825490565b6060816000018054806020026020016040519081016040528092919081815260200182805480156133cd57602002820191906000526020600020905b8154815260200190600101908083116133b9575b50505050509050919050565b60008260000182815481106133f0576133f06136cd565b9060005260206000200154905092915050565b73ffffffffffffffffffffffffffffffffffffffff8116811461342557600080fd5b50565b60008083601f84011261343a57600080fd5b50813567ffffffffffffffff81111561345257600080fd5b6020830191508360208260051b850101111561346d57600080fd5b9250929050565b8035801515811461121657600080fd5b6000806000806060858703121561349a57600080fd5b84356134a581613403565b9350602085013567ffffffffffffffff8111156134c157600080fd5b6134cd87828801613428565b90945092506134e0905060408601613474565b905092959194509250565b600080604083850312156134fe57600080fd5b823561350981613403565b9150602083013561351981613403565b809150509250929050565b60006020828403121561353657600080fd5b8135610bb781613403565b6020808252825182820181905260009190848201906040850190845b818110156135795783518352928401929184019160010161355d565b50909695505050505050565b6000806040838503121561359857600080fd5b82356135a381613403565b91506135b160208401613474565b90509250929050565b600080604083850312156135cd57600080fd5b82356135d881613403565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b8181101561357957835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101613602565b60008060006060848603121561364957600080fd5b833561365481613403565b92506020840135915061366960408501613474565b90509250925092565b60008060006060848603121561368757600080fd5b833561369281613403565b925060208401356136a281613403565b915061366960408501613474565b6000602082840312156136c257600080fd5b8151610bb781613403565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020815281602082015260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561373557600080fd5b8260051b80856040850137919091016040019392505050565b60208082528181018390526000908460408401835b8681101561379e57823561377681613403565b73ffffffffffffffffffffffffffffffffffffffff1682529183019190830190600101613763565b509695505050505050565b818103818111156112b6577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220d2eb4529f96412ccc09b0c0c04d7ff105932b0b691aea14b7aa158442949a08664736f6c63430008110033
-code2=0x608060405234801561001057600080fd5b5060405161063b38038061063b83398101604081905261002f916101f2565b610038336100ab565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b15801561007e57600080fd5b505af1158015610092573d6000803e3d6000fd5b505050506100a5816100d260201b60201c565b50610222565b600180546001600160a01b03191690556100cf81610142602090811b61027017901c565b50565b6100da610192565b600180546001600160a01b0319166001600160a01b03831690811790915561010a6000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031633146101f05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b565b60006020828403121561020457600080fd5b81516001600160a01b038116811461021b57600080fd5b9392505050565b61040a806102316000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80638da5cb5b116100505780638da5cb5b1461007e578063e30c3978146100c1578063f2fde38b146100df57600080fd5b8063715018a61461006c57806379ba509714610076575b600080fd5b6100746100f2565b005b610074610106565b60005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b60015473ffffffffffffffffffffffffffffffffffffffff16610098565b6100746100ed366004610397565b6101c0565b6100fa6102e5565b6101046000610366565b565b600154339073ffffffffffffffffffffffffffffffffffffffff1681146101b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e6572000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6101bd81610366565b50565b6101c86102e5565b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915561022b60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610104576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101ab565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556101bd81610270565b6000602082840312156103a957600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146103cd57600080fd5b939250505056fea26469706673582212204f2a6b671e719be38470ca6124ec766d477c6d9dbd2f313eb84f6065c70ad51b64736f6c634300081100330000000000000000000000009aac739c133074db445183a95149880a2156541a
-
-
-cast send $factory "safeCreate2(bytes32,bytes)" $salt1 $code1 --rpc-url $ETH_RPC_URL --private-key $PRIVATE_KEY --gas-price 207170000
-cast send $factory "safeCreate2(bytes32,bytes)" $salt2 $code2 --rpc-url $ETH_RPC_URL --private-key $PRIVATE_KEY --gas-price 207170000
-cast send $registrant "acceptOwnership()" --rpc-url $ETH_RPC_URL --private-key $PRIVATE_KEY --gas-price 207170000
\ No newline at end of file
diff --git a/script/verification/OperatorFilterRegistryStandardJsonInput.json b/script/verification/OperatorFilterRegistryStandardJsonInput.json
deleted file mode 100644
index 4ce6e03..0000000
--- a/script/verification/OperatorFilterRegistryStandardJsonInput.json
+++ /dev/null
@@ -1,1075 +0,0 @@
-{"language":"Solidity","sources":{"lib/openzeppelin-contracts/contracts/access/Ownable.sol":{"content":"// SPDX-License-Identifier: MIT
-// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
-
-pragma solidity ^0.8.0;
-
-import \"../utils/Context.sol\";
-
-/**
- * @dev Contract module which provides a basic access control mechanism, where
- * there is an account (an owner) that can be granted exclusive access to
- * specific functions.
- *
- * By default, the owner account will be the one that deploys the contract. This
- * can later be changed with {transferOwnership}.
- *
- * This module is used through inheritance. It will make available the modifier
- * `onlyOwner`, which can be applied to your functions to restrict their use to
- * the owner.
- */
-abstract contract Ownable is Context {
- address private _owner;
-
- event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
-
- /**
- * @dev Initializes the contract setting the deployer as the initial owner.
- */
- constructor() {
- _transferOwnership(_msgSender());
- }
-
- /**
- * @dev Throws if called by any account other than the owner.
- */
- modifier onlyOwner() {
- _checkOwner();
- _;
- }
-
- /**
- * @dev Returns the address of the current owner.
- */
- function owner() public view virtual returns (address) {
- return _owner;
- }
-
- /**
- * @dev Throws if the sender is not the owner.
- */
- function _checkOwner() internal view virtual {
- require(owner() == _msgSender(), \"Ownable: caller is not the owner\");
- }
-
- /**
- * @dev Leaves the contract without owner. It will not be possible to call
- * `onlyOwner` functions anymore. Can only be called by the current owner.
- *
- * NOTE: Renouncing ownership will leave the contract without an owner,
- * thereby removing any functionality that is only available to the owner.
- */
- function renounceOwnership() public virtual onlyOwner {
- _transferOwnership(address(0));
- }
-
- /**
- * @dev Transfers ownership of the contract to a new account (`newOwner`).
- * Can only be called by the current owner.
- */
- function transferOwnership(address newOwner) public virtual onlyOwner {
- require(newOwner != address(0), \"Ownable: new owner is the zero address\");
- _transferOwnership(newOwner);
- }
-
- /**
- * @dev Transfers ownership of the contract to a new account (`newOwner`).
- * Internal function without access restriction.
- */
- function _transferOwnership(address newOwner) internal virtual {
- address oldOwner = _owner;
- _owner = newOwner;
- emit OwnershipTransferred(oldOwner, newOwner);
- }
-}
-"},"lib/openzeppelin-contracts/contracts/utils/Context.sol":{"content":"// SPDX-License-Identifier: MIT
-// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
-
-pragma solidity ^0.8.0;
-
-/**
- * @dev Provides information about the current execution context, including the
- * sender of the transaction and its data. While these are generally available
- * via msg.sender and msg.data, they should not be accessed in such a direct
- * manner, since when dealing with meta-transactions the account sending and
- * paying for execution may not be the actual sender (as far as an application
- * is concerned).
- *
- * This contract is only required for intermediate, library-like contracts.
- */
-abstract contract Context {
- function _msgSender() internal view virtual returns (address) {
- return msg.sender;
- }
-
- function _msgData() internal view virtual returns (bytes calldata) {
- return msg.data;
- }
-}
-"},"lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol":{"content":"// SPDX-License-Identifier: MIT
-// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)
-// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
-
-pragma solidity ^0.8.0;
-
-/**
- * @dev Library for managing
- * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
- * types.
- *
- * Sets have the following properties:
- *
- * - Elements are added, removed, and checked for existence in constant time
- * (O(1)).
- * - Elements are enumerated in O(n). No guarantees are made on the ordering.
- *
- * ```
- * contract Example {
- * // Add the library methods
- * using EnumerableSet for EnumerableSet.AddressSet;
- *
- * // Declare a set state variable
- * EnumerableSet.AddressSet private mySet;
- * }
- * ```
- *
- * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
- * and `uint256` (`UintSet`) are supported.
- *
- * [WARNING]
- * ====
- * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
- * unusable.
- * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
- *
- * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
- * array of EnumerableSet.
- * ====
- */
-library EnumerableSet {
- // To implement this library for multiple types with as little code
- // repetition as possible, we write it in terms of a generic Set type with
- // bytes32 values.
- // The Set implementation uses private functions, and user-facing
- // implementations (such as AddressSet) are just wrappers around the
- // underlying Set.
- // This means that we can only create new EnumerableSets for types that fit
- // in bytes32.
-
- struct Set {
- // Storage of set values
- bytes32[] _values;
- // Position of the value in the `values` array, plus 1 because index 0
- // means a value is not in the set.
- mapping(bytes32 => uint256) _indexes;
- }
-
- /**
- * @dev Add a value to a set. O(1).
- *
- * Returns true if the value was added to the set, that is if it was not
- * already present.
- */
- function _add(Set storage set, bytes32 value) private returns (bool) {
- if (!_contains(set, value)) {
- set._values.push(value);
- // The value is stored at length-1, but we add 1 to all indexes
- // and use 0 as a sentinel value
- set._indexes[value] = set._values.length;
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * @dev Removes a value from a set. O(1).
- *
- * Returns true if the value was removed from the set, that is if it was
- * present.
- */
- function _remove(Set storage set, bytes32 value) private returns (bool) {
- // We read and store the value's index to prevent multiple reads from the same storage slot
- uint256 valueIndex = set._indexes[value];
-
- if (valueIndex != 0) {
- // Equivalent to contains(set, value)
- // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
- // the array, and then remove the last element (sometimes called as 'swap and pop').
- // This modifies the order of the array, as noted in {at}.
-
- uint256 toDeleteIndex = valueIndex - 1;
- uint256 lastIndex = set._values.length - 1;
-
- if (lastIndex != toDeleteIndex) {
- bytes32 lastValue = set._values[lastIndex];
-
- // Move the last value to the index where the value to delete is
- set._values[toDeleteIndex] = lastValue;
- // Update the index for the moved value
- set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
- }
-
- // Delete the slot where the moved value was stored
- set._values.pop();
-
- // Delete the index for the deleted slot
- delete set._indexes[value];
-
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * @dev Returns true if the value is in the set. O(1).
- */
- function _contains(Set storage set, bytes32 value) private view returns (bool) {
- return set._indexes[value] != 0;
- }
-
- /**
- * @dev Returns the number of values on the set. O(1).
- */
- function _length(Set storage set) private view returns (uint256) {
- return set._values.length;
- }
-
- /**
- * @dev Returns the value stored at position `index` in the set. O(1).
- *
- * Note that there are no guarantees on the ordering of values inside the
- * array, and it may change when more values are added or removed.
- *
- * Requirements:
- *
- * - `index` must be strictly less than {length}.
- */
- function _at(Set storage set, uint256 index) private view returns (bytes32) {
- return set._values[index];
- }
-
- /**
- * @dev Return the entire set in an array
- *
- * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- * this function has an unbounded cost, and using it as part of a state-changing function may render the function
- * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
- */
- function _values(Set storage set) private view returns (bytes32[] memory) {
- return set._values;
- }
-
- // Bytes32Set
-
- struct Bytes32Set {
- Set _inner;
- }
-
- /**
- * @dev Add a value to a set. O(1).
- *
- * Returns true if the value was added to the set, that is if it was not
- * already present.
- */
- function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
- return _add(set._inner, value);
- }
-
- /**
- * @dev Removes a value from a set. O(1).
- *
- * Returns true if the value was removed from the set, that is if it was
- * present.
- */
- function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
- return _remove(set._inner, value);
- }
-
- /**
- * @dev Returns true if the value is in the set. O(1).
- */
- function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
- return _contains(set._inner, value);
- }
-
- /**
- * @dev Returns the number of values in the set. O(1).
- */
- function length(Bytes32Set storage set) internal view returns (uint256) {
- return _length(set._inner);
- }
-
- /**
- * @dev Returns the value stored at position `index` in the set. O(1).
- *
- * Note that there are no guarantees on the ordering of values inside the
- * array, and it may change when more values are added or removed.
- *
- * Requirements:
- *
- * - `index` must be strictly less than {length}.
- */
- function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
- return _at(set._inner, index);
- }
-
- /**
- * @dev Return the entire set in an array
- *
- * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- * this function has an unbounded cost, and using it as part of a state-changing function may render the function
- * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
- */
- function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
- bytes32[] memory store = _values(set._inner);
- bytes32[] memory result;
-
- /// @solidity memory-safe-assembly
- assembly {
- result := store
- }
-
- return result;
- }
-
- // AddressSet
-
- struct AddressSet {
- Set _inner;
- }
-
- /**
- * @dev Add a value to a set. O(1).
- *
- * Returns true if the value was added to the set, that is if it was not
- * already present.
- */
- function add(AddressSet storage set, address value) internal returns (bool) {
- return _add(set._inner, bytes32(uint256(uint160(value))));
- }
-
- /**
- * @dev Removes a value from a set. O(1).
- *
- * Returns true if the value was removed from the set, that is if it was
- * present.
- */
- function remove(AddressSet storage set, address value) internal returns (bool) {
- return _remove(set._inner, bytes32(uint256(uint160(value))));
- }
-
- /**
- * @dev Returns true if the value is in the set. O(1).
- */
- function contains(AddressSet storage set, address value) internal view returns (bool) {
- return _contains(set._inner, bytes32(uint256(uint160(value))));
- }
-
- /**
- * @dev Returns the number of values in the set. O(1).
- */
- function length(AddressSet storage set) internal view returns (uint256) {
- return _length(set._inner);
- }
-
- /**
- * @dev Returns the value stored at position `index` in the set. O(1).
- *
- * Note that there are no guarantees on the ordering of values inside the
- * array, and it may change when more values are added or removed.
- *
- * Requirements:
- *
- * - `index` must be strictly less than {length}.
- */
- function at(AddressSet storage set, uint256 index) internal view returns (address) {
- return address(uint160(uint256(_at(set._inner, index))));
- }
-
- /**
- * @dev Return the entire set in an array
- *
- * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- * this function has an unbounded cost, and using it as part of a state-changing function may render the function
- * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
- */
- function values(AddressSet storage set) internal view returns (address[] memory) {
- bytes32[] memory store = _values(set._inner);
- address[] memory result;
-
- /// @solidity memory-safe-assembly
- assembly {
- result := store
- }
-
- return result;
- }
-
- // UintSet
-
- struct UintSet {
- Set _inner;
- }
-
- /**
- * @dev Add a value to a set. O(1).
- *
- * Returns true if the value was added to the set, that is if it was not
- * already present.
- */
- function add(UintSet storage set, uint256 value) internal returns (bool) {
- return _add(set._inner, bytes32(value));
- }
-
- /**
- * @dev Removes a value from a set. O(1).
- *
- * Returns true if the value was removed from the set, that is if it was
- * present.
- */
- function remove(UintSet storage set, uint256 value) internal returns (bool) {
- return _remove(set._inner, bytes32(value));
- }
-
- /**
- * @dev Returns true if the value is in the set. O(1).
- */
- function contains(UintSet storage set, uint256 value) internal view returns (bool) {
- return _contains(set._inner, bytes32(value));
- }
-
- /**
- * @dev Returns the number of values in the set. O(1).
- */
- function length(UintSet storage set) internal view returns (uint256) {
- return _length(set._inner);
- }
-
- /**
- * @dev Returns the value stored at position `index` in the set. O(1).
- *
- * Note that there are no guarantees on the ordering of values inside the
- * array, and it may change when more values are added or removed.
- *
- * Requirements:
- *
- * - `index` must be strictly less than {length}.
- */
- function at(UintSet storage set, uint256 index) internal view returns (uint256) {
- return uint256(_at(set._inner, index));
- }
-
- /**
- * @dev Return the entire set in an array
- *
- * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
- * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
- * this function has an unbounded cost, and using it as part of a state-changing function may render the function
- * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
- */
- function values(UintSet storage set) internal view returns (uint256[] memory) {
- bytes32[] memory store = _values(set._inner);
- uint256[] memory result;
-
- /// @solidity memory-safe-assembly
- assembly {
- result := store
- }
-
- return result;
- }
-}
-"},"src/IOperatorFilterRegistry.sol":{"content":"// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {EnumerableSet} from \"openzeppelin-contracts/utils/structs/EnumerableSet.sol\";
-
-interface IOperatorFilterRegistry {
- function isOperatorAllowed(address registrant, address operator) external returns (bool);
- function register(address registrant) external;
- function registerAndSubscribe(address registrant, address subscription) external;
- function registerAndCopyEntries(address registrant, address registrantToCopy) external;
- function updateOperator(address registrant, address operator, bool filtered) external;
- function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
- function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
- function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
- function subscribe(address registrant, address registrantToSubscribe) external;
- function unsubscribe(address registrant, bool copyExistingEntries) external;
- function subscriptionOf(address addr) external returns (address registrant);
- function subscribers(address registrant) external returns (address[] memory);
- function subscriberAt(address registrant, uint256 index) external returns (address);
- function copyEntriesOf(address registrant, address registrantToCopy) external;
- function isOperatorFiltered(address registrant, address operator) external returns (bool);
- function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
- function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
- function filteredOperators(address addr) external returns (address[] memory);
- function filteredCodeHashes(address addr) external returns (bytes32[] memory);
- function filteredOperatorAt(address registrant, uint256 index) external returns (address);
- function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
- function isRegistered(address addr) external returns (bool);
- function codeHashOf(address addr) external returns (bytes32);
-}
-"},"src/OperatorFilterRegistry.sol":{"content":"// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {IOperatorFilterRegistry} from \"./IOperatorFilterRegistry.sol\";
-import {Ownable} from \"openzeppelin-contracts/access/Ownable.sol\";
-import {EnumerableSet} from \"openzeppelin-contracts/utils/structs/EnumerableSet.sol\";
-import {OperatorFilterRegistryErrorsAndEvents} from \"./OperatorFilterRegistryErrorsAndEvents.sol\";
-
-/**
- * @title OperatorFilterRegistry
- * @notice Borrows heavily from the QQL BlacklistOperatorFilter contract:
- * https://github.com/qql-art/contracts/blob/main/contracts/BlacklistOperatorFilter.sol
- * @notice This contracts allows tokens or token owners to register specific addresses or codeHashes that may be
- * * restricted according to the isOperatorAllowed function.
- */
-contract OperatorFilterRegistry is IOperatorFilterRegistry, OperatorFilterRegistryErrorsAndEvents {
- using EnumerableSet for EnumerableSet.AddressSet;
- using EnumerableSet for EnumerableSet.Bytes32Set;
-
- /// @dev initialized accounts have a nonzero codehash (see https://eips.ethereum.org/EIPS/eip-1052)
- /// Note that this will also be a smart contract's codehash when making calls from its constructor.
- bytes32 constant EOA_CODEHASH = keccak256(\"\");
-
- mapping(address => EnumerableSet.AddressSet) private _filteredOperators;
- mapping(address => EnumerableSet.Bytes32Set) private _filteredCodeHashes;
- mapping(address => address) private _registrations;
- mapping(address => EnumerableSet.AddressSet) private _subscribers;
-
- /**
- * @notice restricts method caller to the address or EIP-173 \"owner()\"
- */
- modifier onlyAddressOrOwner(address addr) {
- if (msg.sender != addr) {
- try Ownable(addr).owner() returns (address owner) {
- if (msg.sender != owner) {
- revert OnlyAddressOrOwner();
- }
- } catch (bytes memory reason) {
- if (reason.length == 0) {
- revert NotOwnable();
- } else {
- /// @solidity memory-safe-assembly
- assembly {
- revert(add(32, reason), mload(reason))
- }
- }
- }
- }
- _;
- }
-
- /**
- * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns
- * true if supplied registrant address is not registered.
- */
- function isOperatorAllowed(address registrant, address operator) external view returns (bool) {
- address registration = _registrations[registrant];
- if (registration != address(0)) {
- EnumerableSet.AddressSet storage filteredOperatorsRef;
- EnumerableSet.Bytes32Set storage filteredCodeHashesRef;
-
- filteredOperatorsRef = _filteredOperators[registration];
- filteredCodeHashesRef = _filteredCodeHashes[registration];
-
- if (filteredOperatorsRef.contains(operator)) {
- revert AddressFiltered(operator);
- }
- if (operator.code.length > 0) {
- bytes32 codeHash = operator.codehash;
- if (filteredCodeHashesRef.contains(codeHash)) {
- revert CodeHashFiltered(operator, codeHash);
- }
- }
- }
- return true;
- }
-
- //////////////////
- // AUTH METHODS //
- //////////////////
-
- /**
- * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.
- */
- function register(address registrant) external onlyAddressOrOwner(registrant) {
- if (_registrations[registrant] != address(0)) {
- revert AlreadyRegistered();
- }
- _registrations[registrant] = registrant;
- emit RegistrationUpdated(registrant, true);
- }
-
- /**
- * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.
- * Note that this does not remove any filtered addresses or codeHashes.
- * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.
- */
- function unregister(address registrant) external onlyAddressOrOwner(registrant) {
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- _subscribers[registration].remove(registrant);
- emit SubscriptionUpdated(registrant, registration, false);
- }
- _registrations[registrant] = address(0);
- emit RegistrationUpdated(registrant, false);
- }
-
- /**
- * @notice Registers an address with the registry and \"subscribes\" to another address's filtered operators and codeHashes.
- */
- function registerAndSubscribe(address registrant, address subscription) external onlyAddressOrOwner(registrant) {
- address registration = _registrations[registrant];
- if (registration != address(0)) {
- revert AlreadyRegistered();
- }
- if (registrant == subscription) {
- revert CannotSubscribeToSelf();
- }
- address subscriptionRegistration = _registrations[subscription];
- if (subscriptionRegistration == address(0)) {
- revert NotRegistered(subscription);
- }
- if (subscriptionRegistration != subscription) {
- revert CannotSubscribeToRegistrantWithSubscription(subscription);
- }
-
- _registrations[registrant] = subscription;
- _subscribers[subscription].add(registrant);
- emit RegistrationUpdated(registrant, true);
- emit SubscriptionUpdated(registrant, subscription, true);
- }
-
- /**
- * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another
- * address without subscribing.
- */
- function registerAndCopyEntries(address registrant, address registrantToCopy)
- external
- onlyAddressOrOwner(registrant)
- {
- if (registrantToCopy == registrant) {
- revert CannotCopyFromSelf();
- }
- address registration = _registrations[registrant];
- if (registration != address(0)) {
- revert AlreadyRegistered();
- }
- address registrantRegistration = _registrations[registrantToCopy];
- if (registrantRegistration == address(0)) {
- revert NotRegistered(registrantToCopy);
- }
- _registrations[registrant] = registrant;
- emit RegistrationUpdated(registrant, true);
- _copyEntries(registrant, registrantToCopy);
- }
-
- /**
- * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.
- */
- function updateOperator(address registrant, address operator, bool filtered)
- external
- onlyAddressOrOwner(registrant)
- {
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- revert CannotUpdateWhileSubscribed(registration);
- }
- EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrant];
-
- if (!filtered) {
- bool removed = filteredOperatorsRef.remove(operator);
- if (!removed) {
- revert AddressNotFiltered(operator);
- }
- } else {
- bool added = filteredOperatorsRef.add(operator);
- if (!added) {
- revert AddressAlreadyFiltered(operator);
- }
- }
- emit OperatorUpdated(registrant, operator, filtered);
- }
-
- /**
- * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.
- */
- function updateCodeHash(address registrant, bytes32 codeHash, bool filtered)
- external
- onlyAddressOrOwner(registrant)
- {
- if (codeHash == EOA_CODEHASH) {
- revert CannotFilterEOAs();
- }
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- revert CannotUpdateWhileSubscribed(registration);
- }
- EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrant];
-
- if (!filtered) {
- bool removed = filteredCodeHashesRef.remove(codeHash);
- if (!removed) {
- revert CodeHashNotFiltered(codeHash);
- }
- } else {
- bool added = filteredCodeHashesRef.add(codeHash);
- if (!added) {
- revert CodeHashAlreadyFiltered(codeHash);
- }
- }
- emit CodeHashUpdated(registrant, codeHash, filtered);
- }
-
- /**
- * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.
- */
- function updateOperators(address registrant, address[] calldata operators, bool filtered)
- external
- onlyAddressOrOwner(registrant)
- {
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- revert CannotUpdateWhileSubscribed(registration);
- }
- EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrant];
- uint256 operatorsLength = operators.length;
- unchecked {
- if (!filtered) {
- for (uint256 i = 0; i < operatorsLength; ++i) {
- address operator = operators[i];
- bool removed = filteredOperatorsRef.remove(operator);
- if (!removed) {
- revert AddressNotFiltered(operator);
- }
- }
- } else {
- for (uint256 i = 0; i < operatorsLength; ++i) {
- address operator = operators[i];
- bool added = filteredOperatorsRef.add(operator);
- if (!added) {
- revert AddressAlreadyFiltered(operator);
- }
- }
- }
- }
- emit OperatorsUpdated(registrant, operators, filtered);
- }
-
- /**
- * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.
- */
- function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered)
- external
- onlyAddressOrOwner(registrant)
- {
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- revert CannotUpdateWhileSubscribed(registration);
- }
- EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrant];
- uint256 codeHashesLength = codeHashes.length;
- unchecked {
- if (!filtered) {
- for (uint256 i = 0; i < codeHashesLength; ++i) {
- bytes32 codeHash = codeHashes[i];
- bool removed = filteredCodeHashesRef.remove(codeHash);
- if (!removed) {
- revert CodeHashNotFiltered(codeHash);
- }
- }
- } else {
- for (uint256 i = 0; i < codeHashesLength; ++i) {
- bytes32 codeHash = codeHashes[i];
- if (codeHash == EOA_CODEHASH) {
- revert CannotFilterEOAs();
- }
- bool added = filteredCodeHashesRef.add(codeHash);
- if (!added) {
- revert CodeHashAlreadyFiltered(codeHash);
- }
- }
- }
- }
- emit CodeHashesUpdated(registrant, codeHashes, filtered);
- }
-
- /**
- * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous
- * subscription if present.
- * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,
- * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be
- * used.
- */
- function subscribe(address registrant, address newSubscription) external onlyAddressOrOwner(registrant) {
- if (registrant == newSubscription) {
- revert CannotSubscribeToSelf();
- }
- if (newSubscription == address(0)) {
- revert CannotSubscribeToZeroAddress();
- }
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration == newSubscription) {
- revert AlreadySubscribed(newSubscription);
- }
- address newSubscriptionRegistration = _registrations[newSubscription];
- if (newSubscriptionRegistration == address(0)) {
- revert NotRegistered(newSubscription);
- }
- if (newSubscriptionRegistration != newSubscription) {
- revert CannotSubscribeToRegistrantWithSubscription(newSubscription);
- }
-
- if (registration != registrant) {
- _subscribers[registration].remove(registrant);
- emit SubscriptionUpdated(registrant, registration, false);
- }
- _registrations[registrant] = newSubscription;
- _subscribers[newSubscription].add(registrant);
- emit SubscriptionUpdated(registrant, newSubscription, true);
- }
-
- /**
- * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.
- */
- function unsubscribe(address registrant, bool copyExistingEntries) external onlyAddressOrOwner(registrant) {
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration == registrant) {
- revert NotSubscribed();
- }
- _subscribers[registration].remove(registrant);
- _registrations[registrant] = registrant;
- emit SubscriptionUpdated(registrant, registration, false);
- if (copyExistingEntries) {
- _copyEntries(registrant, registration);
- }
- }
-
- /**
- * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.
- */
- function copyEntriesOf(address registrant, address registrantToCopy) external onlyAddressOrOwner(registrant) {
- if (registrant == registrantToCopy) {
- revert CannotCopyFromSelf();
- }
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- revert CannotUpdateWhileSubscribed(registration);
- }
- address registrantRegistration = _registrations[registrantToCopy];
- if (registrantRegistration == address(0)) {
- revert NotRegistered(registrantToCopy);
- }
- _copyEntries(registrant, registrantToCopy);
- }
-
- /// @dev helper to copy entries from registrantToCopy to registrant and emit events
- function _copyEntries(address registrant, address registrantToCopy) private {
- EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrantToCopy];
- EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrantToCopy];
- uint256 filteredOperatorsLength = filteredOperatorsRef.length();
- uint256 filteredCodeHashesLength = filteredCodeHashesRef.length();
- unchecked {
- for (uint256 i = 0; i < filteredOperatorsLength; ++i) {
- address operator = filteredOperatorsRef.at(i);
- bool added = _filteredOperators[registrant].add(operator);
- if (added) {
- emit OperatorUpdated(registrant, operator, true);
- }
- }
- for (uint256 i = 0; i < filteredCodeHashesLength; ++i) {
- bytes32 codehash = filteredCodeHashesRef.at(i);
- bool added = _filteredCodeHashes[registrant].add(codehash);
- if (added) {
- emit CodeHashUpdated(registrant, codehash, true);
- }
- }
- }
- }
-
- //////////////////
- // VIEW METHODS //
- //////////////////
-
- /**
- * @notice Get the subscription address of a given registrant, if any.
- */
- function subscriptionOf(address registrant) external view returns (address subscription) {
- subscription = _registrations[registrant];
- if (subscription == address(0)) {
- revert NotRegistered(registrant);
- } else if (subscription == registrant) {
- subscription = address(0);
- }
- }
-
- /**
- * @notice Get the set of addresses subscribed to a given registrant.
- * Note that order is not guaranteed as updates are made.
- */
- function subscribers(address registrant) external view returns (address[] memory) {
- return _subscribers[registrant].values();
- }
-
- /**
- * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.
- * Note that order is not guaranteed as updates are made.
- */
- function subscriberAt(address registrant, uint256 index) external view returns (address) {
- return _subscribers[registrant].at(index);
- }
-
- /**
- * @notice Returns true if operator is filtered by a given address or its subscription.
- */
- function isOperatorFiltered(address registrant, address operator) external view returns (bool) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredOperators[registration].contains(operator);
- }
- return _filteredOperators[registrant].contains(operator);
- }
-
- /**
- * @notice Returns true if a codeHash is filtered by a given address or its subscription.
- */
- function isCodeHashFiltered(address registrant, bytes32 codeHash) external view returns (bool) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredCodeHashes[registration].contains(codeHash);
- }
- return _filteredCodeHashes[registrant].contains(codeHash);
- }
-
- /**
- * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.
- */
- function isCodeHashOfFiltered(address registrant, address operatorWithCode) external view returns (bool) {
- bytes32 codeHash = operatorWithCode.codehash;
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredCodeHashes[registration].contains(codeHash);
- }
- return _filteredCodeHashes[registrant].contains(codeHash);
- }
-
- /**
- * @notice Returns true if an address has registered
- */
- function isRegistered(address registrant) external view returns (bool) {
- return _registrations[registrant] != address(0);
- }
-
- /**
- * @notice Returns a list of filtered operators for a given address or its subscription.
- */
- function filteredOperators(address registrant) external view returns (address[] memory) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredOperators[registration].values();
- }
- return _filteredOperators[registrant].values();
- }
-
- /**
- * @notice Returns the set of filtered codeHashes for a given address or its subscription.
- * Note that order is not guaranteed as updates are made.
- */
- function filteredCodeHashes(address registrant) external view returns (bytes32[] memory) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredCodeHashes[registration].values();
- }
- return _filteredCodeHashes[registrant].values();
- }
-
- /**
- * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or
- * its subscription.
- * Note that order is not guaranteed as updates are made.
- */
- function filteredOperatorAt(address registrant, uint256 index) external view returns (address) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredOperators[registration].at(index);
- }
- return _filteredOperators[registrant].at(index);
- }
-
- /**
- * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or
- * its subscription.
- * Note that order is not guaranteed as updates are made.
- */
- function filteredCodeHashAt(address registrant, uint256 index) external view returns (bytes32) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredCodeHashes[registration].at(index);
- }
- return _filteredCodeHashes[registrant].at(index);
- }
-
- /// @dev Convenience method to compute the code hash of an arbitrary contract
- function codeHashOf(address a) external view returns (bytes32) {
- return a.codehash;
- }
-}
-"},"src/OperatorFilterRegistryErrorsAndEvents.sol":{"content":"// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-contract OperatorFilterRegistryErrorsAndEvents {
- error CannotFilterEOAs();
- error AddressAlreadyFiltered(address operator);
- error AddressNotFiltered(address operator);
- error CodeHashAlreadyFiltered(bytes32 codeHash);
- error CodeHashNotFiltered(bytes32 codeHash);
- error OnlyAddressOrOwner();
- error NotRegistered(address registrant);
- error AlreadyRegistered();
- error AlreadySubscribed(address subscription);
- error NotSubscribed();
- error CannotUpdateWhileSubscribed(address subscription);
- error CannotSubscribeToSelf();
- error CannotSubscribeToZeroAddress();
- error NotOwnable();
- error AddressFiltered(address filtered);
- error CodeHashFiltered(address account, bytes32 codeHash);
- error CannotSubscribeToRegistrantWithSubscription(address registrant);
- error CannotCopyFromSelf();
-
- event RegistrationUpdated(address indexed registrant, bool indexed registered);
- event OperatorUpdated(address indexed registrant, address indexed operator, bool indexed filtered);
- event OperatorsUpdated(address indexed registrant, address[] operators, bool indexed filtered);
- event CodeHashUpdated(address indexed registrant, bytes32 indexed codeHash, bool indexed filtered);
- event CodeHashesUpdated(address indexed registrant, bytes32[] codeHashes, bool indexed filtered);
- event SubscriptionUpdated(address indexed registrant, address indexed subscription, bool indexed subscribed);
-}"}},"settings":{"remappings":["ds-test/=lib/forge-std/lib/ds-test/src/","forge-std/=lib/forge-std/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/","solmate/=lib/solmate/src/"],"optimizer":{"enabled":true,"runs":1000000},"metadata":{"bytecodeHash":"ipfs"},"outputSelection":{"*":{"":["ast"],"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"london","libraries":{}}}
\ No newline at end of file
diff --git a/script/verification/OwnedRegistrantStandardJsonInput.json b/script/verification/OwnedRegistrantStandardJsonInput.json
deleted file mode 100644
index 1f9a4a5..0000000
--- a/script/verification/OwnedRegistrantStandardJsonInput.json
+++ /dev/null
@@ -1 +0,0 @@
-{"language":"Solidity","sources":{"lib/openzeppelin-contracts/contracts/access/Ownable.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"},"lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() external {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n"},"lib/openzeppelin-contracts/contracts/utils/Context.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"},"lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n"},"src/IOperatorFilterRegistry.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {EnumerableSet} from \"openzeppelin-contracts/utils/structs/EnumerableSet.sol\";\n\ninterface IOperatorFilterRegistry {\n function isOperatorAllowed(address registrant, address operator) external returns (bool);\n function register(address registrant) external;\n function registerAndSubscribe(address registrant, address subscription) external;\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n function updateOperator(address registrant, address operator, bool filtered) external;\n function updateOperators(address registrant, address[] calldata operators, bool filtered) external;\n function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;\n function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;\n function subscribe(address registrant, address registrantToSubscribe) external;\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n function subscriptionOf(address addr) external returns (address registrant);\n function subscribers(address registrant) external returns (address[] memory);\n function subscriberAt(address registrant, uint256 index) external returns (address);\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n function filteredOperators(address addr) external returns (address[] memory);\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n function isRegistered(address addr) external returns (bool);\n function codeHashOf(address addr) external returns (bytes32);\n}\n"},"src/OwnedRegistrant.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {IOperatorFilterRegistry} from \"./IOperatorFilterRegistry.sol\";\nimport {Ownable2Step} from \"openzeppelin-contracts/access/Ownable2Step.sol\";\n\n/**\n * @title OwnedRegistrant\n * @notice Ownable contract that registers itself with the OperatorFilterRegistry and administers its own entries,\n * to facilitate a subscription whose ownership can be transferred.\n */\ncontract OwnedRegistrant is Ownable2Step {\n address constant registry = 0x000000000000AAeB6D7670E522A718067333cd4E;\n\n constructor(address _owner) {\n IOperatorFilterRegistry(registry).register(address(this));\n transferOwnership(_owner);\n }\n}\n"}},"settings":{"remappings":["ds-test/=lib/forge-std/lib/ds-test/src/","forge-std/=lib/forge-std/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/","solmate/=lib/solmate/src/"],"optimizer":{"enabled":true,"runs":1000000},"metadata":{"bytecodeHash":"ipfs"},"outputSelection":{"*":{"":["ast"],"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"evmVersion":"london","libraries":{}}}
diff --git a/script/verification/README.md b/script/verification/README.md
deleted file mode 100644
index 21dab6f..0000000
--- a/script/verification/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Verifying OperatorFilterRegistry and OwnedRegistrant
-
-To verify the contracts deployed by the scripts, when verifying on (e.g.) Etherscan, select "Solidity (Standard-Json-Input)" for Compiler Type, and MIT for license.
-
-Then, select and upload the relevant JSON file.
\ No newline at end of file
diff --git a/src/DefaultOperatorFilterer.sol b/src/DefaultOperatorFilterer.sol
deleted file mode 100644
index 58c0df9..0000000
--- a/src/DefaultOperatorFilterer.sol
+++ /dev/null
@@ -1,17 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OperatorFilterer} from "./OperatorFilterer.sol";
-import {CANONICAL_CORI_SUBSCRIPTION} from "./lib/Constants.sol";
-/**
- * @title DefaultOperatorFilterer
- * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription.
- * @dev Please note that if your token contract does not provide an owner with EIP-173, it must provide
- * administration methods on the contract itself to interact with the registry otherwise the subscription
- * will be locked to the options set during construction.
- */
-
-abstract contract DefaultOperatorFilterer is OperatorFilterer {
- /// @dev The constructor that is called when the contract is being deployed.
- constructor() OperatorFilterer(CANONICAL_CORI_SUBSCRIPTION, true) {}
-}
diff --git a/src/IOperatorFilterRegistry.sol b/src/IOperatorFilterRegistry.sol
deleted file mode 100644
index 8cc4984..0000000
--- a/src/IOperatorFilterRegistry.sol
+++ /dev/null
@@ -1,139 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-interface IOperatorFilterRegistry {
- /**
- * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns
- * true if supplied registrant address is not registered.
- */
- function isOperatorAllowed(address registrant, address operator) external view returns (bool);
-
- /**
- * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.
- */
- function register(address registrant) external;
-
- /**
- * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes.
- */
- function registerAndSubscribe(address registrant, address subscription) external;
-
- /**
- * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another
- * address without subscribing.
- */
- function registerAndCopyEntries(address registrant, address registrantToCopy) external;
-
- /**
- * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.
- * Note that this does not remove any filtered addresses or codeHashes.
- * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.
- */
- function unregister(address addr) external;
-
- /**
- * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.
- */
- function updateOperator(address registrant, address operator, bool filtered) external;
-
- /**
- * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.
- */
- function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
-
- /**
- * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.
- */
- function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
-
- /**
- * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.
- */
- function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
-
- /**
- * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous
- * subscription if present.
- * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,
- * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be
- * used.
- */
- function subscribe(address registrant, address registrantToSubscribe) external;
-
- /**
- * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.
- */
- function unsubscribe(address registrant, bool copyExistingEntries) external;
-
- /**
- * @notice Get the subscription address of a given registrant, if any.
- */
- function subscriptionOf(address addr) external returns (address registrant);
-
- /**
- * @notice Get the set of addresses subscribed to a given registrant.
- * Note that order is not guaranteed as updates are made.
- */
- function subscribers(address registrant) external returns (address[] memory);
-
- /**
- * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.
- * Note that order is not guaranteed as updates are made.
- */
- function subscriberAt(address registrant, uint256 index) external returns (address);
-
- /**
- * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.
- */
- function copyEntriesOf(address registrant, address registrantToCopy) external;
-
- /**
- * @notice Returns true if operator is filtered by a given address or its subscription.
- */
- function isOperatorFiltered(address registrant, address operator) external returns (bool);
-
- /**
- * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.
- */
- function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
-
- /**
- * @notice Returns true if a codeHash is filtered by a given address or its subscription.
- */
- function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
-
- /**
- * @notice Returns a list of filtered operators for a given address or its subscription.
- */
- function filteredOperators(address addr) external returns (address[] memory);
-
- /**
- * @notice Returns the set of filtered codeHashes for a given address or its subscription.
- * Note that order is not guaranteed as updates are made.
- */
- function filteredCodeHashes(address addr) external returns (bytes32[] memory);
-
- /**
- * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or
- * its subscription.
- * Note that order is not guaranteed as updates are made.
- */
- function filteredOperatorAt(address registrant, uint256 index) external returns (address);
-
- /**
- * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or
- * its subscription.
- * Note that order is not guaranteed as updates are made.
- */
- function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
-
- /**
- * @notice Returns true if an address has registered
- */
- function isRegistered(address addr) external returns (bool);
-
- /**
- * @dev Convenience method to compute the code hash of an arbitrary contract
- */
- function codeHashOf(address addr) external returns (bytes32);
-}
diff --git a/src/OperatorFilterRegistry.sol b/src/OperatorFilterRegistry.sol
deleted file mode 100644
index a279697..0000000
--- a/src/OperatorFilterRegistry.sol
+++ /dev/null
@@ -1,560 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
-import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
-import {EnumerableSet} from "openzeppelin-contracts/utils/structs/EnumerableSet.sol";
-import {OperatorFilterRegistryErrorsAndEvents} from "./OperatorFilterRegistryErrorsAndEvents.sol";
-
-/**
- * @title OperatorFilterRegistry
- * @notice Borrows heavily from the QQL BlacklistOperatorFilter contract:
- * https://github.com/qql-art/contracts/blob/main/contracts/BlacklistOperatorFilter.sol
- * @notice This contracts allows tokens or token owners to register specific addresses or codeHashes that may be
- * * restricted according to the isOperatorAllowed function.
- */
-contract OperatorFilterRegistry is IOperatorFilterRegistry, OperatorFilterRegistryErrorsAndEvents {
- using EnumerableSet for EnumerableSet.AddressSet;
- using EnumerableSet for EnumerableSet.Bytes32Set;
-
- /// @dev initialized accounts have a nonzero codehash (see https://eips.ethereum.org/EIPS/eip-1052)
- /// Note that this will also be a smart contract's codehash when making calls from its constructor.
- bytes32 constant EOA_CODEHASH = keccak256("");
-
- mapping(address => EnumerableSet.AddressSet) private _filteredOperators;
- mapping(address => EnumerableSet.Bytes32Set) private _filteredCodeHashes;
- mapping(address => address) private _registrations;
- mapping(address => EnumerableSet.AddressSet) private _subscribers;
-
- /**
- * @notice Restricts method caller to the address or EIP-173 "owner()"
- */
- modifier onlyAddressOrOwner(address addr) {
- if (msg.sender != addr) {
- try Ownable(addr).owner() returns (address owner) {
- if (msg.sender != owner) {
- revert OnlyAddressOrOwner();
- }
- } catch (bytes memory reason) {
- if (reason.length == 0) {
- revert NotOwnable();
- } else {
- /// @solidity memory-safe-assembly
- assembly {
- revert(add(32, reason), mload(reason))
- }
- }
- }
- }
- _;
- }
-
- /**
- * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns
- * true if supplied registrant address is not registered.
- * Note that this method will *revert* if an operator or its codehash is filtered with an error that is
- * more informational than a false boolean, so smart contracts that query this method for informational
- * purposes will need to wrap in a try/catch or perform a low-level staticcall in order to handle the case
- * that an operator is filtered.
- */
- function isOperatorAllowed(address registrant, address operator) external view returns (bool) {
- address registration = _registrations[registrant];
- if (registration != address(0)) {
- EnumerableSet.AddressSet storage filteredOperatorsRef;
- EnumerableSet.Bytes32Set storage filteredCodeHashesRef;
-
- filteredOperatorsRef = _filteredOperators[registration];
- filteredCodeHashesRef = _filteredCodeHashes[registration];
-
- if (filteredOperatorsRef.contains(operator)) {
- revert AddressFiltered(operator);
- }
- if (operator.code.length > 0) {
- bytes32 codeHash = operator.codehash;
- if (filteredCodeHashesRef.contains(codeHash)) {
- revert CodeHashFiltered(operator, codeHash);
- }
- }
- }
- return true;
- }
-
- //////////////////
- // AUTH METHODS //
- //////////////////
-
- /**
- * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.
- */
- function register(address registrant) external onlyAddressOrOwner(registrant) {
- if (_registrations[registrant] != address(0)) {
- revert AlreadyRegistered();
- }
- _registrations[registrant] = registrant;
- emit RegistrationUpdated(registrant, true);
- }
-
- /**
- * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.
- * Note that this does not remove any filtered addresses or codeHashes.
- * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.
- */
- function unregister(address registrant) external onlyAddressOrOwner(registrant) {
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- _subscribers[registration].remove(registrant);
- emit SubscriptionUpdated(registrant, registration, false);
- }
- _registrations[registrant] = address(0);
- emit RegistrationUpdated(registrant, false);
- }
-
- /**
- * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes.
- */
- function registerAndSubscribe(address registrant, address subscription) external onlyAddressOrOwner(registrant) {
- address registration = _registrations[registrant];
- if (registration != address(0)) {
- revert AlreadyRegistered();
- }
- if (registrant == subscription) {
- revert CannotSubscribeToSelf();
- }
- address subscriptionRegistration = _registrations[subscription];
- if (subscriptionRegistration == address(0)) {
- revert NotRegistered(subscription);
- }
- if (subscriptionRegistration != subscription) {
- revert CannotSubscribeToRegistrantWithSubscription(subscription);
- }
-
- _registrations[registrant] = subscription;
- _subscribers[subscription].add(registrant);
- emit RegistrationUpdated(registrant, true);
- emit SubscriptionUpdated(registrant, subscription, true);
- }
-
- /**
- * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another
- * address without subscribing.
- */
- function registerAndCopyEntries(address registrant, address registrantToCopy)
- external
- onlyAddressOrOwner(registrant)
- {
- if (registrantToCopy == registrant) {
- revert CannotCopyFromSelf();
- }
- address registration = _registrations[registrant];
- if (registration != address(0)) {
- revert AlreadyRegistered();
- }
- address registrantRegistration = _registrations[registrantToCopy];
- if (registrantRegistration == address(0)) {
- revert NotRegistered(registrantToCopy);
- }
- _registrations[registrant] = registrant;
- emit RegistrationUpdated(registrant, true);
- _copyEntries(registrant, registrantToCopy);
- }
-
- /**
- * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.
- */
- function updateOperator(address registrant, address operator, bool filtered)
- external
- onlyAddressOrOwner(registrant)
- {
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- revert CannotUpdateWhileSubscribed(registration);
- }
- EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrant];
-
- if (!filtered) {
- bool removed = filteredOperatorsRef.remove(operator);
- if (!removed) {
- revert AddressNotFiltered(operator);
- }
- } else {
- bool added = filteredOperatorsRef.add(operator);
- if (!added) {
- revert AddressAlreadyFiltered(operator);
- }
- }
- emit OperatorUpdated(registrant, operator, filtered);
- }
-
- /**
- * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.
- * Note that this will allow adding the bytes32(0) codehash, which could result in unexpected behavior,
- * since calling `isCodeHashFiltered` will return true for bytes32(0), which is the codeHash of any
- * un-initialized account. Since un-initialized accounts have no code, the registry will not validate
- * that an un-initalized account's codeHash is not filtered. By the time an account is able to
- * act as an operator (an account is initialized or a smart contract exclusively in the context of its
- * constructor), it will have a codeHash of EOA_CODEHASH, which cannot be filtered.
- */
- function updateCodeHash(address registrant, bytes32 codeHash, bool filtered)
- external
- onlyAddressOrOwner(registrant)
- {
- if (codeHash == EOA_CODEHASH) {
- revert CannotFilterEOAs();
- }
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- revert CannotUpdateWhileSubscribed(registration);
- }
- EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrant];
-
- if (!filtered) {
- bool removed = filteredCodeHashesRef.remove(codeHash);
- if (!removed) {
- revert CodeHashNotFiltered(codeHash);
- }
- } else {
- bool added = filteredCodeHashesRef.add(codeHash);
- if (!added) {
- revert CodeHashAlreadyFiltered(codeHash);
- }
- }
- emit CodeHashUpdated(registrant, codeHash, filtered);
- }
-
- /**
- * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.
- */
- function updateOperators(address registrant, address[] calldata operators, bool filtered)
- external
- onlyAddressOrOwner(registrant)
- {
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- revert CannotUpdateWhileSubscribed(registration);
- }
- EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrant];
- uint256 operatorsLength = operators.length;
- if (!filtered) {
- for (uint256 i = 0; i < operatorsLength;) {
- address operator = operators[i];
- bool removed = filteredOperatorsRef.remove(operator);
- if (!removed) {
- revert AddressNotFiltered(operator);
- }
- unchecked {
- ++i;
- }
- }
- } else {
- for (uint256 i = 0; i < operatorsLength;) {
- address operator = operators[i];
- bool added = filteredOperatorsRef.add(operator);
- if (!added) {
- revert AddressAlreadyFiltered(operator);
- }
- unchecked {
- ++i;
- }
- }
- }
- emit OperatorsUpdated(registrant, operators, filtered);
- }
-
- /**
- * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.
- * Note that this will allow adding the bytes32(0) codehash, which could result in unexpected behavior,
- * since calling `isCodeHashFiltered` will return true for bytes32(0), which is the codeHash of any
- * un-initialized account. Since un-initialized accounts have no code, the registry will not validate
- * that an un-initalized account's codeHash is not filtered. By the time an account is able to
- * act as an operator (an account is initialized or a smart contract exclusively in the context of its
- * constructor), it will have a codeHash of EOA_CODEHASH, which cannot be filtered.
- */
- function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered)
- external
- onlyAddressOrOwner(registrant)
- {
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- revert CannotUpdateWhileSubscribed(registration);
- }
- EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrant];
- uint256 codeHashesLength = codeHashes.length;
- if (!filtered) {
- for (uint256 i = 0; i < codeHashesLength;) {
- bytes32 codeHash = codeHashes[i];
- bool removed = filteredCodeHashesRef.remove(codeHash);
- if (!removed) {
- revert CodeHashNotFiltered(codeHash);
- }
- unchecked {
- ++i;
- }
- }
- } else {
- for (uint256 i = 0; i < codeHashesLength;) {
- bytes32 codeHash = codeHashes[i];
- if (codeHash == EOA_CODEHASH) {
- revert CannotFilterEOAs();
- }
- bool added = filteredCodeHashesRef.add(codeHash);
- if (!added) {
- revert CodeHashAlreadyFiltered(codeHash);
- }
- unchecked {
- ++i;
- }
- }
- }
- emit CodeHashesUpdated(registrant, codeHashes, filtered);
- }
-
- /**
- * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous
- * subscription if present.
- * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,
- * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be
- * used.
- */
- function subscribe(address registrant, address newSubscription) external onlyAddressOrOwner(registrant) {
- if (registrant == newSubscription) {
- revert CannotSubscribeToSelf();
- }
- if (newSubscription == address(0)) {
- revert CannotSubscribeToZeroAddress();
- }
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration == newSubscription) {
- revert AlreadySubscribed(newSubscription);
- }
- address newSubscriptionRegistration = _registrations[newSubscription];
- if (newSubscriptionRegistration == address(0)) {
- revert NotRegistered(newSubscription);
- }
- if (newSubscriptionRegistration != newSubscription) {
- revert CannotSubscribeToRegistrantWithSubscription(newSubscription);
- }
-
- if (registration != registrant) {
- _subscribers[registration].remove(registrant);
- emit SubscriptionUpdated(registrant, registration, false);
- }
- _registrations[registrant] = newSubscription;
- _subscribers[newSubscription].add(registrant);
- emit SubscriptionUpdated(registrant, newSubscription, true);
- }
-
- /**
- * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.
- */
- function unsubscribe(address registrant, bool copyExistingEntries) external onlyAddressOrOwner(registrant) {
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration == registrant) {
- revert NotSubscribed();
- }
- _subscribers[registration].remove(registrant);
- _registrations[registrant] = registrant;
- emit SubscriptionUpdated(registrant, registration, false);
- if (copyExistingEntries) {
- _copyEntries(registrant, registration);
- }
- }
-
- /**
- * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.
- */
- function copyEntriesOf(address registrant, address registrantToCopy) external onlyAddressOrOwner(registrant) {
- if (registrant == registrantToCopy) {
- revert CannotCopyFromSelf();
- }
- address registration = _registrations[registrant];
- if (registration == address(0)) {
- revert NotRegistered(registrant);
- }
- if (registration != registrant) {
- revert CannotUpdateWhileSubscribed(registration);
- }
- address registrantRegistration = _registrations[registrantToCopy];
- if (registrantRegistration == address(0)) {
- revert NotRegistered(registrantToCopy);
- }
- _copyEntries(registrant, registrantToCopy);
- }
-
- /// @dev helper to copy entries from registrantToCopy to registrant and emit events
- function _copyEntries(address registrant, address registrantToCopy) private {
- EnumerableSet.AddressSet storage filteredOperatorsRef = _filteredOperators[registrantToCopy];
- EnumerableSet.Bytes32Set storage filteredCodeHashesRef = _filteredCodeHashes[registrantToCopy];
- uint256 filteredOperatorsLength = filteredOperatorsRef.length();
- uint256 filteredCodeHashesLength = filteredCodeHashesRef.length();
- for (uint256 i = 0; i < filteredOperatorsLength;) {
- address operator = filteredOperatorsRef.at(i);
- bool added = _filteredOperators[registrant].add(operator);
- if (added) {
- emit OperatorUpdated(registrant, operator, true);
- }
- unchecked {
- ++i;
- }
- }
- for (uint256 i = 0; i < filteredCodeHashesLength;) {
- bytes32 codehash = filteredCodeHashesRef.at(i);
- bool added = _filteredCodeHashes[registrant].add(codehash);
- if (added) {
- emit CodeHashUpdated(registrant, codehash, true);
- }
- unchecked {
- ++i;
- }
- }
- }
-
- //////////////////
- // VIEW METHODS //
- //////////////////
-
- /**
- * @notice Get the subscription address of a given registrant, if any.
- */
- function subscriptionOf(address registrant) external view returns (address subscription) {
- subscription = _registrations[registrant];
- if (subscription == address(0)) {
- revert NotRegistered(registrant);
- } else if (subscription == registrant) {
- subscription = address(0);
- }
- }
-
- /**
- * @notice Get the set of addresses subscribed to a given registrant.
- * Note that order is not guaranteed as updates are made.
- */
- function subscribers(address registrant) external view returns (address[] memory) {
- return _subscribers[registrant].values();
- }
-
- /**
- * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.
- * Note that order is not guaranteed as updates are made.
- */
- function subscriberAt(address registrant, uint256 index) external view returns (address) {
- return _subscribers[registrant].at(index);
- }
-
- /**
- * @notice Returns true if operator is filtered by a given address or its subscription.
- */
- function isOperatorFiltered(address registrant, address operator) external view returns (bool) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredOperators[registration].contains(operator);
- }
- return _filteredOperators[registrant].contains(operator);
- }
-
- /**
- * @notice Returns true if a codeHash is filtered by a given address or its subscription.
- */
- function isCodeHashFiltered(address registrant, bytes32 codeHash) external view returns (bool) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredCodeHashes[registration].contains(codeHash);
- }
- return _filteredCodeHashes[registrant].contains(codeHash);
- }
-
- /**
- * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.
- */
- function isCodeHashOfFiltered(address registrant, address operatorWithCode) external view returns (bool) {
- bytes32 codeHash = operatorWithCode.codehash;
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredCodeHashes[registration].contains(codeHash);
- }
- return _filteredCodeHashes[registrant].contains(codeHash);
- }
-
- /**
- * @notice Returns true if an address has registered
- */
- function isRegistered(address registrant) external view returns (bool) {
- return _registrations[registrant] != address(0);
- }
-
- /**
- * @notice Returns a list of filtered operators for a given address or its subscription.
- */
- function filteredOperators(address registrant) external view returns (address[] memory) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredOperators[registration].values();
- }
- return _filteredOperators[registrant].values();
- }
-
- /**
- * @notice Returns the set of filtered codeHashes for a given address or its subscription.
- * Note that order is not guaranteed as updates are made.
- */
- function filteredCodeHashes(address registrant) external view returns (bytes32[] memory) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredCodeHashes[registration].values();
- }
- return _filteredCodeHashes[registrant].values();
- }
-
- /**
- * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or
- * its subscription.
- * Note that order is not guaranteed as updates are made.
- */
- function filteredOperatorAt(address registrant, uint256 index) external view returns (address) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredOperators[registration].at(index);
- }
- return _filteredOperators[registrant].at(index);
- }
-
- /**
- * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or
- * its subscription.
- * Note that order is not guaranteed as updates are made.
- */
- function filteredCodeHashAt(address registrant, uint256 index) external view returns (bytes32) {
- address registration = _registrations[registrant];
- if (registration != registrant) {
- return _filteredCodeHashes[registration].at(index);
- }
- return _filteredCodeHashes[registrant].at(index);
- }
-
- /**
- * @dev Convenience method to compute the code hash of an arbitrary contract
- */
- function codeHashOf(address a) external view returns (bytes32) {
- return a.codehash;
- }
-}
diff --git a/src/OperatorFilterRegistryErrorsAndEvents.sol b/src/OperatorFilterRegistryErrorsAndEvents.sol
deleted file mode 100644
index 8321402..0000000
--- a/src/OperatorFilterRegistryErrorsAndEvents.sol
+++ /dev/null
@@ -1,76 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-contract OperatorFilterRegistryErrorsAndEvents {
- /// @notice Emitted when trying to register an address that has no code.
- error CannotFilterEOAs();
-
- /// @notice Emitted when trying to add an address that is already filtered.
- error AddressAlreadyFiltered(address operator);
-
- /// @notice Emitted when trying to remove an address that is not filtered.
- error AddressNotFiltered(address operator);
-
- /// @notice Emitted when trying to add a codehash that is already filtered.
- error CodeHashAlreadyFiltered(bytes32 codeHash);
-
- /// @notice Emitted when trying to remove a codehash that is not filtered.
- error CodeHashNotFiltered(bytes32 codeHash);
-
- /// @notice Emitted when the caller is not the address or EIP-173 "owner()"
- error OnlyAddressOrOwner();
-
- /// @notice Emitted when the registrant is not registered.
- error NotRegistered(address registrant);
-
- /// @notice Emitted when the registrant is already registered.
- error AlreadyRegistered();
-
- /// @notice Emitted when the registrant is already subscribed.
- error AlreadySubscribed(address subscription);
-
- /// @notice Emitted when the registrant is not subscribed.
- error NotSubscribed();
-
- /// @notice Emitted when trying to update a registration where the registrant is already subscribed.
- error CannotUpdateWhileSubscribed(address subscription);
-
- /// @notice Emitted when trying to subscribe to itself.
- error CannotSubscribeToSelf();
-
- /// @notice Emitted when trying to subscribe to the zero address.
- error CannotSubscribeToZeroAddress();
-
- /// @notice Emitted when trying to register and the contract is not ownable (EIP-173 "owner()")
- error NotOwnable();
-
- /// @notice Emitted when an address is filtered.
- error AddressFiltered(address filtered);
-
- /// @notice Emitted when a codeHash is filtered.
- error CodeHashFiltered(address account, bytes32 codeHash);
-
- /// @notice Emited when trying to register to a registrant with a subscription.
- error CannotSubscribeToRegistrantWithSubscription(address registrant);
-
- /// @notice Emitted when trying to copy a registration from itself.
- error CannotCopyFromSelf();
-
- /// @notice Emitted when a registration is updated.
- event RegistrationUpdated(address indexed registrant, bool indexed registered);
-
- /// @notice Emitted when an operator is updated.
- event OperatorUpdated(address indexed registrant, address indexed operator, bool indexed filtered);
-
- /// @notice Emitted when multiple operators are updated.
- event OperatorsUpdated(address indexed registrant, address[] operators, bool indexed filtered);
-
- /// @notice Emitted when a codeHash is updated.
- event CodeHashUpdated(address indexed registrant, bytes32 indexed codeHash, bool indexed filtered);
-
- /// @notice Emitted when multiple codeHashes are updated.
- event CodeHashesUpdated(address indexed registrant, bytes32[] codeHashes, bool indexed filtered);
-
- /// @notice Emitted when a subscription is updated.
- event SubscriptionUpdated(address indexed registrant, address indexed subscription, bool indexed subscribed);
-}
diff --git a/src/OperatorFilterer.sol b/src/OperatorFilterer.sol
deleted file mode 100644
index cea5fc5..0000000
--- a/src/OperatorFilterer.sol
+++ /dev/null
@@ -1,77 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
-import {CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol";
-/**
- * @title OperatorFilterer
- * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
- * registrant's entries in the OperatorFilterRegistry.
- * @dev This smart contract is meant to be inherited by token contracts so they can use the following:
- * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
- * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
- * Please note that if your token contract does not provide an owner with EIP-173, it must provide
- * administration methods on the contract itself to interact with the registry otherwise the subscription
- * will be locked to the options set during construction.
- */
-
-abstract contract OperatorFilterer {
- /// @dev Emitted when an operator is not allowed.
- error OperatorNotAllowed(address operator);
-
- IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY =
- IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS);
-
- /// @dev The constructor that is called when the contract is being deployed.
- constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
- // If an inheriting token contract is deployed to a network without the registry deployed, the modifier
- // will not revert, but the contract will need to be registered with the registry once it is deployed in
- // order for the modifier to filter addresses.
- if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
- if (subscribe) {
- OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
- } else {
- if (subscriptionOrRegistrantToCopy != address(0)) {
- OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
- } else {
- OPERATOR_FILTER_REGISTRY.register(address(this));
- }
- }
- }
- }
-
- /**
- * @dev A helper function to check if an operator is allowed.
- */
- modifier onlyAllowedOperator(address from) virtual {
- // Allow spending tokens from addresses with balance
- // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
- // from an EOA.
- if (from != msg.sender) {
- _checkFilterOperator(msg.sender);
- }
- _;
- }
-
- /**
- * @dev A helper function to check if an operator approval is allowed.
- */
- modifier onlyAllowedOperatorApproval(address operator) virtual {
- _checkFilterOperator(operator);
- _;
- }
-
- /**
- * @dev A helper function to check if an operator is allowed.
- */
- function _checkFilterOperator(address operator) internal view virtual {
- // Check registry code length to facilitate testing in environments without a deployed registry.
- if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
- // under normal circumstances, this function will revert rather than return false, but inheriting contracts
- // may specify their own OperatorFilterRegistry implementations, which may behave differently
- if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
- revert OperatorNotAllowed(operator);
- }
- }
- }
-}
diff --git a/src/OwnedRegistrant.sol b/src/OwnedRegistrant.sol
deleted file mode 100644
index af2bd05..0000000
--- a/src/OwnedRegistrant.sol
+++ /dev/null
@@ -1,19 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
-import {Ownable2Step} from "openzeppelin-contracts/access/Ownable2Step.sol";
-import {CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol";
-/**
- * @title OwnedRegistrant
- * @notice Ownable contract that registers itself with the OperatorFilterRegistry and administers its own entries,
- * to facilitate a subscription whose ownership can be transferred.
- */
-
-contract OwnedRegistrant is Ownable2Step {
- /// @dev The constructor that is called when the contract is being deployed.
- constructor(address _owner) {
- IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS).register(address(this));
- transferOwnership(_owner);
- }
-}
diff --git a/src/RevokableDefaultOperatorFilterer.sol b/src/RevokableDefaultOperatorFilterer.sol
deleted file mode 100644
index 6e0ec66..0000000
--- a/src/RevokableDefaultOperatorFilterer.sol
+++ /dev/null
@@ -1,18 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {RevokableOperatorFilterer} from "./RevokableOperatorFilterer.sol";
-import {CANONICAL_CORI_SUBSCRIPTION, CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol";
-/**
- * @title RevokableDefaultOperatorFilterer
- * @notice Inherits from RevokableOperatorFilterer and automatically subscribes to the default OpenSea subscription.
- * Note that OpenSea will disable creator earnings enforcement if filtered operators begin fulfilling orders
- * on-chain, eg, if the registry is revoked or bypassed.
- */
-
-abstract contract RevokableDefaultOperatorFilterer is RevokableOperatorFilterer {
- /// @dev The constructor that is called when the contract is being deployed.
- constructor()
- RevokableOperatorFilterer(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS, CANONICAL_CORI_SUBSCRIPTION, true)
- {}
-}
diff --git a/src/RevokableOperatorFilterer.sol b/src/RevokableOperatorFilterer.sol
deleted file mode 100644
index a2ad1d9..0000000
--- a/src/RevokableOperatorFilterer.sol
+++ /dev/null
@@ -1,71 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {UpdatableOperatorFilterer} from "./UpdatableOperatorFilterer.sol";
-import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
-
-/**
- * @title RevokableOperatorFilterer
- * @notice This contract is meant to allow contracts to permanently skip OperatorFilterRegistry checks if desired. The
- * Registry itself has an "unregister" function, but if the contract is ownable, the owner can re-register at
- * any point. As implemented, this abstract contract allows the contract owner to permanently skip the
- * OperatorFilterRegistry checks by calling revokeOperatorFilterRegistry. Once done, the registry
- * address cannot be further updated.
- * Note that OpenSea will still disable creator earnings enforcement if filtered operators begin fulfilling orders
- * on-chain, eg, if the registry is revoked or bypassed.
- */
-abstract contract RevokableOperatorFilterer is UpdatableOperatorFilterer {
- /// @dev Emitted when the registry has already been revoked.
- error RegistryHasBeenRevoked();
- /// @dev Emitted when the initial registry address is attempted to be set to the zero address.
- error InitialRegistryAddressCannotBeZeroAddress();
-
- event OperatorFilterRegistryRevoked();
-
- bool public isOperatorFilterRegistryRevoked;
-
- /// @dev The constructor that is called when the contract is being deployed.
- constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe)
- UpdatableOperatorFilterer(_registry, subscriptionOrRegistrantToCopy, subscribe)
- {
- // don't allow creating a contract with a permanently revoked registry
- if (_registry == address(0)) {
- revert InitialRegistryAddressCannotBeZeroAddress();
- }
- }
-
- /**
- * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
- * address, checks will be permanently bypassed, and the address cannot be updated again. OnlyOwner.
- */
- function updateOperatorFilterRegistryAddress(address newRegistry) public override {
- if (msg.sender != owner()) {
- revert OnlyOwner();
- }
- // if registry has been revoked, do not allow further updates
- if (isOperatorFilterRegistryRevoked) {
- revert RegistryHasBeenRevoked();
- }
-
- operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
- emit OperatorFilterRegistryAddressUpdated(newRegistry);
- }
-
- /**
- * @notice Revoke the OperatorFilterRegistry address, permanently bypassing checks. OnlyOwner.
- */
- function revokeOperatorFilterRegistry() public {
- if (msg.sender != owner()) {
- revert OnlyOwner();
- }
- // if registry has been revoked, do not allow further updates
- if (isOperatorFilterRegistryRevoked) {
- revert RegistryHasBeenRevoked();
- }
-
- // set to zero address to bypass checks
- operatorFilterRegistry = IOperatorFilterRegistry(address(0));
- isOperatorFilterRegistryRevoked = true;
- emit OperatorFilterRegistryRevoked();
- }
-}
diff --git a/src/UpdatableOperatorFilterer.sol b/src/UpdatableOperatorFilterer.sol
deleted file mode 100644
index 74c4257..0000000
--- a/src/UpdatableOperatorFilterer.sol
+++ /dev/null
@@ -1,100 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
-
-/**
- * @title UpdatableOperatorFilterer
- * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
- * registrant's entries in the OperatorFilterRegistry. This contract allows the Owner to update the
- * OperatorFilterRegistry address via updateOperatorFilterRegistryAddress, including to the zero address,
- * which will bypass registry checks.
- * Note that OpenSea will still disable creator earnings enforcement if filtered operators begin fulfilling orders
- * on-chain, eg, if the registry is revoked or bypassed.
- * @dev This smart contract is meant to be inherited by token contracts so they can use the following:
- * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
- * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
- */
-abstract contract UpdatableOperatorFilterer {
- /// @dev Emitted when an operator is not allowed.
- error OperatorNotAllowed(address operator);
- /// @dev Emitted when someone other than the owner is trying to call an only owner function.
- error OnlyOwner();
-
- event OperatorFilterRegistryAddressUpdated(address newRegistry);
-
- IOperatorFilterRegistry public operatorFilterRegistry;
-
- /// @dev The constructor that is called when the contract is being deployed.
- constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe) {
- IOperatorFilterRegistry registry = IOperatorFilterRegistry(_registry);
- operatorFilterRegistry = registry;
- // If an inheriting token contract is deployed to a network without the registry deployed, the modifier
- // will not revert, but the contract will need to be registered with the registry once it is deployed in
- // order for the modifier to filter addresses.
- if (address(registry).code.length > 0) {
- if (subscribe) {
- registry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
- } else {
- if (subscriptionOrRegistrantToCopy != address(0)) {
- registry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
- } else {
- registry.register(address(this));
- }
- }
- }
- }
-
- /**
- * @dev A helper function to check if the operator is allowed.
- */
- modifier onlyAllowedOperator(address from) virtual {
- // Allow spending tokens from addresses with balance
- // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
- // from an EOA.
- if (from != msg.sender) {
- _checkFilterOperator(msg.sender);
- }
- _;
- }
-
- /**
- * @dev A helper function to check if the operator approval is allowed.
- */
- modifier onlyAllowedOperatorApproval(address operator) virtual {
- _checkFilterOperator(operator);
- _;
- }
-
- /**
- * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
- * address, checks will be bypassed. OnlyOwner.
- */
- function updateOperatorFilterRegistryAddress(address newRegistry) public virtual {
- if (msg.sender != owner()) {
- revert OnlyOwner();
- }
- operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
- emit OperatorFilterRegistryAddressUpdated(newRegistry);
- }
-
- /**
- * @dev Assume the contract has an owner, but leave specific Ownable implementation up to inheriting contract.
- */
- function owner() public view virtual returns (address);
-
- /**
- * @dev A helper function to check if the operator is allowed.
- */
- function _checkFilterOperator(address operator) internal view virtual {
- IOperatorFilterRegistry registry = operatorFilterRegistry;
- // Check registry code length to facilitate testing in environments without a deployed registry.
- if (address(registry) != address(0) && address(registry).code.length > 0) {
- // under normal circumstances, this function will revert rather than return false, but inheriting contracts
- // may specify their own OperatorFilterRegistry implementations, which may behave differently
- if (!registry.isOperatorAllowed(address(this), operator)) {
- revert OperatorNotAllowed(operator);
- }
- }
- }
-}
diff --git a/src/example/ExampleERC1155.sol b/src/example/ExampleERC1155.sol
deleted file mode 100644
index 07aae4d..0000000
--- a/src/example/ExampleERC1155.sol
+++ /dev/null
@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ERC1155} from "openzeppelin-contracts/token/ERC1155/ERC1155.sol";
-import {ERC2981} from "openzeppelin-contracts/token/common/ERC2981.sol";
-import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
-import {DefaultOperatorFilterer} from "../DefaultOperatorFilterer.sol";
-
-/**
- * @title ExampleERC1155
- * @notice This example contract is configured to use the DefaultOperatorFilterer, which automatically registers the
- * token and subscribes it to OpenSea's curated filters.
- * Adding the onlyAllowedOperator modifier to the safeTransferFrom methods ensures that
- * the msg.sender (operator) is allowed by the OperatorFilterRegistry. Adding the onlyAllowedOperatorApproval
- * modifier to the setApprovalForAll method ensures that owners do not approve operators that are not allowed.
- */
-abstract contract ExampleERC1155 is ERC1155(""), ERC2981, DefaultOperatorFilterer, Ownable {
- /**
- * @dev See {IERC1155-setApprovalForAll}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
- super.setApprovalForAll(operator, approved);
- }
-
- /**
- * @dev See {IERC1155-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId, uint256 amount, bytes memory data)
- public
- override
- onlyAllowedOperator(from)
- {
- super.safeTransferFrom(from, to, tokenId, amount, data);
- }
-
- /**
- * @dev See {IERC1155-safeBatchTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeBatchTransferFrom(
- address from,
- address to,
- uint256[] memory ids,
- uint256[] memory amounts,
- bytes memory data
- ) public virtual override onlyAllowedOperator(from) {
- super.safeBatchTransferFrom(from, to, ids, amounts, data);
- }
-
- /**
- * @dev See {IERC165-supportsInterface}.
- */
- function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, ERC2981) returns (bool) {
- return ERC1155.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId);
- }
-}
diff --git a/src/example/ExampleERC721.sol b/src/example/ExampleERC721.sol
deleted file mode 100644
index e578f4b..0000000
--- a/src/example/ExampleERC721.sol
+++ /dev/null
@@ -1,68 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ERC721} from "openzeppelin-contracts/token/ERC721/ERC721.sol";
-import {ERC2981} from "openzeppelin-contracts/token/common/ERC2981.sol";
-import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
-import {DefaultOperatorFilterer} from "../DefaultOperatorFilterer.sol";
-
-/**
- * @title ExampleERC721
- * @notice This example contract is configured to use the DefaultOperatorFilterer, which automatically registers the
- * token and subscribes it to OpenSea's curated filters.
- * Adding the onlyAllowedOperator modifier to the transferFrom and both safeTransferFrom methods ensures that
- * the msg.sender (operator) is allowed by the OperatorFilterRegistry. Adding the onlyAllowedOperatorApproval
- * modifier to the approval methods ensures that owners do not approve operators that are not allowed.
- */
-abstract contract ExampleERC721 is ERC721("Example", "EXAMPLE"), ERC2981, DefaultOperatorFilterer, Ownable {
- /**
- * @dev See {IERC721-setApprovalForAll}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
- super.setApprovalForAll(operator, approved);
- }
-
- /**
- * @dev See {IERC721-approve}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
- super.approve(operator, tokenId);
- }
-
- /**
- * @dev See {IERC721-transferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.transferFrom(from, to, tokenId);
- }
-
- /**
- * @dev See {IERC721-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.safeTransferFrom(from, to, tokenId);
- }
-
- /**
- * @dev See {IERC721-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
- public
- override
- onlyAllowedOperator(from)
- {
- super.safeTransferFrom(from, to, tokenId, data);
- }
-
- /**
- * @dev See {IERC165-supportsInterface}.
- */
- function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {
- return super.supportsInterface(interfaceId);
- }
-}
diff --git a/src/example/RevokableExampleERC1155.sol b/src/example/RevokableExampleERC1155.sol
deleted file mode 100644
index 390cdca..0000000
--- a/src/example/RevokableExampleERC1155.sol
+++ /dev/null
@@ -1,67 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ERC1155} from "openzeppelin-contracts/token/ERC1155/ERC1155.sol";
-import {ERC2981} from "openzeppelin-contracts/token/common/ERC2981.sol";
-import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
-import {UpdatableOperatorFilterer} from "../UpdatableOperatorFilterer.sol";
-import {RevokableDefaultOperatorFilterer} from "../RevokableDefaultOperatorFilterer.sol";
-
-/**
- * @title RevokableExampleERC1155
- * @notice This example contract is configured to use the RevokableDefaultOperatorFilterer, which automatically
- * registers the token and subscribes it to OpenSea's curated filters. The owner of the contract can
- * permanently revoke checks to the filter registry by calling revokeOperatorFilterRegistry.
- * Adding the onlyAllowedOperator modifier to the safeTransferFrom methods ensures that
- * the msg.sender (operator) is allowed by the OperatorFilterRegistry. Adding the onlyAllowedOperatorApproval
- * modifier to the setApprovalForAll method ensures that owners do not approve operators that are not allowed.
- */
-abstract contract RevokableExampleERC1155 is ERC1155(""), ERC2981, RevokableDefaultOperatorFilterer, Ownable {
- /**
- * @dev See {IERC1155-setApprovalForAll}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
- super.setApprovalForAll(operator, approved);
- }
-
- /**
- * @dev See {IERC1155-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId, uint256 amount, bytes memory data)
- public
- override
- onlyAllowedOperator(from)
- {
- super.safeTransferFrom(from, to, tokenId, amount, data);
- }
-
- /**
- * @dev See {IERC1155-safeBatchTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeBatchTransferFrom(
- address from,
- address to,
- uint256[] memory ids,
- uint256[] memory amounts,
- bytes memory data
- ) public virtual override onlyAllowedOperator(from) {
- super.safeBatchTransferFrom(from, to, ids, amounts, data);
- }
-
- /**
- * @dev Returns the owner of the ERC1155 token contract.
- */
- function owner() public view virtual override(Ownable, UpdatableOperatorFilterer) returns (address) {
- return Ownable.owner();
- }
-
- /**
- * @dev See {IERC165-supportsInterface}.
- */
- function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, ERC2981) returns (bool) {
- return super.supportsInterface(interfaceId);
- }
-}
diff --git a/src/example/RevokableExampleERC721.sol b/src/example/RevokableExampleERC721.sol
deleted file mode 100644
index 8f5b150..0000000
--- a/src/example/RevokableExampleERC721.sol
+++ /dev/null
@@ -1,82 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ERC721} from "openzeppelin-contracts/token/ERC721/ERC721.sol";
-import {ERC2981} from "openzeppelin-contracts/token/common/ERC2981.sol";
-import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
-import {UpdatableOperatorFilterer} from "../UpdatableOperatorFilterer.sol";
-import {RevokableDefaultOperatorFilterer} from "../RevokableDefaultOperatorFilterer.sol";
-
-/**
- * @title ExampleERC721
- * @notice This example contract is configured to use the RevokableDefaultOperatorFilterer, which automatically
- * registers the token and subscribes it to OpenSea's curated filters. The owner of the contract can
- * permanently revoke checks to the filter registry by calling revokeOperatorFilterRegistry.
- * Adding the onlyAllowedOperator modifier to the transferFrom and both safeTransferFrom methods ensures that
- * the msg.sender (operator) is allowed by the OperatorFilterRegistry. Adding the onlyAllowedOperatorApproval
- * modifier to the approval methods ensures that owners do not approve operators that are not allowed.
- */
-abstract contract RevokableExampleERC721 is
- ERC721("Example", "EXAMPLE"),
- ERC2981,
- RevokableDefaultOperatorFilterer,
- Ownable
-{
- /**
- * @dev See {IERC721-setApprovalForAll}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
- super.setApprovalForAll(operator, approved);
- }
-
- /**
- * @dev See {IERC721-approve}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
- super.approve(operator, tokenId);
- }
-
- /**
- * @dev See {IERC721-transferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.transferFrom(from, to, tokenId);
- }
-
- /**
- * @dev See {IERC721-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.safeTransferFrom(from, to, tokenId);
- }
-
- /**
- * @dev See {IERC721-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
- public
- override
- onlyAllowedOperator(from)
- {
- super.safeTransferFrom(from, to, tokenId, data);
- }
-
- /**
- * @dev Returns the owner of the ERC721 token contract.
- */
- function owner() public view virtual override(Ownable, UpdatableOperatorFilterer) returns (address) {
- return Ownable.owner();
- }
-
- /**
- * @dev See {IERC165-supportsInterface}.
- */
- function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {
- return super.supportsInterface(interfaceId);
- }
-}
diff --git a/src/example/upgradeable/ExampleERC1155Upgradeable.sol b/src/example/upgradeable/ExampleERC1155Upgradeable.sol
deleted file mode 100644
index 68ea738..0000000
--- a/src/example/upgradeable/ExampleERC1155Upgradeable.sol
+++ /dev/null
@@ -1,78 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ERC1155Upgradeable} from "openzeppelin-contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
-import {ERC2981Upgradeable} from "openzeppelin-contracts-upgradeable/token/common/ERC2981Upgradeable.sol";
-import {OwnableUpgradeable} from "openzeppelin-contracts-upgradeable/access/OwnableUpgradeable.sol";
-import {DefaultOperatorFiltererUpgradeable} from "../../upgradeable/DefaultOperatorFiltererUpgradeable.sol";
-
-/**
- * @title ExampleERC1155Upgradeable
- * @notice This example contract is configured to use the DefaultOperatorFilterer, which automatically registers the
- * token and subscribes it to OpenSea's curated filters.
- * Adding the onlyAllowedOperator modifier to the transferFrom and both safeTransferFrom methods ensures that
- * the msg.sender (operator) is allowed by the OperatorFilterRegistry.
- */
-abstract contract ExampleERC1155Upgradeable is
- ERC1155Upgradeable,
- ERC2981Upgradeable,
- DefaultOperatorFiltererUpgradeable,
- OwnableUpgradeable
-{
- /**
- * @dev Initializes the upgradeable contract.
- */
- function initialize() public initializer {
- __ERC1155_init("");
- __ERC2981_init();
- __Ownable_init();
- __DefaultOperatorFilterer_init();
- }
-
- /**
- * @dev See {IERC1155-setApprovalForAll}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
- super.setApprovalForAll(operator, approved);
- }
-
- /**
- * @dev See {IERC1155-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId, uint256 amount, bytes memory data)
- public
- override
- onlyAllowedOperator(from)
- {
- super.safeTransferFrom(from, to, tokenId, amount, data);
- }
-
- /**
- * @dev See {IERC1155-safeBatchTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeBatchTransferFrom(
- address from,
- address to,
- uint256[] memory ids,
- uint256[] memory amounts,
- bytes memory data
- ) public virtual override onlyAllowedOperator(from) {
- super.safeBatchTransferFrom(from, to, ids, amounts, data);
- }
-
- /**
- * @dev See {IERC165-supportsInterface}.
- */
- function supportsInterface(bytes4 interfaceId)
- public
- view
- virtual
- override(ERC1155Upgradeable, ERC2981Upgradeable)
- returns (bool)
- {
- return super.supportsInterface(interfaceId);
- }
-}
diff --git a/src/example/upgradeable/ExampleERC721Upgradeable.sol b/src/example/upgradeable/ExampleERC721Upgradeable.sol
deleted file mode 100644
index 9ae58dd..0000000
--- a/src/example/upgradeable/ExampleERC721Upgradeable.sol
+++ /dev/null
@@ -1,88 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ERC721Upgradeable} from "openzeppelin-contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
-import {ERC2981Upgradeable} from "openzeppelin-contracts-upgradeable/token/common/ERC2981Upgradeable.sol";
-import {OwnableUpgradeable} from "openzeppelin-contracts-upgradeable/access/OwnableUpgradeable.sol";
-import {DefaultOperatorFiltererUpgradeable} from "../../upgradeable/DefaultOperatorFiltererUpgradeable.sol";
-
-/**
- * @title ExampleERC721Upgradeable
- * @notice This example contract is configured to use the DefaultOperatorFilterer, which automatically registers the
- * token and subscribes it to OpenSea's curated filters.
- * Adding the onlyAllowedOperator modifier to the transferFrom and both safeTransferFrom methods ensures that
- * the msg.sender (operator) is allowed by the OperatorFilterRegistry.
- */
-abstract contract ExampleERC721Upgradeable is
- ERC721Upgradeable,
- ERC2981Upgradeable,
- DefaultOperatorFiltererUpgradeable,
- OwnableUpgradeable
-{
- /**
- * @dev Initializes the upgradeable contract.
- */
- function initialize() public initializer {
- __ERC721_init("Example", "EXAMPLE");
- __ERC2981_init();
- __Ownable_init();
- __DefaultOperatorFilterer_init();
- }
-
- /**
- * @dev See {IERC721-setApprovalForAll}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
- super.setApprovalForAll(operator, approved);
- }
-
- /**
- * @dev See {IERC721-approve}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
- super.approve(operator, tokenId);
- }
-
- /**
- * @dev See {IERC721-transferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.transferFrom(from, to, tokenId);
- }
-
- /**
- * @dev See {IERC721-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.safeTransferFrom(from, to, tokenId);
- }
-
- /**
- * @dev See {IERC721-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
- public
- override
- onlyAllowedOperator(from)
- {
- super.safeTransferFrom(from, to, tokenId, data);
- }
-
- /**
- * @dev See {IERC165-supportsInterface}.
- */
- function supportsInterface(bytes4 interfaceId)
- public
- view
- virtual
- override(ERC721Upgradeable, ERC2981Upgradeable)
- returns (bool)
- {
- return super.supportsInterface(interfaceId);
- }
-}
diff --git a/src/example/upgradeable/RevokableExampleERC1155Upgradeable.sol b/src/example/upgradeable/RevokableExampleERC1155Upgradeable.sol
deleted file mode 100644
index e563986..0000000
--- a/src/example/upgradeable/RevokableExampleERC1155Upgradeable.sol
+++ /dev/null
@@ -1,93 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ERC1155Upgradeable} from "openzeppelin-contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
-import {ERC2981Upgradeable} from "openzeppelin-contracts-upgradeable/token/common/ERC2981Upgradeable.sol";
-import {OwnableUpgradeable} from "openzeppelin-contracts-upgradeable/access/OwnableUpgradeable.sol";
-import {RevokableDefaultOperatorFiltererUpgradeable} from
- "../../upgradeable/RevokableDefaultOperatorFiltererUpgradeable.sol";
-import {RevokableOperatorFiltererUpgradeable} from "../../upgradeable/RevokableOperatorFiltererUpgradeable.sol";
-
-/**
- * @title ExampleERC1155Upgradeable
- * @notice This example contract is configured to use the DefaultOperatorFilterer, which automatically registers the
- * token and subscribes it to OpenSea's curated filters.
- * Adding the onlyAllowedOperator modifier to the transferFrom and both safeTransferFrom methods ensures that
- * the msg.sender (operator) is allowed by the OperatorFilterRegistry.
- */
-abstract contract RevokableExampleERC1155Upgradeable is
- ERC1155Upgradeable,
- ERC2981Upgradeable,
- RevokableDefaultOperatorFiltererUpgradeable,
- OwnableUpgradeable
-{
- /**
- * @dev Initializes the upgradeable contract.
- */
- function initialize() public initializer {
- __ERC1155_init("");
- __ERC2981_init();
- __Ownable_init();
- __RevokableDefaultOperatorFilterer_init();
- }
-
- /**
- * @dev See {IERC1155-setApprovalForAll}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
- super.setApprovalForAll(operator, approved);
- }
-
- /**
- * @dev See {IERC1155-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId, uint256 amount, bytes memory data)
- public
- override
- onlyAllowedOperator(from)
- {
- super.safeTransferFrom(from, to, tokenId, amount, data);
- }
-
- /**
- * @dev See {IERC1155-safeBatchTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeBatchTransferFrom(
- address from,
- address to,
- uint256[] memory ids,
- uint256[] memory amounts,
- bytes memory data
- ) public virtual override onlyAllowedOperator(from) {
- super.safeBatchTransferFrom(from, to, ids, amounts, data);
- }
-
- /**
- * @dev Returns the owner of the ERC1155 token contract.
- */
- function owner()
- public
- view
- virtual
- override(OwnableUpgradeable, RevokableOperatorFiltererUpgradeable)
- returns (address)
- {
- return OwnableUpgradeable.owner();
- }
-
- /**
- * @dev See {IERC165-supportsInterface}.
- */
- function supportsInterface(bytes4 interfaceId)
- public
- view
- virtual
- override(ERC1155Upgradeable, ERC2981Upgradeable)
- returns (bool)
- {
- return super.supportsInterface(interfaceId);
- }
-}
diff --git a/src/example/upgradeable/RevokableExampleERC721Upgradeable.sol b/src/example/upgradeable/RevokableExampleERC721Upgradeable.sol
deleted file mode 100644
index 39d267d..0000000
--- a/src/example/upgradeable/RevokableExampleERC721Upgradeable.sol
+++ /dev/null
@@ -1,103 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ERC721Upgradeable} from "openzeppelin-contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
-import {ERC2981Upgradeable} from "openzeppelin-contracts-upgradeable/token/common/ERC2981Upgradeable.sol";
-import {OwnableUpgradeable} from "openzeppelin-contracts-upgradeable/access/OwnableUpgradeable.sol";
-import {RevokableDefaultOperatorFiltererUpgradeable} from
- "../../upgradeable/RevokableDefaultOperatorFiltererUpgradeable.sol";
-import {RevokableOperatorFiltererUpgradeable} from "../../upgradeable/RevokableOperatorFiltererUpgradeable.sol";
-
-/**
- * @title ExampleERC721Upgradeable
- * @notice This example contract is configured to use the DefaultOperatorFilterer, which automatically registers the
- * token and subscribes it to OpenSea's curated filters.
- * Adding the onlyAllowedOperator modifier to the transferFrom and both safeTransferFrom methods ensures that
- * the msg.sender (operator) is allowed by the OperatorFilterRegistry.
- */
-abstract contract RevokableExampleERC721Upgradeable is
- ERC721Upgradeable,
- ERC2981Upgradeable,
- RevokableDefaultOperatorFiltererUpgradeable,
- OwnableUpgradeable
-{
- /**
- * @dev Initializes the upgradeable contract.
- */
- function initialize() public initializer {
- __ERC721_init("Example", "EXAMPLE");
- __ERC2981_init();
- __Ownable_init();
- __RevokableDefaultOperatorFilterer_init();
- }
-
- /**
- * @dev See {IERC721-setApprovalForAll}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
- super.setApprovalForAll(operator, approved);
- }
-
- /**
- * @dev See {IERC721-approve}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
- super.approve(operator, tokenId);
- }
-
- /**
- * @dev See {IERC721-transferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.transferFrom(from, to, tokenId);
- }
-
- /**
- * @dev See {IERC721-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.safeTransferFrom(from, to, tokenId);
- }
-
- /**
- * @dev See {IERC721-safeTransferFrom}.
- * In this example the added modifier ensures that the operator is allowed by the OperatorFilterRegistry.
- */
- function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
- public
- override
- onlyAllowedOperator(from)
- {
- super.safeTransferFrom(from, to, tokenId, data);
- }
-
- /**
- * @dev Returns the owner of the ERC721 token contract.
- */
- function owner()
- public
- view
- virtual
- override(OwnableUpgradeable, RevokableOperatorFiltererUpgradeable)
- returns (address)
- {
- return OwnableUpgradeable.owner();
- }
-
- /**
- * @dev See {IERC165-supportsInterface}.
- */
- function supportsInterface(bytes4 interfaceId)
- public
- view
- virtual
- override(ERC721Upgradeable, ERC2981Upgradeable)
- returns (bool)
- {
- return super.supportsInterface(interfaceId);
- }
-}
diff --git a/src/example/upgradeable/UpdatableExampleERC721Upgradeable.sol b/src/example/upgradeable/UpdatableExampleERC721Upgradeable.sol
deleted file mode 100644
index 450da9e..0000000
--- a/src/example/upgradeable/UpdatableExampleERC721Upgradeable.sol
+++ /dev/null
@@ -1,61 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ERC721Upgradeable} from "openzeppelin-contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
-import {OwnableUpgradeable} from "openzeppelin-contracts-upgradeable/access/OwnableUpgradeable.sol";
-
-import {UpdatableOperatorFiltererUpgradeable} from "../../upgradeable/UpdatableOperatorFiltererUpgradeable.sol";
-
-/**
- * @title UpdatableExampleERC721Upgradeable
- * @author qed.team, abarbatei, balajmarius
- * @notice This example contract is configured to use the UpdatableOperatorFiltererUpgradeable, which registers the
- * token and subscribes it to a give register filter.
- * Adding the onlyAllowedOperator modifier to the setApprovalForAll, approve, transferFrom, safeTransferFrom (both version) methods ensures that
- * the msg.sender (operator) is allowed by the OperatorFilterRegistry.
- */
-abstract contract UpdatableExampleERC721Upgradeable is
- ERC721Upgradeable,
- UpdatableOperatorFiltererUpgradeable,
- OwnableUpgradeable
-{
- function initialize(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe) public initializer {
- __ERC721_init("Example", "EXAMPLE");
- __Ownable_init();
- __UpdatableOperatorFiltererUpgradeable_init(_registry, subscriptionOrRegistrantToCopy, subscribe);
- }
-
- function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
- super.setApprovalForAll(operator, approved);
- }
-
- function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
- super.approve(operator, tokenId);
- }
-
- function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.transferFrom(from, to, tokenId);
- }
-
- function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
- super.safeTransferFrom(from, to, tokenId);
- }
-
- function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
- public
- override
- onlyAllowedOperator(from)
- {
- super.safeTransferFrom(from, to, tokenId, data);
- }
-
- function owner()
- public
- view
- virtual
- override(OwnableUpgradeable, UpdatableOperatorFiltererUpgradeable)
- returns (address)
- {
- return OwnableUpgradeable.owner();
- }
-}
diff --git a/src/lib/Constants.sol b/src/lib/Constants.sol
deleted file mode 100644
index 06b811e..0000000
--- a/src/lib/Constants.sol
+++ /dev/null
@@ -1,5 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E;
-address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
diff --git a/src/upgradeable/DefaultOperatorFiltererUpgradeable.sol b/src/upgradeable/DefaultOperatorFiltererUpgradeable.sol
deleted file mode 100644
index 0e1ff0d..0000000
--- a/src/upgradeable/DefaultOperatorFiltererUpgradeable.sol
+++ /dev/null
@@ -1,17 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OperatorFiltererUpgradeable} from "./OperatorFiltererUpgradeable.sol";
-import {CANONICAL_CORI_SUBSCRIPTION} from "../lib/Constants.sol";
-
-/**
- * @title DefaultOperatorFiltererUpgradeable
- * @notice Inherits from OperatorFiltererUpgradeable and automatically subscribes to the default OpenSea subscription
- * when the init function is called.
- */
-abstract contract DefaultOperatorFiltererUpgradeable is OperatorFiltererUpgradeable {
- /// @dev The upgradeable initialize function that should be called when the contract is being deployed.
- function __DefaultOperatorFilterer_init() internal onlyInitializing {
- OperatorFiltererUpgradeable.__OperatorFilterer_init(CANONICAL_CORI_SUBSCRIPTION, true);
- }
-}
diff --git a/src/upgradeable/OperatorFiltererUpgradeable.sol b/src/upgradeable/OperatorFiltererUpgradeable.sol
deleted file mode 100644
index 879afba..0000000
--- a/src/upgradeable/OperatorFiltererUpgradeable.sol
+++ /dev/null
@@ -1,80 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {IOperatorFilterRegistry} from "../IOperatorFilterRegistry.sol";
-import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol";
-
-/**
- * @title OperatorFiltererUpgradeable
- * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
- * registrant's entries in the OperatorFilterRegistry when the init function is called.
- * @dev This smart contract is meant to be inherited by token contracts so they can use the following:
- * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
- * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
- */
-abstract contract OperatorFiltererUpgradeable is Initializable {
- /// @notice Emitted when an operator is not allowed.
- error OperatorNotAllowed(address operator);
-
- IOperatorFilterRegistry constant OPERATOR_FILTER_REGISTRY =
- IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);
-
- /// @dev The upgradeable initialize function that should be called when the contract is being upgraded.
- function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe)
- internal
- onlyInitializing
- {
- // If an inheriting token contract is deployed to a network without the registry deployed, the modifier
- // will not revert, but the contract will need to be registered with the registry once it is deployed in
- // order for the modifier to filter addresses.
- if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
- if (!OPERATOR_FILTER_REGISTRY.isRegistered(address(this))) {
- if (subscribe) {
- OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
- } else {
- if (subscriptionOrRegistrantToCopy != address(0)) {
- OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
- } else {
- OPERATOR_FILTER_REGISTRY.register(address(this));
- }
- }
- }
- }
- }
-
- /**
- * @dev A helper modifier to check if the operator is allowed.
- */
- modifier onlyAllowedOperator(address from) virtual {
- // Allow spending tokens from addresses with balance
- // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
- // from an EOA.
- if (from != msg.sender) {
- _checkFilterOperator(msg.sender);
- }
- _;
- }
-
- /**
- * @dev A helper modifier to check if the operator approval is allowed.
- */
- modifier onlyAllowedOperatorApproval(address operator) virtual {
- _checkFilterOperator(operator);
- _;
- }
-
- /**
- * @dev A helper function to check if the operator is allowed.
- */
- function _checkFilterOperator(address operator) internal view virtual {
- // Check registry code length to facilitate testing in environments without a deployed registry.
- if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
- // under normal circumstances, this function will revert rather than return false, but inheriting or
- // upgraded contracts may specify their own OperatorFilterRegistry implementations, which may behave
- // differently
- if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
- revert OperatorNotAllowed(operator);
- }
- }
- }
-}
diff --git a/src/upgradeable/RevokableDefaultOperatorFiltererUpgradeable.sol b/src/upgradeable/RevokableDefaultOperatorFiltererUpgradeable.sol
deleted file mode 100644
index 0ea4b44..0000000
--- a/src/upgradeable/RevokableDefaultOperatorFiltererUpgradeable.sol
+++ /dev/null
@@ -1,19 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {RevokableOperatorFiltererUpgradeable} from "./RevokableOperatorFiltererUpgradeable.sol";
-import {CANONICAL_CORI_SUBSCRIPTION} from "../lib/Constants.sol";
-
-/**
- * @title RevokableDefaultOperatorFiltererUpgradeable
- * @notice Inherits from RevokableOperatorFiltererUpgradeable and automatically subscribes to the default OpenSea subscription
- * when the init function is called.
- * Note that OpenSea will disable creator earnings enforcement if filtered operators begin fulfilling orders
- * on-chain, eg, if the registry is revoked or bypassed.
- */
-abstract contract RevokableDefaultOperatorFiltererUpgradeable is RevokableOperatorFiltererUpgradeable {
- /// @dev The upgradeable initialize function that should be called when the contract is being upgraded.
- function __RevokableDefaultOperatorFilterer_init() internal onlyInitializing {
- RevokableOperatorFiltererUpgradeable.__RevokableOperatorFilterer_init(CANONICAL_CORI_SUBSCRIPTION, true);
- }
-}
diff --git a/src/upgradeable/RevokableOperatorFiltererUpgradeable.sol b/src/upgradeable/RevokableOperatorFiltererUpgradeable.sol
deleted file mode 100644
index 196ddcc..0000000
--- a/src/upgradeable/RevokableOperatorFiltererUpgradeable.sol
+++ /dev/null
@@ -1,88 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OperatorFiltererUpgradeable} from "./OperatorFiltererUpgradeable.sol";
-
-/**
- * @title Upgradeable storage layout for RevokableOperatorFiltererUpgradeable.
- * @notice Upgradeable contracts must use a storage layout that can be used across upgrades.
- * Only append new variables to the end of the layout.
- */
-library RevokableOperatorFiltererUpgradeableStorage {
- struct Layout {
- /// @dev Whether the OperatorFilterRegistry has been revoked.
- bool _isOperatorFilterRegistryRevoked;
- }
-
- /// @dev The storage slot for the layout.
- bytes32 internal constant STORAGE_SLOT = keccak256("RevokableOperatorFiltererUpgradeable.contracts.storage");
-
- /// @dev The layout of the storage.
- function layout() internal pure returns (Layout storage l) {
- bytes32 slot = STORAGE_SLOT;
- assembly {
- l.slot := slot
- }
- }
-}
-
-/**
- * @title RevokableOperatorFilterer
- * @notice This contract is meant to allow contracts to permanently opt out of the OperatorFilterRegistry. The Registry
- * itself has an "unregister" function, but if the contract is ownable, the owner can re-register at any point.
- * As implemented, this abstract contract allows the contract owner to toggle the
- * isOperatorFilterRegistryRevoked flag in order to permanently bypass the OperatorFilterRegistry checks.
- */
-abstract contract RevokableOperatorFiltererUpgradeable is OperatorFiltererUpgradeable {
- using RevokableOperatorFiltererUpgradeableStorage for RevokableOperatorFiltererUpgradeableStorage.Layout;
-
- error OnlyOwner();
- error AlreadyRevoked();
-
- event OperatorFilterRegistryRevoked();
-
- function __RevokableOperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal {
- OperatorFiltererUpgradeable.__OperatorFilterer_init(subscriptionOrRegistrantToCopy, subscribe);
- }
-
- /**
- * @dev A helper function to check if the operator is allowed.
- */
- function _checkFilterOperator(address operator) internal view virtual override {
- // Check registry code length to facilitate testing in environments without a deployed registry.
- if (
- !RevokableOperatorFiltererUpgradeableStorage.layout()._isOperatorFilterRegistryRevoked
- && address(OPERATOR_FILTER_REGISTRY).code.length > 0
- ) {
- // under normal circumstances, this function will revert rather than return false, but inheriting or
- // upgraded contracts may specify their own OperatorFilterRegistry implementations, which may behave
- // differently
- if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
- revert OperatorNotAllowed(operator);
- }
- }
- }
-
- /**
- * @notice Disable the isOperatorFilterRegistryRevoked flag. OnlyOwner.
- */
- function revokeOperatorFilterRegistry() external {
- if (msg.sender != owner()) {
- revert OnlyOwner();
- }
- if (RevokableOperatorFiltererUpgradeableStorage.layout()._isOperatorFilterRegistryRevoked) {
- revert AlreadyRevoked();
- }
- RevokableOperatorFiltererUpgradeableStorage.layout()._isOperatorFilterRegistryRevoked = true;
- emit OperatorFilterRegistryRevoked();
- }
-
- function isOperatorFilterRegistryRevoked() public view returns (bool) {
- return RevokableOperatorFiltererUpgradeableStorage.layout()._isOperatorFilterRegistryRevoked;
- }
-
- /**
- * @dev assume the contract has an owner, but leave specific Ownable implementation up to inheriting contract
- */
- function owner() public view virtual returns (address);
-}
diff --git a/src/upgradeable/UpdatableOperatorFiltererUpgradeable.sol b/src/upgradeable/UpdatableOperatorFiltererUpgradeable.sol
deleted file mode 100644
index 1cbdf1c..0000000
--- a/src/upgradeable/UpdatableOperatorFiltererUpgradeable.sol
+++ /dev/null
@@ -1,128 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OperatorFiltererUpgradeable} from "./OperatorFiltererUpgradeable.sol";
-import {IOperatorFilterRegistry} from "../IOperatorFilterRegistry.sol";
-
-/**
- * @title Upgradeable storage layout for UpdatableOperatorFiltererUpgradeable.
- * @author qed.team, abarbatei, balajmarius
- * @notice Upgradeable contracts must use a storage layout that can be used across upgrades.
- * Only append new variables to the end of the layout.
- */
-library UpdatableOperatorFiltererUpgradeableStorage {
- struct Layout {
- /// @dev Address of the opensea filter register contract
- address _operatorFilterRegistry;
- }
-
- /// @dev The EIP-1967 specific storage slot for the layout
- bytes32 internal constant STORAGE_SLOT =
- bytes32(uint256(keccak256(bytes("UpdatableOperatorFiltererUpgradeable.contracts.storage"))) - 1);
-
- /// @dev The layout of the storage.
- function layout() internal pure returns (Layout storage l) {
- bytes32 slot = STORAGE_SLOT;
- assembly {
- l.slot := slot
- }
- }
-}
-
-/**
- * @title UpdatableOperatorFiltererUpgradeable
- * @author qed.team, abarbatei, balajmarius
- * @notice Abstract contract whose init function automatically registers and optionally subscribes to or copies another
- * registrant's entries in the OperatorFilterRegistry. This contract allows the Owner to update the
- * OperatorFilterRegistry address via updateOperatorFilterRegistryAddress, including to the zero address,
- * which will bypass registry checks.
- * Note that OpenSea will still disable creator earnings enforcement if filtered operators begin fulfilling orders
- * on-chain, eg, if the registry is revoked or bypassed.
- * @dev This smart contract is meant to be inherited by token contracts so they can use the following:
- * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
- * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
- * Use updateOperatorFilterRegistryAddress function to change registry address if needed
- */
-abstract contract UpdatableOperatorFiltererUpgradeable is OperatorFiltererUpgradeable {
- using UpdatableOperatorFiltererUpgradeableStorage for UpdatableOperatorFiltererUpgradeableStorage.Layout;
-
- /// @notice Emitted when someone other than the owner is trying to call an only owner function.
- error OnlyOwner();
-
- /// @notice Emitted when the operator filter registry address is changed by the owner of the contract
- event OperatorFilterRegistryAddressUpdated(address newRegistry);
-
- /**
- * @notice Initialization function in accordance with the upgradable pattern
- * @dev The upgradeable initialize function specific to proxied contracts
- * @param _registry Registry address to which to register to for blocking operators that do not respect royalties
- * @param subscriptionOrRegistrantToCopy Subscription address to use as a template for when
- * imitating/copying blocked addresses and codehashes
- * @param subscribe If to subscribe to the subscriptionOrRegistrantToCopy address or just copy entries from it
- */
- function __UpdatableOperatorFiltererUpgradeable_init(
- address _registry,
- address subscriptionOrRegistrantToCopy,
- bool subscribe
- ) internal onlyInitializing {
- UpdatableOperatorFiltererUpgradeableStorage.layout()._operatorFilterRegistry = _registry;
- IOperatorFilterRegistry registry = IOperatorFilterRegistry(_registry);
- // If an inheriting token contract is deployed to a network without the registry deployed, the modifier
- // will not revert, but the contract will need to be registered with the registry once it is deployed in
- // order for the modifier to filter addresses.
- if (address(registry).code.length > 0) {
- if (subscribe) {
- registry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
- } else {
- if (subscriptionOrRegistrantToCopy != address(0)) {
- registry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
- } else {
- registry.register(address(this));
- }
- }
- }
- }
-
- /**
- * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
- * address, checks will be bypassed. OnlyOwner.
- * @custom:event OperatorFilterRegistryAddressUpdated
- * @param newRegistry The address of the registry that will be used for this contract
- */
- function updateOperatorFilterRegistryAddress(address newRegistry) public virtual {
- if (msg.sender != owner()) {
- revert OnlyOwner();
- }
- UpdatableOperatorFiltererUpgradeableStorage.layout()._operatorFilterRegistry = newRegistry;
- emit OperatorFilterRegistryAddressUpdated(newRegistry);
- }
-
- /**
- * @dev Helper function to return the value of the currently used registry address
- */
- function operatorFilterRegistry() public view returns (address) {
- return address(UpdatableOperatorFiltererUpgradeableStorage.layout()._operatorFilterRegistry);
- }
-
- /**
- * @dev Assume the contract has an owner, but leave specific Ownable implementation up to inheriting contract
- */
- function owner() public view virtual returns (address);
-
- /**
- * @dev A helper function to check if the operator is allowed
- */
- function _checkFilterOperator(address operator) internal view virtual override {
- IOperatorFilterRegistry registry =
- IOperatorFilterRegistry(UpdatableOperatorFiltererUpgradeableStorage.layout()._operatorFilterRegistry);
- // Check registry code length to facilitate testing in environments without a deployed registry.
- if (address(registry) != address(0) && address(registry).code.length > 0) {
- // under normal circumstances, this function will revert rather than return false, but inheriting or
- // upgraded contracts may specify their own OperatorFilterRegistry implementations, which may behave
- // differently
- if (!registry.isOperatorAllowed(address(this), operator)) {
- revert OperatorNotAllowed(operator);
- }
- }
- }
-}
diff --git a/test/BaseRegistryTest.sol b/test/BaseRegistryTest.sol
deleted file mode 100644
index 1e22530..0000000
--- a/test/BaseRegistryTest.sol
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {Test} from "forge-std/Test.sol";
-import {OperatorFilterRegistry, OperatorFilterRegistryErrorsAndEvents} from "../src/OperatorFilterRegistry.sol";
-
-contract BaseRegistryTest is Test, OperatorFilterRegistryErrorsAndEvents {
- OperatorFilterRegistry constant registry = OperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);
-
- function setUp() public virtual {
- address deployedRegistry = address(new OperatorFilterRegistry());
- vm.etch(address(registry), deployedRegistry.code);
- }
-}
diff --git a/test/DefaultOperatorFilterer.t.sol b/test/DefaultOperatorFilterer.t.sol
deleted file mode 100644
index cef4c55..0000000
--- a/test/DefaultOperatorFilterer.t.sol
+++ /dev/null
@@ -1,55 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {DefaultOperatorFilterer} from "../src/DefaultOperatorFilterer.sol";
-import {BaseRegistryTest} from "./BaseRegistryTest.sol";
-import {DefaultFilterer} from "./helpers/DefaultFilterer.sol";
-
-import {OperatorFilterer} from "../src/OperatorFilterer.sol";
-import {UpdatableFilterer} from "./helpers/UpdatableFilterer.sol";
-import {OperatorFilterRegistryStub} from "./helpers/OperatorFilterRegistryStub.sol";
-
-contract DefaultOperatorFiltererTest is BaseRegistryTest {
- DefaultFilterer filterer;
- address filteredAddress;
- address filteredCodeHashAddress;
- bytes32 filteredCodeHash;
- address notFiltered;
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public override {
- super.setUp();
- notFiltered = makeAddr("not filtered");
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
-
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
- filteredCodeHashAddress = makeAddr("filtered code hash");
- bytes memory code = hex"deadbeef";
- filteredCodeHash = keccak256(code);
- registry.updateCodeHash(address(DEFAULT_SUBSCRIPTION), filteredCodeHash, true);
- vm.etch(filteredCodeHashAddress, code);
-
- filterer = new DefaultFilterer();
- vm.stopPrank();
- }
-
- function testFilter() public {
- assertTrue(filterer.filterTest(notFiltered));
- vm.startPrank(filteredAddress);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- filterer.filterTest(address(0));
- vm.stopPrank();
- vm.startPrank(filteredCodeHashAddress);
- vm.expectRevert(abi.encodeWithSelector(CodeHashFiltered.selector, filteredCodeHashAddress, filteredCodeHash));
- filterer.filterTest(address(0));
- }
-
- function testRevert_OperatorNotAllowed() public {
- address stubRegistry = address(new OperatorFilterRegistryStub());
- UpdatableFilterer updatableFilterer = new UpdatableFilterer(stubRegistry);
- vm.expectRevert(abi.encodeWithSelector(OperatorFilterer.OperatorNotAllowed.selector, address(filteredAddress)));
- updatableFilterer.checkFilterOperator(filteredAddress);
- }
-}
diff --git a/test/OperatorFilterRegistry.t.sol b/test/OperatorFilterRegistry.t.sol
deleted file mode 100644
index 6b5dd53..0000000
--- a/test/OperatorFilterRegistry.t.sol
+++ /dev/null
@@ -1,864 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {BaseRegistryTest} from "./BaseRegistryTest.sol";
-import {OperatorFilterer} from "../src/OperatorFilterer.sol";
-import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
-
-contract Filterer is OperatorFilterer, Ownable {
- constructor(address registry) OperatorFilterer(address(0), false) {}
-
- function testFilter(address from) public view onlyAllowedOperator(from) returns (bool) {
- return true;
- }
-}
-
-contract Owned is Ownable {}
-
-contract OwnableReverter {
- error Bad();
-
- function owner() public pure returns (address) {
- revert Bad();
- }
-}
-
-contract OperatorFilterRegistryTest is BaseRegistryTest {
- Filterer filterer;
- Ownable owned;
- OwnableReverter reverter;
-
- function setUp() public override {
- super.setUp();
- filterer = new Filterer(address(registry));
- owned = new Owned();
- reverter = new OwnableReverter();
- }
-
- function testOnlyAddressOrOwner() public {
- vm.startPrank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSelector(NotOwnable.selector));
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(OnlyAddressOrOwner.selector));
- registry.register(address(owned));
- vm.expectRevert(abi.encodeWithSelector(OwnableReverter.Bad.selector));
- registry.register(address(reverter));
- }
-
- function testRegister_constructor() public {
- vm.expectEmit(true, false, false, false, address(registry));
- emit RegistrationUpdated(address(this), true);
- registry.register(address(this));
-
- assertTrue(registry.isRegistered(address(filterer)));
- assertEq(registry.subscriptionOf(address(filterer)), address(0));
- }
-
- function testRegister_onlyAddressOrOwner() public {
- vm.startPrank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSelector(OnlyAddressOrOwner.selector));
- registry.register(address(filterer));
- }
-
- function testRegister_alreadyRegistered() public {
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(AlreadyRegistered.selector));
- registry.register(address(this));
- }
-
- function testRegisterAndSubscribe() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- vm.expectEmit(true, false, false, false, address(registry));
- emit RegistrationUpdated(address(this), true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit SubscriptionUpdated(address(this), subscription, true);
- registry.registerAndSubscribe(address(this), subscription);
- assertEq(registry.subscribers(subscription).length, 1);
- assertEq(registry.subscribers(subscription)[0], address(this));
- assertEq(registry.subscriberAt(subscription, 0), address(this));
- }
-
- function testRegisterAndSubscribe_OnlyAddressOrOwner() public {
- address subscription = makeAddr("subscription");
- vm.startPrank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSelector(OnlyAddressOrOwner.selector));
- registry.registerAndSubscribe(address(owned), subscription);
- }
-
- function testRegisterAndSubscribe_AlreadyRegistered() public {
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(AlreadyRegistered.selector));
- registry.registerAndSubscribe(address(this), makeAddr("subscription"));
- }
-
- function testRegisterAndSubscribe_CannotRegisterToSelf() public {
- vm.expectRevert(abi.encodeWithSelector(CannotSubscribeToSelf.selector));
- registry.registerAndSubscribe(address(this), address(this));
- }
-
- function testRegisterAndSubscribe_NotRegistered() public {
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, makeAddr("subscription")));
- registry.registerAndSubscribe(address(this), makeAddr("subscription"));
- }
-
- function testRegisterAndSubscribe_CannotSubscribeToRegistrantWithSubscription() public {
- address subscription = makeAddr("subscription");
- address superSubscription = makeAddr("superSubscription");
- vm.prank(superSubscription);
- registry.register(superSubscription);
- vm.prank(subscription);
- registry.registerAndSubscribe(subscription, superSubscription);
- vm.expectRevert(abi.encodeWithSelector(CannotSubscribeToRegistrantWithSubscription.selector, subscription));
- registry.registerAndSubscribe(address(this), subscription);
- }
-
- function testRegisterAndCopyEntries() public {
- registry.register(address(this));
- registry.updateOperator(address(this), makeAddr("operator"), true);
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeadbeef)), true);
-
- vm.expectEmit(true, true, true, false, address(registry));
- emit OperatorUpdated(address(filterer), makeAddr("operator"), true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit CodeHashUpdated(address(filterer), bytes32(bytes4(0xdeadbeef)), true);
-
- registry.copyEntriesOf(address(filterer), address(this));
-
- assertEq(registry.subscribers(address(this)).length, 0);
- assertTrue(registry.isRegistered(address(filterer)));
- assertEq(registry.filteredOperatorAt(address(filterer), 0), makeAddr("operator"));
- assertEq(registry.filteredCodeHashAt(address(filterer), 0), bytes32(bytes4(0xdeadbeef)));
- }
-
- function testRegisterAndCopyEntries_OnlyAddressOrOwner() public {
- vm.startPrank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSelector(OnlyAddressOrOwner.selector));
- registry.registerAndCopyEntries(address(filterer), address(this));
- }
-
- function testRegisterAndCopyEntries_CannotCopyFromSelf() public {
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(CannotCopyFromSelf.selector));
- registry.registerAndCopyEntries(address(this), address(this));
- }
-
- function testRegisterAndCopyEntries_AlreadyRegistered() public {
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(AlreadyRegistered.selector));
- registry.registerAndCopyEntries(address(this), makeAddr("not registered but fail fast"));
- }
-
- function testRegisterAndCopyEntries_NotRegistered() public {
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, makeAddr("registrant")));
- registry.registerAndCopyEntries(address(this), makeAddr("registrant"));
- }
-
- function testUpdateOperator() public {
- registry.register(address(this));
- vm.expectEmit(true, true, true, false, address(registry));
- emit OperatorUpdated(address(this), makeAddr("operator"), true);
- registry.updateOperator(address(this), makeAddr("operator"), true);
- assertTrue(registry.isOperatorFiltered(address(this), makeAddr("operator")));
- assertEq(registry.filteredOperatorAt(address(this), 0), makeAddr("operator"));
- }
-
- function testUpdateOperator_OnlyAddressOrOwner() public {
- vm.startPrank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSelector(OnlyAddressOrOwner.selector));
- registry.updateOperator(address(owned), makeAddr("operator"), true);
- }
-
- function testUpdateOperator_notRegistered() public {
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, address(this)));
- registry.updateOperator(address(this), makeAddr("operator"), true);
- }
-
- function testUpdateOperator_CannotUpdateWhileSubscribed() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- registry.registerAndSubscribe(address(this), subscription);
- vm.expectRevert(abi.encodeWithSelector(CannotUpdateWhileSubscribed.selector, subscription));
- registry.updateOperator(address(this), makeAddr("operator"), true);
- }
-
- function testUpdateOperator_unfilter() public {
- registry.register(address(this));
- registry.updateOperator(address(this), makeAddr("operator"), true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit OperatorUpdated(address(this), makeAddr("operator"), false);
- registry.updateOperator(address(this), makeAddr("operator"), false);
- assertFalse(registry.isOperatorFiltered(address(this), makeAddr("operator")));
- vm.expectRevert();
- registry.filteredOperatorAt(address(this), 0);
- }
-
- function testUpdateOperator_AddressNotFiltered() public {
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(AddressNotFiltered.selector, makeAddr("operator")));
- registry.updateOperator(address(this), makeAddr("operator"), false);
- }
-
- function testUpdateOperator_AddressAlreadyFiltered() public {
- registry.register(address(this));
- registry.updateOperator(address(this), makeAddr("operator"), true);
- vm.expectRevert(abi.encodeWithSelector(AddressAlreadyFiltered.selector, makeAddr("operator")));
- registry.updateOperator(address(this), makeAddr("operator"), true);
- }
-
- function testUpdateCodeHash() public {
- registry.register(address(this));
- vm.expectEmit(true, true, true, false, address(registry));
- emit CodeHashUpdated(address(this), bytes32(bytes4(0xdeadbeef)), true);
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeadbeef)), true);
- assertTrue(registry.isCodeHashFiltered(address(this), bytes32(bytes4(0xdeadbeef))));
- assertEq(registry.filteredCodeHashAt(address(this), 0), bytes32(bytes4(0xdeadbeef)));
- }
-
- function testUpdateCodeHash_OnlyAddressOrOwner() public {
- vm.startPrank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSelector(OnlyAddressOrOwner.selector));
- registry.updateCodeHash(address(owned), bytes32(bytes4(0xdeadbeef)), true);
- }
-
- function testUpdateCodeHash_CannotFilterEOAs() public {
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(CannotFilterEOAs.selector));
- registry.updateCodeHash(address(this), keccak256(""), true);
- }
-
- function testUpdateCodeHash_NotRegistered() public {
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, address(this)));
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeadbeef)), true);
- }
-
- function testUpdateCodeHash_CannotUpdateWhileSubscribed() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- registry.registerAndSubscribe(address(this), subscription);
- vm.expectRevert(abi.encodeWithSelector(CannotUpdateWhileSubscribed.selector, subscription));
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeadbeef)), true);
- }
-
- function testUpdateCodeHash_unfilter() public {
- registry.register(address(this));
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeadbeef)), true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit CodeHashUpdated(address(this), bytes32(bytes4(0xdeadbeef)), false);
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeadbeef)), false);
- assertFalse(registry.isCodeHashFiltered(address(this), bytes32(bytes4(0xdeadbeef))));
- vm.expectRevert();
- registry.filteredCodeHashAt(address(this), 0);
- }
-
- function testUpdateCodeHash_CodeHashNotFiltered() public {
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(CodeHashNotFiltered.selector, bytes32(bytes4(0xdeadbeef))));
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeadbeef)), false);
- }
-
- function testUpdateCodeHash_CodeHashAlreadyFiltered() public {
- registry.register(address(this));
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeadbeef)), true);
- vm.expectRevert(abi.encodeWithSelector(CodeHashAlreadyFiltered.selector, bytes32(bytes4(0xdeadbeef))));
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeadbeef)), true);
- }
-
- function testUpdateOperators() public {
- registry.register(address(this));
-
- address[] memory operator = new address[](2);
- operator[0] = makeAddr("operator1");
- operator[1] = makeAddr("operator2");
- vm.expectEmit(true, true, false, false, address(registry));
- emit OperatorsUpdated(address(this), operator, true);
- registry.updateOperators(address(this), operator, true);
- assertTrue(registry.isOperatorFiltered(address(this), operator[0]));
- assertTrue(registry.isOperatorFiltered(address(this), operator[1]));
- assertEq(registry.filteredOperatorAt(address(this), 0), operator[0]);
- assertEq(registry.filteredOperatorAt(address(this), 1), operator[1]);
- }
-
- function testUpdateOperators_OnlyAddressOrOwner() public {
- vm.startPrank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSelector(OnlyAddressOrOwner.selector));
- address[] memory operator = new address[](1);
- operator[0] = makeAddr("operator1");
- registry.updateOperators(address(owned), operator, true);
- }
-
- function testUpdateOperators_notRegistered() public {
- address[] memory operator = new address[](2);
- operator[0] = makeAddr("operator1");
- operator[1] = makeAddr("operator2");
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, address(this)));
- registry.updateOperators(address(this), operator, true);
- }
-
- function testUpdateOperators_CannotUpdateWhileSubscribed() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- registry.registerAndSubscribe(address(this), subscription);
- address[] memory operator = new address[](2);
- operator[0] = makeAddr("operator1");
- operator[1] = makeAddr("operator2");
- vm.expectRevert(abi.encodeWithSelector(CannotUpdateWhileSubscribed.selector, subscription));
- registry.updateOperators(address(this), operator, true);
- }
-
- function testUpdateOperators_unfilter() public {
- registry.register(address(this));
- registry.updateOperator(address(this), makeAddr("operator1"), true);
- registry.updateOperator(address(this), makeAddr("operator2"), true);
-
- address[] memory operator = new address[](2);
- operator[0] = makeAddr("operator1");
- operator[1] = makeAddr("operator2");
- vm.expectEmit(true, true, true, false, address(registry));
- emit OperatorsUpdated(address(this), operator, false);
- registry.updateOperators(address(this), operator, false);
- assertFalse(registry.isOperatorFiltered(address(this), operator[0]));
- assertFalse(registry.isOperatorFiltered(address(this), operator[1]));
- vm.expectRevert();
- registry.filteredOperatorAt(address(this), 0);
- }
-
- function testUpdateOperators_AddressNotFiltered() public {
- registry.register(address(this));
- address[] memory operator = new address[](2);
- operator[0] = makeAddr("operator1");
- operator[1] = makeAddr("operator2");
- vm.expectRevert(abi.encodeWithSelector(AddressNotFiltered.selector, makeAddr("operator1")));
- registry.updateOperators(address(this), operator, false);
- }
-
- function testUpdateOperators_AddressAlreadyFiltered() public {
- registry.register(address(this));
- registry.updateOperator(address(this), makeAddr("operator1"), true);
- registry.updateOperator(address(this), makeAddr("operator2"), true);
- address[] memory operator = new address[](2);
- operator[0] = makeAddr("operator1");
- operator[1] = makeAddr("operator2");
- vm.expectRevert(abi.encodeWithSelector(AddressAlreadyFiltered.selector, makeAddr("operator1")));
- registry.updateOperators(address(this), operator, true);
- }
-
- function testUpdateCodeHashes() public {
- registry.register(address(this));
- bytes32[] memory codeHash = new bytes32[](2);
- codeHash[0] = bytes32(bytes4(0xdeadbeef));
- codeHash[1] = bytes32(bytes4(0xdeafbeef));
- vm.expectEmit(true, true, false, false, address(registry));
- emit CodeHashesUpdated(address(this), codeHash, true);
- registry.updateCodeHashes(address(this), codeHash, true);
- }
-
- function testUpdateCodeHashes_OnlyAddressOrOwner() public {
- vm.startPrank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSelector(OnlyAddressOrOwner.selector));
- bytes32[] memory codeHash = new bytes32[](1);
- codeHash[0] = bytes32(bytes4(0xdeadbeef));
- registry.updateCodeHashes(address(owned), codeHash, true);
- }
-
- function testUpdateCodeHashes_notRegistered() public {
- bytes32[] memory codeHash = new bytes32[](2);
- codeHash[0] = bytes32(bytes4(0xdeadbeef));
- codeHash[1] = bytes32(bytes4(0xdeafbeef));
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, address(this)));
- registry.updateCodeHashes(address(this), codeHash, true);
- }
-
- function testUpdateCodeHashes_CannotUpdateWhileSubscribed() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- registry.registerAndSubscribe(address(this), subscription);
- bytes32[] memory codeHash = new bytes32[](2);
- codeHash[0] = bytes32(bytes4(0xdeadbeef));
- codeHash[1] = bytes32(bytes4(0xdeafbeef));
- vm.expectRevert(abi.encodeWithSelector(CannotUpdateWhileSubscribed.selector, subscription));
- registry.updateCodeHashes(address(this), codeHash, true);
- }
-
- function testUpdateCodeHashes_unfilter() public {
- registry.register(address(this));
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeadbeef)), true);
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeafbeef)), true);
-
- bytes32[] memory codeHash = new bytes32[](2);
- codeHash[0] = bytes32(bytes4(0xdeadbeef));
- codeHash[1] = bytes32(bytes4(0xdeafbeef));
- vm.expectEmit(true, true, false, false, address(registry));
- emit CodeHashesUpdated(address(this), codeHash, false);
- registry.updateCodeHashes(address(this), codeHash, false);
- assertFalse(registry.isCodeHashFiltered(address(this), codeHash[0]));
- assertFalse(registry.isCodeHashFiltered(address(this), codeHash[1]));
- vm.expectRevert();
- registry.filteredCodeHashAt(address(this), 0);
- }
-
- function testUpdateCodeHashes_CodeHashNotFiltered() public {
- registry.register(address(this));
- bytes32[] memory codeHash = new bytes32[](2);
- codeHash[0] = bytes32(bytes4(0xdeadbeef));
- codeHash[1] = bytes32(bytes4(0xdeafbeef));
- vm.expectRevert(abi.encodeWithSelector(CodeHashNotFiltered.selector, bytes32(bytes4(0xdeadbeef))));
- registry.updateCodeHashes(address(this), codeHash, false);
- }
-
- function testUpdateCodeHashes_CannotFilterEOAs() public {
- registry.register(address(this));
- bytes32[] memory codeHash = new bytes32[](2);
- codeHash[0] = bytes32(bytes4(0xdeadbeef));
- codeHash[1] = keccak256("");
- vm.expectRevert(CannotFilterEOAs.selector);
- registry.updateCodeHashes(address(this), codeHash, true);
- }
-
- function testUpdateCodeHashes_CodeHashAlreadyFiltered() public {
- registry.register(address(this));
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeadbeef)), true);
- registry.updateCodeHash(address(this), bytes32(bytes4(0xdeafbeef)), true);
- bytes32[] memory codeHash = new bytes32[](2);
- codeHash[0] = bytes32(bytes4(0xdeadbeef));
- codeHash[1] = bytes32(bytes4(0xdeafbeef));
- vm.expectRevert(abi.encodeWithSelector(CodeHashAlreadyFiltered.selector, bytes32(bytes4(0xdeadbeef))));
- registry.updateCodeHashes(address(this), codeHash, true);
- }
-
- function testSubscribe() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- registry.register(address(this));
- vm.expectEmit(true, true, true, false, address(registry));
- emit SubscriptionUpdated(address(this), subscription, true);
- registry.subscribe(address(this), subscription);
-
- assertEq(registry.subscriptionOf(address(this)), subscription);
- assertEq(registry.subscribers(subscription).length, 1);
- assertEq(registry.subscribers(subscription)[0], address(this));
- assertEq(registry.subscriberAt(subscription, 0), address(this));
- }
-
- function testSubscribe_OnlyAddressOrOwner() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- vm.startPrank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSelector(OnlyAddressOrOwner.selector));
- registry.subscribe(address(owned), subscription);
- }
-
- function testSubscribe_CannotSubscribeToSelf() public {
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(CannotSubscribeToSelf.selector));
- registry.subscribe(address(this), address(this));
- }
-
- function testSubscribe_CannotSubscribeToZeroAddress() public {
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(CannotSubscribeToZeroAddress.selector));
- registry.subscribe(address(this), address(0));
- }
-
- function testSubscribe_notRegistered() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, address(this)));
- registry.subscribe(address(this), subscription);
- }
-
- function testSubscribe_AlreadySubscribed() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- registry.register(address(this));
- registry.subscribe(address(this), subscription);
- vm.expectRevert(abi.encodeWithSelector(AlreadySubscribed.selector, subscription));
- registry.subscribe(address(this), subscription);
- }
-
- function testSubscribe_SubscriptionNotRegistered() public {
- registry.register(address(this));
- address subscription = makeAddr("subscription");
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, subscription));
- registry.subscribe(address(this), subscription);
- }
-
- function testSubscribe_removeOldSubscription() public {
- address oldSubscription = makeAddr("oldSubscription");
- vm.prank(oldSubscription);
- registry.register(oldSubscription);
- registry.register(address(this));
- registry.subscribe(address(this), oldSubscription);
-
- address newSubscription = makeAddr("newSubscription");
- vm.prank(newSubscription);
- registry.register(newSubscription);
- vm.expectEmit(true, true, true, false, address(registry));
- emit SubscriptionUpdated(address(this), oldSubscription, false);
- vm.expectEmit(true, true, true, false, address(registry));
- emit SubscriptionUpdated(address(this), newSubscription, true);
- registry.subscribe(address(this), newSubscription);
-
- assertEq(registry.subscriptionOf(address(this)), newSubscription);
- assertEq(registry.subscribers(oldSubscription).length, 0);
- assertEq(registry.subscribers(newSubscription).length, 1);
- assertEq(registry.subscribers(newSubscription)[0], address(this));
- assertEq(registry.subscriberAt(newSubscription, 0), address(this));
- }
-
- function testSubscribe_CannotSubscribeToRegistrantWithSubscription() public {
- address subscription = makeAddr("subscription");
- address superSubscription = makeAddr("superSubscription");
- vm.prank(superSubscription);
- registry.register(superSubscription);
- vm.prank(subscription);
- registry.registerAndSubscribe(subscription, superSubscription);
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(CannotSubscribeToRegistrantWithSubscription.selector, subscription));
- registry.subscribe(address(this), subscription);
- }
-
- function testUnsubscribe() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- registry.register(address(this));
- registry.subscribe(address(this), subscription);
-
- vm.expectEmit(true, true, true, false, address(registry));
- emit SubscriptionUpdated(address(this), subscription, false);
- registry.unsubscribe(address(this), false);
-
- assertEq(registry.subscriptionOf(address(this)), address(0));
- assertEq(registry.subscribers(subscription).length, 0);
- assertEq(registry.subscriptionOf(address(this)), address(0));
- }
-
- function testUnsubscribe_notRegistered() public {
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, address(this)));
- registry.unregister(address(this));
- }
-
- function testUnsubscribe_onlyAddressOrOwner() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- registry.register(address(this));
- registry.subscribe(address(this), subscription);
-
- vm.startPrank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSelector(OnlyAddressOrOwner.selector));
- registry.unsubscribe(address(owned), false);
- }
-
- function testUnsubscribe_copyExistingEntries() public {
- address subscription = makeAddr("subscription");
- address operator = makeAddr("operator");
- bytes32 codeHash = bytes32(bytes4(0xdeadbeef));
- vm.startPrank(subscription);
- registry.register(subscription);
- registry.updateOperator(subscription, operator, true);
- registry.updateCodeHash(subscription, codeHash, true);
- vm.stopPrank();
- registry.register(address(this));
- registry.subscribe(address(this), subscription);
-
- vm.expectEmit(true, true, true, false, address(registry));
- emit SubscriptionUpdated(address(this), subscription, false);
- vm.expectEmit(true, true, true, false, address(registry));
- emit OperatorUpdated(address(this), operator, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit CodeHashUpdated(address(this), codeHash, true);
- registry.unsubscribe(address(this), true);
-
- assertEq(registry.subscriptionOf(address(this)), address(0));
- }
-
- function testUnsubscribe_NotRegistered() public {
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, address(this)));
- registry.unsubscribe(address(this), false);
- }
-
- function testUnsubscribe_NotSubscribed() public {
- registry.register(address(this));
- vm.expectRevert(abi.encodeWithSelector(NotSubscribed.selector));
- registry.unsubscribe(address(this), false);
- }
-
- function testCopyEntriesOf() public {
- address subscription = makeAddr("subscription");
- address operator = makeAddr("operator");
- address duplicateOperator = makeAddr("duplicateOperator");
- bytes32 codeHash = bytes32(bytes4(0xdeadbeef));
- bytes32 duplicateCodeHash = bytes32(bytes5(0xdeadbeef22));
- vm.startPrank(subscription);
- registry.register(subscription);
- registry.updateOperator(subscription, operator, true);
- registry.updateOperator(subscription, duplicateOperator, true);
- registry.updateCodeHash(subscription, codeHash, true);
- registry.updateCodeHash(subscription, duplicateCodeHash, true);
- vm.stopPrank();
- // test that it does not throw errors for duplicate entries
- // and that events are not emitted for them
- registry.register(address(this));
- registry.updateOperator(address(this), duplicateOperator, true);
- registry.updateCodeHash(address(this), duplicateCodeHash, true);
-
- vm.expectEmit(true, true, true, false, address(registry));
- emit OperatorUpdated(address(this), operator, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit CodeHashUpdated(address(this), codeHash, true);
- registry.copyEntriesOf(address(this), subscription);
-
- assertEq(registry.filteredOperators(address(this)).length, 2);
- assertEq(registry.filteredOperators(address(this))[0], duplicateOperator);
- assertEq(registry.filteredOperatorAt(address(this), 0), duplicateOperator);
- assertEq(registry.filteredOperators(address(this))[1], operator);
- assertEq(registry.filteredOperatorAt(address(this), 1), operator);
-
- assertEq(registry.filteredCodeHashes(address(this)).length, 2);
- assertEq(registry.filteredCodeHashes(address(this))[0], duplicateCodeHash);
- assertEq(registry.filteredCodeHashAt(address(this), 0), duplicateCodeHash);
- assertEq(registry.filteredCodeHashes(address(this))[1], codeHash);
- assertEq(registry.filteredCodeHashAt(address(this), 1), codeHash);
- }
-
- function testCopyEntriesOf_cannotCopySelf() public {
- registry.register(address(this));
- vm.expectRevert(CannotCopyFromSelf.selector);
- registry.copyEntriesOf(address(this), address(this));
- }
-
- function testCopyEntriesOf_OnlyAddressOrOwner() public {
- address subscription = makeAddr("subscription");
- vm.startPrank(subscription);
- registry.register(subscription);
- vm.stopPrank();
- registry.register(address(this));
-
- vm.startPrank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSelector(OnlyAddressOrOwner.selector));
- registry.copyEntriesOf(address(owned), subscription);
- }
-
- function testCopyEntriesOf_NotRegistered() public {
- address subscription = makeAddr("subscription");
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, address(this)));
- registry.copyEntriesOf(address(this), subscription);
- }
-
- function testCopyEntriesOf_CannotUpdateWhileSubscribed() public {
- address subscription = makeAddr("subscription");
- address operator = makeAddr("operator");
- bytes32 codeHash = bytes32(bytes4(0xdeadbeef));
- vm.startPrank(subscription);
- registry.register(subscription);
- registry.updateOperator(subscription, operator, true);
- registry.updateCodeHash(subscription, codeHash, true);
- vm.stopPrank();
- registry.register(address(this));
- registry.subscribe(address(this), subscription);
-
- vm.expectRevert(abi.encodeWithSelector(CannotUpdateWhileSubscribed.selector, subscription));
- registry.copyEntriesOf(address(this), subscription);
- }
-
- function testCopyEntriesOf_NotRegistered_registrant() public {
- registry.register(address(this));
- address subscription = makeAddr("subscription");
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, subscription));
- registry.copyEntriesOf(address(this), subscription);
- }
-
- function testCodeHashOf() public {
- address toCheck = makeAddr("toCheck");
- bytes memory code = hex"deadbeef";
- bytes32 codeHash = keccak256(code);
- vm.etch(toCheck, code);
- assertEq(registry.codeHashOf(toCheck), codeHash);
- }
-
- function testIsCodeHashOfFiltered() public {
- address toCheck = makeAddr("toCheck");
- bytes memory code = hex"deadbeef";
- bytes32 codeHash = keccak256(code);
- vm.etch(toCheck, code);
- registry.register(address(this));
- registry.updateCodeHash(address(this), codeHash, true);
- assertTrue(registry.isCodeHashOfFiltered(address(this), toCheck));
- assertFalse(registry.isCodeHashOfFiltered(address(this), makeAddr("not filtered")));
- }
-
- function testIsCodeHashOfFiltered_subscription() public {
- address toCheck = makeAddr("toCheck");
- bytes memory code = hex"deadbeef";
- bytes32 codeHash = keccak256(code);
- vm.etch(toCheck, code);
- address subscription = makeAddr("subscription");
- vm.startPrank(subscription);
- registry.register(subscription);
- registry.updateCodeHash(subscription, codeHash, true);
- vm.stopPrank();
- registry.registerAndSubscribe(address(this), subscription);
- assertTrue(registry.isCodeHashOfFiltered(address(this), toCheck));
- assertFalse(registry.isCodeHashOfFiltered(address(this), makeAddr("not filtered")));
- }
-
- function testIsCodeHashFiltered_subscription() public {
- address toCheck = makeAddr("toCheck");
- bytes memory code = hex"deadbeef";
- bytes32 codeHash = keccak256(code);
- vm.etch(toCheck, code);
- address subscription = makeAddr("subscription");
- vm.startPrank(subscription);
- registry.register(subscription);
- registry.updateCodeHash(subscription, codeHash, true);
- vm.stopPrank();
- registry.registerAndSubscribe(address(this), subscription);
- assertTrue(registry.isCodeHashFiltered(address(this), codeHash));
- assertFalse(registry.isCodeHashFiltered(address(this), bytes32(bytes4(0xdeadbeef))));
- }
-
- function testIsOperatorFiltered_subscription() public {
- address operator = makeAddr("operator");
- address subscription = makeAddr("subscription");
- vm.startPrank(subscription);
- registry.register(subscription);
- registry.updateOperator(subscription, operator, true);
- vm.stopPrank();
- registry.registerAndSubscribe(address(this), subscription);
- assertTrue(registry.isOperatorFiltered(address(this), operator));
- assertFalse(registry.isOperatorFiltered(address(this), makeAddr("not filtered")));
- }
-
- function testFilteredOperators_subscription() public {
- address operator = makeAddr("operator");
- address subscription = makeAddr("subscription");
- vm.startPrank(subscription);
- registry.register(subscription);
- registry.updateOperator(subscription, operator, true);
- vm.stopPrank();
- registry.registerAndSubscribe(address(this), subscription);
- assertEq(registry.filteredOperators(address(this)).length, 1);
- assertEq(registry.filteredOperators(address(this))[0], operator);
- assertEq(registry.filteredOperatorAt(address(this), 0), operator);
- }
-
- function testFilteredCodeHashes_subscription() public {
- address toCheck = makeAddr("toCheck");
- bytes memory code = hex"deadbeef";
- bytes32 codeHash = keccak256(code);
- vm.etch(toCheck, code);
- address subscription = makeAddr("subscription");
- vm.startPrank(subscription);
- registry.register(subscription);
- registry.updateCodeHash(subscription, codeHash, true);
- vm.stopPrank();
- registry.registerAndSubscribe(address(this), subscription);
- assertEq(registry.filteredCodeHashes(address(this)).length, 1);
- assertEq(registry.filteredCodeHashes(address(this))[0], codeHash);
- assertEq(registry.filteredCodeHashAt(address(this), 0), codeHash);
- }
-
- function testFilteredOperatorAt_subscription() public {
- address operator = makeAddr("operator");
- address subscription = makeAddr("subscription");
- vm.startPrank(subscription);
- registry.register(subscription);
- registry.updateOperator(subscription, operator, true);
- vm.stopPrank();
- registry.registerAndSubscribe(address(this), subscription);
- assertEq(registry.filteredOperatorAt(address(this), 0), operator);
- }
-
- function testFilteredCodeHashAt_subscription() public {
- address toCheck = makeAddr("toCheck");
- bytes memory code = hex"deadbeef";
- bytes32 codeHash = keccak256(code);
- vm.etch(toCheck, code);
- address subscription = makeAddr("subscription");
- vm.startPrank(subscription);
- registry.register(subscription);
- registry.updateCodeHash(subscription, codeHash, true);
- vm.stopPrank();
- registry.registerAndSubscribe(address(this), subscription);
- assertEq(registry.filteredCodeHashAt(address(this), 0), codeHash);
- }
-
- function testIsRegistered() public {
- registry.register(address(this));
- assertTrue(registry.isRegistered(address(this)));
- assertFalse(registry.isRegistered(makeAddr("not registered")));
- }
-
- function testIsOperatorAllowed_NotRegistered() public {
- assertTrue(registry.isOperatorAllowed(address(this), makeAddr("allowed")));
- }
-
- function testIsOperatorAllowed() public {
- address operator = makeAddr("operator");
- address toCheck = makeAddr("toCheck");
- bytes memory code = hex"deadbeef";
- bytes32 codeHash = keccak256(code);
- vm.etch(toCheck, code);
- registry.register(address(this));
- registry.updateOperator(address(this), operator, true);
- registry.updateCodeHash(address(this), codeHash, true);
-
- assertTrue(registry.isOperatorAllowed(address(this), makeAddr("allowed")));
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, address(operator)));
- registry.isOperatorAllowed(address(this), operator);
- vm.expectRevert(abi.encodeWithSelector(CodeHashFiltered.selector, address(toCheck), codeHash));
- registry.isOperatorAllowed(address(this), toCheck);
- }
-
- function testIsOperatorAllowed_subscription() public {
- address operator = makeAddr("operator");
- address toCheck = makeAddr("toCheck");
- bytes memory code = hex"deadbeef";
- bytes32 codeHash = keccak256(code);
- vm.etch(toCheck, code);
- address subscription = makeAddr("subscription");
- vm.startPrank(subscription);
- registry.register(subscription);
- registry.updateOperator(subscription, operator, true);
- registry.updateCodeHash(subscription, codeHash, true);
- vm.stopPrank();
- registry.registerAndSubscribe(address(this), subscription);
-
- assertTrue(registry.isOperatorAllowed(address(this), makeAddr("allowed")));
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, address(operator)));
- registry.isOperatorAllowed(address(this), operator);
- vm.expectRevert(abi.encodeWithSelector(CodeHashFiltered.selector, address(toCheck), codeHash));
- registry.isOperatorAllowed(address(this), toCheck);
- }
-
- function testUnregister() public {
- address subscription = makeAddr("subscription");
- vm.prank(subscription);
- registry.register(subscription);
- registry.registerAndSubscribe(address(this), subscription);
- assertTrue(registry.isRegistered(address(this)));
- vm.expectEmit(true, true, true, false, address(registry));
- emit SubscriptionUpdated(address(this), subscription, false);
- vm.expectEmit(true, true, true, false, address(registry));
- emit RegistrationUpdated(address(this), false);
- registry.unregister(address(this));
- assertFalse(registry.isRegistered(address(this)));
- assertEq(registry.subscribers(subscription).length, 0);
- }
-
- function testSubscriptionOf_notRegistered() public {
- vm.expectRevert(abi.encodeWithSelector(NotRegistered.selector, address(this)));
- registry.subscriptionOf(address(this));
- }
-}
diff --git a/test/OperatorFilterer.t.sol b/test/OperatorFilterer.t.sol
deleted file mode 100644
index 68c2c67..0000000
--- a/test/OperatorFilterer.t.sol
+++ /dev/null
@@ -1,93 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OperatorFilterer} from "../src/OperatorFilterer.sol";
-import {BaseRegistryTest} from "./BaseRegistryTest.sol";
-import {Vm} from "forge-std/Vm.sol";
-import {Filterer} from "./helpers/Filterer.sol";
-import {UpdatableFilterer} from "./helpers/UpdatableFilterer.sol";
-import {OperatorFilterRegistryStub} from "./helpers/OperatorFilterRegistryStub.sol";
-
-contract ConcreteOperatorFilterer is OperatorFilterer {
- constructor(address registrant, bool sub) OperatorFilterer(registrant, sub) {}
-}
-
-contract OperatorFiltererTest1 is BaseRegistryTest {
- Filterer filterer;
- address filteredAddress;
- address filteredCodeHashAddress;
- bytes32 filteredCodeHash;
- address notFiltered;
-
- function setUp() public override {
- super.setUp();
- notFiltered = makeAddr("not filtered");
- filterer = new Filterer();
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(filterer), filteredAddress, true);
- filteredCodeHashAddress = makeAddr("filtered code hash");
- bytes memory code = hex"deadbeef";
- filteredCodeHash = keccak256(code);
- registry.updateCodeHash(address(filterer), filteredCodeHash, true);
- vm.etch(filteredCodeHashAddress, code);
- }
-
- function testFilter() public {
- assertTrue(filterer.testFilter(notFiltered));
- vm.startPrank(filteredAddress);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- filterer.testFilter(address(0));
- vm.stopPrank();
- vm.startPrank(filteredCodeHashAddress);
- vm.expectRevert(abi.encodeWithSelector(CodeHashFiltered.selector, filteredCodeHashAddress, filteredCodeHash));
- filterer.testFilter(address(0));
- }
-
- event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
-
- function testConstructory_noSubscribeOrCopy() public {
- vm.recordLogs();
- Filterer filterer2 = new Filterer();
- Vm.Log[] memory logs = vm.getRecordedLogs();
-
- assertEq(logs.length, 2);
- assertEq(logs[0].topics[0], keccak256("RegistrationUpdated(address,bool)"));
- assertEq(address(uint160(uint256(logs[0].topics[1]))), address(filterer2));
- assertEq(logs[1].topics[0], keccak256("OwnershipTransferred(address,address)"));
- }
-
- function testConstructor_copy() public {
- address deployed = computeCreateAddress(address(this), vm.getNonce(address(this)));
- vm.expectEmit(true, false, false, false, address(registry));
- emit RegistrationUpdated(deployed, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit OperatorUpdated(deployed, filteredAddress, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit CodeHashUpdated(deployed, filteredCodeHash, true);
- new ConcreteOperatorFilterer(address(filterer), false);
- }
-
- function testConstructor_subscribe() public {
- address deployed = computeCreateAddress(address(this), vm.getNonce(address(this)));
- vm.expectEmit(true, false, false, false, address(registry));
- emit RegistrationUpdated(deployed, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit SubscriptionUpdated(deployed, address(filterer), true);
- vm.recordLogs();
- new ConcreteOperatorFilterer(address(filterer), true);
- assertEq(vm.getRecordedLogs().length, 2);
- }
-
- function testRegistryNotDeployedDoesNotRevert() public {
- vm.etch(address(registry), "");
- Filterer filterer2 = new Filterer();
- assertTrue(filterer2.testFilter(notFiltered));
- }
-
- function testRevert_OperatorNotAllowed() public {
- address stubRegistry = address(new OperatorFilterRegistryStub());
- UpdatableFilterer updatableFilterer = new UpdatableFilterer(stubRegistry);
- vm.expectRevert(abi.encodeWithSelector(OperatorFilterer.OperatorNotAllowed.selector, address(filteredAddress)));
- updatableFilterer.checkFilterOperator(filteredAddress);
- }
-}
diff --git a/test/OwnedRegistrant.t.sol b/test/OwnedRegistrant.t.sol
deleted file mode 100644
index 76ee496..0000000
--- a/test/OwnedRegistrant.t.sol
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OwnedRegistrant} from "../src/OwnedRegistrant.sol";
-import {BaseRegistryTest} from "./BaseRegistryTest.sol";
-
-contract OperatorFiltererTest is BaseRegistryTest {
- OwnedRegistrant registrant;
- address filteredAddress;
- address filteredCodeHashAddress;
- bytes32 filteredCodeHash;
-
- function setUp() public override {
- super.setUp();
-
- registrant = new OwnedRegistrant(address(this));
- filteredAddress = makeAddr("filtered address");
- filteredCodeHashAddress = makeAddr("filtered code hash");
- bytes memory code = hex"deadbeef";
- filteredCodeHash = keccak256(code);
- }
-
- function testConstructor() public {
- assertTrue(registry.isRegistered(address(registrant)));
- registry.updateOperator(address(registrant), filteredAddress, true);
- assertTrue(registry.isOperatorFiltered(address(registrant), filteredAddress));
- }
-}
diff --git a/test/RevokableDefaultOperatorFilterer.t.sol b/test/RevokableDefaultOperatorFilterer.t.sol
deleted file mode 100644
index e0d6b81..0000000
--- a/test/RevokableDefaultOperatorFilterer.t.sol
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {RevokableDefaultOperatorFilterer} from "src/RevokableDefaultOperatorFilterer.sol";
-import {RevokableOperatorFilterer} from "src/RevokableOperatorFilterer.sol";
-import {BaseRegistryTest} from "./BaseRegistryTest.sol";
-import {RevokableDefaultFilterer} from "./helpers/RevokableDefaultFilterer.sol";
-
-contract RevokableDefaultOperatorFiltererTest is BaseRegistryTest {
- RevokableDefaultFilterer filterer;
- address filteredAddress;
- address filteredCodeHashAddress;
- bytes32 filteredCodeHash;
- address notFiltered;
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public override {
- super.setUp();
- notFiltered = makeAddr("not filtered");
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
-
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
- filteredCodeHashAddress = makeAddr("filtered code hash");
- bytes memory code = hex"deadbeef";
- filteredCodeHash = keccak256(code);
- registry.updateCodeHash(address(DEFAULT_SUBSCRIPTION), filteredCodeHash, true);
- vm.etch(filteredCodeHashAddress, code);
-
- filterer = new RevokableDefaultFilterer();
- vm.stopPrank();
- }
-
- function testFilter() public {
- assertTrue(filterer.filterTest(notFiltered));
- vm.startPrank(filteredAddress);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- filterer.filterTest(address(0));
- vm.stopPrank();
- vm.startPrank(filteredCodeHashAddress);
- vm.expectRevert(abi.encodeWithSelector(CodeHashFiltered.selector, filteredCodeHashAddress, filteredCodeHash));
- filterer.filterTest(address(0));
- }
-
- function testRevoke() public {
- vm.startPrank(filteredAddress);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- filterer.filterTest(address(0));
- vm.stopPrank();
-
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- filterer.updateOperatorFilterRegistryAddress(address(0));
- assertFalse(filterer.isOperatorFilterRegistryRevoked());
- vm.stopPrank();
- vm.expectRevert(abi.encodeWithSignature("OnlyOwner()"));
- filterer.updateOperatorFilterRegistryAddress(address(0));
- vm.expectRevert(abi.encodeWithSignature("OnlyOwner()"));
- filterer.revokeOperatorFilterRegistry();
-
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- filterer.revokeOperatorFilterRegistry();
-
- vm.expectRevert(abi.encodeWithSignature("RegistryHasBeenRevoked()"));
- filterer.updateOperatorFilterRegistryAddress(address(0));
- vm.expectRevert(abi.encodeWithSignature("RegistryHasBeenRevoked()"));
- filterer.revokeOperatorFilterRegistry();
- vm.stopPrank();
-
- vm.startPrank(filteredAddress);
- assertTrue(filterer.filterTest(address(0)));
- vm.stopPrank();
- }
-}
diff --git a/test/RevokableOperatorFilterer.t.sol b/test/RevokableOperatorFilterer.t.sol
deleted file mode 100644
index 290baab..0000000
--- a/test/RevokableOperatorFilterer.t.sol
+++ /dev/null
@@ -1,135 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {RevokableOperatorFilterer} from "../src/RevokableOperatorFilterer.sol";
-import {BaseRegistryTest} from "./BaseRegistryTest.sol";
-import {Vm} from "forge-std/Vm.sol";
-import {RevokableFilterer} from "./helpers/RevokableFilterer.sol";
-
-contract ConcreteRevokableOperatorFilterer is RevokableOperatorFilterer {
- address _owner;
-
- constructor(address registry, address registrant, bool sub) RevokableOperatorFilterer(registry, registrant, sub) {
- _owner = msg.sender;
- }
-
- function owner() public view override returns (address) {
- return _owner;
- }
-}
-
-contract RevokableOperatorFiltererTest is BaseRegistryTest {
- RevokableFilterer filterer;
- address filteredAddress;
- address filteredCodeHashAddress;
- bytes32 filteredCodeHash;
- address notFiltered;
-
- function setUp() public override {
- super.setUp();
- notFiltered = makeAddr("not filtered");
- filterer = new RevokableFilterer(address(registry));
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(filterer), filteredAddress, true);
- filteredCodeHashAddress = makeAddr("filtered code hash");
- bytes memory code = hex"deadbeef";
- filteredCodeHash = keccak256(code);
- registry.updateCodeHash(address(filterer), filteredCodeHash, true);
- vm.etch(filteredCodeHashAddress, code);
- }
-
- function testFilter() public {
- assertTrue(filterer.testFilter(notFiltered));
- vm.startPrank(filteredAddress);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- filterer.testFilter(address(0));
- vm.stopPrank();
- vm.startPrank(filteredCodeHashAddress);
- vm.expectRevert(abi.encodeWithSelector(CodeHashFiltered.selector, filteredCodeHashAddress, filteredCodeHash));
- filterer.testFilter(address(0));
- }
-
- event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
-
- function testConstructory_noSubscribeOrCopy() public {
- vm.recordLogs();
- RevokableFilterer filterer2 = new RevokableFilterer(address(registry));
- Vm.Log[] memory logs = vm.getRecordedLogs();
-
- assertEq(logs.length, 2);
- assertEq(logs[0].topics[0], keccak256("RegistrationUpdated(address,bool)"));
- assertEq(address(uint160(uint256(logs[0].topics[1]))), address(filterer2));
- assertEq(logs[1].topics[0], keccak256("OwnershipTransferred(address,address)"));
- }
-
- function testConstructor_copy() public {
- address deployed = computeCreateAddress(address(this), vm.getNonce(address(this)));
- vm.expectEmit(true, false, false, false, address(registry));
- emit RegistrationUpdated(deployed, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit OperatorUpdated(deployed, filteredAddress, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit CodeHashUpdated(deployed, filteredCodeHash, true);
- new ConcreteRevokableOperatorFilterer(address(registry), address(filterer), false);
- }
-
- function testConstructor_subscribe() public {
- address deployed = computeCreateAddress(address(this), vm.getNonce(address(this)));
- vm.expectEmit(true, false, false, false, address(registry));
- emit RegistrationUpdated(deployed, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit SubscriptionUpdated(deployed, address(filterer), true);
- vm.recordLogs();
- new ConcreteRevokableOperatorFilterer(address(registry), address(filterer), true);
- assertEq(vm.getRecordedLogs().length, 2);
- }
-
- function testRegistryNotDeployedDoesNotRevert() public {
- vm.etch(address(registry), "");
- RevokableFilterer filterer2 = new RevokableFilterer(address(registry));
- assertTrue(filterer2.testFilter(notFiltered));
- }
-
- function testUpdateRegistry() public {
- address newRegistry = makeAddr("new registry");
- filterer.updateOperatorFilterRegistryAddress(newRegistry);
- assertEq(address(filterer.operatorFilterRegistry()), newRegistry);
- }
-
- function testUpdateRegistry_onlyOwner() public {
- vm.startPrank(makeAddr("notOwner"));
- vm.expectRevert(abi.encodeWithSignature("OnlyOwner()"));
- filterer.updateOperatorFilterRegistryAddress(address(0));
- }
-
- function testZeroAddressBypass() public {
- filterer.updateOperatorFilterRegistryAddress(address(0));
- vm.prank(filteredAddress);
- assertTrue(filterer.testFilter(address(0)));
-
- // cannot update even if registry is zero address
- // vm.expectRevert(abi.encodeWithSignature("RegistryHasBeenRevoked()"));
- filterer.updateOperatorFilterRegistryAddress(address(registry));
- vm.startPrank(filteredAddress);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- filterer.testFilter(address(0));
- vm.stopPrank();
-
- filterer.revokeOperatorFilterRegistry();
- vm.prank(filteredAddress);
- assertTrue(filterer.testFilter(address(0)));
-
- assertEq(address(filterer.operatorFilterRegistry()), address(0));
- assertTrue(filterer.isOperatorFilterRegistryRevoked());
-
- vm.expectRevert(abi.encodeWithSignature("RegistryHasBeenRevoked()"));
- filterer.updateOperatorFilterRegistryAddress(address(registry));
- vm.expectRevert(abi.encodeWithSignature("RegistryHasBeenRevoked()"));
- filterer.revokeOperatorFilterRegistry();
- }
-
- function testConstructor_revertOnZeroAddress() public {
- vm.expectRevert(abi.encodeWithSignature("InitialRegistryAddressCannotBeZeroAddress()"));
- new ConcreteRevokableOperatorFilterer(address(0), address(filterer), false);
- }
-}
diff --git a/test/UpdatableOperatorFilterer.t.sol b/test/UpdatableOperatorFilterer.t.sol
deleted file mode 100644
index 93faba1..0000000
--- a/test/UpdatableOperatorFilterer.t.sol
+++ /dev/null
@@ -1,125 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {UpdatableOperatorFilterer} from "../src/UpdatableOperatorFilterer.sol";
-import {BaseRegistryTest} from "./BaseRegistryTest.sol";
-import {Vm} from "forge-std/Vm.sol";
-import {UpdatableFilterer} from "./helpers/UpdatableFilterer.sol";
-import {OperatorFilterer} from "../src/OperatorFilterer.sol";
-import {OperatorFilterRegistryStub} from "./helpers/OperatorFilterRegistryStub.sol";
-
-contract ConcreteUpdatableOperatorFilterer is UpdatableOperatorFilterer {
- address _owner;
-
- constructor(address registry, address registrant, bool sub) UpdatableOperatorFilterer(registry, registrant, sub) {
- _owner = msg.sender;
- }
-
- function owner() public view override returns (address) {
- return _owner;
- }
-}
-
-contract UpdatableOperatorFiltererTest is BaseRegistryTest {
- UpdatableFilterer filterer;
- address filteredAddress;
- address filteredCodeHashAddress;
- bytes32 filteredCodeHash;
- address notFiltered;
-
- function setUp() public override {
- super.setUp();
- notFiltered = makeAddr("not filtered");
- filterer = new UpdatableFilterer(address(registry));
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(filterer), filteredAddress, true);
- filteredCodeHashAddress = makeAddr("filtered code hash");
- bytes memory code = hex"deadbeef";
- filteredCodeHash = keccak256(code);
- registry.updateCodeHash(address(filterer), filteredCodeHash, true);
- vm.etch(filteredCodeHashAddress, code);
- }
-
- function testFilter() public {
- assertTrue(filterer.testFilter(notFiltered));
- vm.startPrank(filteredAddress);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- filterer.testFilter(address(0));
- vm.stopPrank();
- vm.startPrank(filteredCodeHashAddress);
- vm.expectRevert(abi.encodeWithSelector(CodeHashFiltered.selector, filteredCodeHashAddress, filteredCodeHash));
- filterer.testFilter(address(0));
- }
-
- event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
-
- function testConstructory_noSubscribeOrCopy() public {
- vm.recordLogs();
- UpdatableFilterer filterer2 = new UpdatableFilterer(address(registry));
- Vm.Log[] memory logs = vm.getRecordedLogs();
-
- assertEq(logs.length, 2);
- assertEq(logs[0].topics[0], keccak256("RegistrationUpdated(address,bool)"));
- assertEq(address(uint160(uint256(logs[0].topics[1]))), address(filterer2));
- assertEq(logs[1].topics[0], keccak256("OwnershipTransferred(address,address)"));
- }
-
- function testConstructor_copy() public {
- address deployed = computeCreateAddress(address(this), vm.getNonce(address(this)));
- vm.expectEmit(true, false, false, false, address(registry));
- emit RegistrationUpdated(deployed, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit OperatorUpdated(deployed, filteredAddress, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit CodeHashUpdated(deployed, filteredCodeHash, true);
- new ConcreteUpdatableOperatorFilterer(address(registry), address(filterer), false);
- }
-
- function testConstructor_subscribe() public {
- address deployed = computeCreateAddress(address(this), vm.getNonce(address(this)));
- vm.expectEmit(true, false, false, false, address(registry));
- emit RegistrationUpdated(deployed, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit SubscriptionUpdated(deployed, address(filterer), true);
- vm.recordLogs();
- new ConcreteUpdatableOperatorFilterer(address(registry), address(filterer), true);
- assertEq(vm.getRecordedLogs().length, 2);
- }
-
- function testRegistryNotDeployedDoesNotRevert() public {
- vm.etch(address(registry), "");
- UpdatableFilterer filterer2 = new UpdatableFilterer(address(registry));
- assertTrue(filterer2.testFilter(notFiltered));
- }
-
- function testUpdateRegistry() public {
- address newRegistry = makeAddr("new registry");
- filterer.updateOperatorFilterRegistryAddress(newRegistry);
- assertEq(address(filterer.operatorFilterRegistry()), newRegistry);
- }
-
- function testUpdateRegistry_onlyOwner() public {
- vm.startPrank(makeAddr("notOwner"));
- vm.expectRevert(abi.encodeWithSignature("OnlyOwner()"));
- filterer.updateOperatorFilterRegistryAddress(address(0));
- }
-
- function testZeroAddressBypass() public {
- filterer.updateOperatorFilterRegistryAddress(address(0));
- vm.prank(filteredAddress);
- assertTrue(filterer.testFilter(address(0)));
-
- // can update even if registry is zero address
- filterer.updateOperatorFilterRegistryAddress(address(registry));
- vm.startPrank(filteredAddress);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- filterer.testFilter(address(0));
- }
-
- function testRevert_OperatorNotAllowed() public {
- address stubRegistry = address(new OperatorFilterRegistryStub());
- UpdatableFilterer updatableFilterer = new UpdatableFilterer(stubRegistry);
- vm.expectRevert(abi.encodeWithSelector(OperatorFilterer.OperatorNotAllowed.selector, address(filteredAddress)));
- updatableFilterer.checkFilterOperator(filteredAddress);
- }
-}
diff --git a/test/example/ExampleERC1155.t.sol b/test/example/ExampleERC1155.t.sol
deleted file mode 100644
index 769d62c..0000000
--- a/test/example/ExampleERC1155.t.sol
+++ /dev/null
@@ -1,107 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ExampleERC1155} from "../../src/example/ExampleERC1155.sol";
-import {BaseRegistryTest} from "../BaseRegistryTest.sol";
-import {IERC165} from "openzeppelin-contracts/interfaces/IERC165.sol";
-import {IERC1155} from "openzeppelin-contracts/interfaces/IERC1155.sol";
-import {IERC2981} from "openzeppelin-contracts/interfaces/IERC2981.sol";
-
-contract TestableExampleERC1155 is ExampleERC1155 {
- function mint(address to, uint256 tokenId) external {
- _mint(to, tokenId, 1, "");
- }
-}
-
-contract ExampleERC1155Test is BaseRegistryTest {
- TestableExampleERC1155 example;
- address filteredAddress;
-
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public override {
- super.setUp();
-
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
-
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
- vm.stopPrank();
-
- example = new TestableExampleERC1155();
- }
-
- function testFilter() public {
- vm.startPrank(address(filteredAddress));
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1, 1, "");
- uint256[] memory ids = new uint256[](1);
- ids[0] = 1;
- uint256[] memory amounts = new uint256[](1);
- amounts[0] = 1;
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeBatchTransferFrom(makeAddr("from"), makeAddr("to"), ids, amounts, "");
- }
-
- function testOwnersNotExcluded() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.safeTransferFrom(alice, makeAddr("to"), 1, 1, "");
- }
-
- function testOwnersNotExcludedBatch() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
- uint256[] memory ids = new uint256[](1);
- ids[0] = 1;
- uint256[] memory amounts = new uint256[](1);
- amounts[0] = 1;
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.safeBatchTransferFrom(alice, makeAddr("to"), ids, amounts, "");
- }
-
- function testExclusionExceptionDoesNotApplyToOperators() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.safeTransferFrom(bob, makeAddr("to"), 1, 1, "");
- }
-
- function testExcludeApprovals() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(bob);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.setApprovalForAll(alice, true);
- }
-
- function testSupportsInterface() public {
- assertTrue(example.supportsInterface(type(IERC165).interfaceId));
- assertTrue(example.supportsInterface(type(IERC1155).interfaceId));
- assertTrue(example.supportsInterface(type(IERC2981).interfaceId));
- }
-}
diff --git a/test/example/ExampleERC721.t.sol b/test/example/ExampleERC721.t.sol
deleted file mode 100644
index dbd015c..0000000
--- a/test/example/ExampleERC721.t.sol
+++ /dev/null
@@ -1,105 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ExampleERC721} from "../../src/example/ExampleERC721.sol";
-import {BaseRegistryTest} from "../BaseRegistryTest.sol";
-import {IERC165} from "openzeppelin-contracts/interfaces/IERC165.sol";
-import {IERC721} from "openzeppelin-contracts/interfaces/IERC721.sol";
-import {IERC2981} from "openzeppelin-contracts/interfaces/IERC2981.sol";
-
-contract TestableExampleERC721 is ExampleERC721 {
- function mint(address to, uint256 tokenId) external {
- _mint(to, tokenId);
- }
-}
-
-contract ExampleERC721Test is BaseRegistryTest {
- TestableExampleERC721 example;
- address filteredAddress;
-
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public override {
- super.setUp();
-
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
-
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
- vm.stopPrank();
-
- example = new TestableExampleERC721();
- }
-
- function testFilter() public {
- vm.startPrank(address(filteredAddress));
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.transferFrom(makeAddr("from"), makeAddr("to"), 1);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1, "");
- }
-
- function testOwnersNotExcluded() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.transferFrom(alice, makeAddr("to"), 1);
- }
-
- function testOwnersNotExcludedSafeTransfer() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
- example.mint(alice, 2);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- example.safeTransferFrom(alice, makeAddr("to"), 1);
- example.safeTransferFrom(alice, makeAddr("to"), 2, "");
- }
-
- function testExclusionExceptionDoesNotApplyToOperators() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.transferFrom(bob, makeAddr("to"), 1);
- }
-
- function testExcludeApprovals() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(bob);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.setApprovalForAll(alice, true);
-
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.approve(alice, 1);
- }
-
- function testSupportsInterface() public {
- assertTrue(example.supportsInterface(type(IERC165).interfaceId));
- assertTrue(example.supportsInterface(type(IERC721).interfaceId));
- assertTrue(example.supportsInterface(type(IERC2981).interfaceId));
- }
-}
diff --git a/test/example/RevokableERC1155.t.sol b/test/example/RevokableERC1155.t.sol
deleted file mode 100644
index b1d9bc6..0000000
--- a/test/example/RevokableERC1155.t.sol
+++ /dev/null
@@ -1,123 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {RevokableExampleERC1155} from "../../src/example/RevokableExampleERC1155.sol";
-import {BaseRegistryTest} from "../BaseRegistryTest.sol";
-import {IERC165} from "openzeppelin-contracts/interfaces/IERC165.sol";
-import {IERC1155} from "openzeppelin-contracts/interfaces/IERC1155.sol";
-import {IERC2981} from "openzeppelin-contracts/interfaces/IERC2981.sol";
-
-contract TestableExampleERC1155 is RevokableExampleERC1155 {
- function mint(address to, uint256 tokenId) external {
- _mint(to, tokenId, 1, "");
- }
-}
-
-contract RevokeExampleERC1155Test is BaseRegistryTest {
- TestableExampleERC1155 example;
- address filteredAddress;
-
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public override {
- super.setUp();
-
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
-
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
- vm.stopPrank();
-
- example = new TestableExampleERC1155();
- }
-
- function testFilter() public {
- vm.startPrank(address(filteredAddress));
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1, 1, "");
- uint256[] memory ids = new uint256[](1);
- ids[0] = 1;
- uint256[] memory amounts = new uint256[](1);
- amounts[0] = 1;
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeBatchTransferFrom(makeAddr("from"), makeAddr("to"), ids, amounts, "");
- }
-
- function testOwnersNotExcluded() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.safeTransferFrom(alice, makeAddr("to"), 1, 1, "");
- }
-
- function testOwnersNotExcludedBatch() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
- uint256[] memory ids = new uint256[](1);
- ids[0] = 1;
- uint256[] memory amounts = new uint256[](1);
- amounts[0] = 1;
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.safeBatchTransferFrom(alice, makeAddr("to"), ids, amounts, "");
- }
-
- function testExclusionExceptionDoesNotApplyToOperators() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.safeTransferFrom(bob, makeAddr("to"), 1, 1, "");
- }
-
- function testExcludeApprovals() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(bob);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.setApprovalForAll(alice, true);
- }
-
- function testRevoke() public {
- address alice = makeAddr("alice");
- address bob = makeAddr("bob");
- example.mint(makeAddr("bob"), 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- example.updateOperatorFilterRegistryAddress(address(0));
-
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
- vm.startPrank(alice);
- example.safeTransferFrom(bob, makeAddr("to"), 1, 1, "");
- }
-
- function testSupportsInterface() public {
- assertTrue(example.supportsInterface(type(IERC165).interfaceId));
- assertTrue(example.supportsInterface(type(IERC1155).interfaceId));
- assertTrue(example.supportsInterface(type(IERC2981).interfaceId));
- }
-}
diff --git a/test/example/RevokableERC721.t.sol b/test/example/RevokableERC721.t.sol
deleted file mode 100644
index 20f8a2f..0000000
--- a/test/example/RevokableERC721.t.sol
+++ /dev/null
@@ -1,121 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {RevokableExampleERC721} from "../../src/example/RevokableExampleERC721.sol";
-import {BaseRegistryTest} from "../BaseRegistryTest.sol";
-import {IERC165} from "openzeppelin-contracts/interfaces/IERC165.sol";
-import {IERC721} from "openzeppelin-contracts/interfaces/IERC721.sol";
-import {IERC2981} from "openzeppelin-contracts/interfaces/IERC2981.sol";
-
-contract TestableExampleERC721 is RevokableExampleERC721 {
- function mint(address to, uint256 tokenId) external {
- _mint(to, tokenId);
- }
-}
-
-contract RevokableExampleERC721Test is BaseRegistryTest {
- TestableExampleERC721 example;
- address filteredAddress;
-
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public override {
- super.setUp();
-
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
-
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
- vm.stopPrank();
-
- example = new TestableExampleERC721();
- }
-
- function testFilter() public {
- vm.startPrank(address(filteredAddress));
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.transferFrom(makeAddr("from"), makeAddr("to"), 1);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1, "");
- }
-
- function testOwnersNotExcluded() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.transferFrom(alice, makeAddr("to"), 1);
- }
-
- function testOwnersNotExcludedSafeTransfer() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
- example.mint(alice, 2);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- example.safeTransferFrom(alice, makeAddr("to"), 1);
- example.safeTransferFrom(alice, makeAddr("to"), 2, "");
- }
-
- function testExclusionExceptionDoesNotApplyToOperators() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.transferFrom(bob, makeAddr("to"), 1);
- }
-
- function testExcludeApprovals() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(bob);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.setApprovalForAll(alice, true);
-
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.approve(alice, 1);
- }
-
- function testRevoke() public {
- address alice = makeAddr("alice");
- address bob = makeAddr("bob");
- example.mint(makeAddr("bob"), 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- example.updateOperatorFilterRegistryAddress(address(0));
-
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
- vm.startPrank(alice);
- example.safeTransferFrom(bob, makeAddr("to"), 1);
- }
-
- function testSupportsInterface() public {
- assertTrue(example.supportsInterface(type(IERC165).interfaceId));
- assertTrue(example.supportsInterface(type(IERC721).interfaceId));
- assertTrue(example.supportsInterface(type(IERC2981).interfaceId));
- }
-}
diff --git a/test/example/upgradeable/ExampleERC1155Upgradeable.t.sol b/test/example/upgradeable/ExampleERC1155Upgradeable.t.sol
deleted file mode 100644
index 6524e4d..0000000
--- a/test/example/upgradeable/ExampleERC1155Upgradeable.t.sol
+++ /dev/null
@@ -1,118 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ExampleERC1155Upgradeable} from "../../../src/example/upgradeable/ExampleERC1155Upgradeable.sol";
-import {BaseRegistryTest} from "../../BaseRegistryTest.sol";
-import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol";
-import {IERC165} from "openzeppelin-contracts/interfaces/IERC165.sol";
-import {IERC1155} from "openzeppelin-contracts/interfaces/IERC1155.sol";
-import {IERC2981} from "openzeppelin-contracts/interfaces/IERC2981.sol";
-
-contract TestableExampleERC1155 is ExampleERC1155Upgradeable {
- function mint(address to, uint256 tokenId) external {
- _mint(to, tokenId, 1, "");
- }
-}
-
-contract ExampleER1155UpgradeableTest is BaseRegistryTest, Initializable {
- TestableExampleERC1155 example;
- address filteredAddress;
-
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public override {
- super.setUp();
-
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
-
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
- vm.stopPrank();
-
- example = new TestableExampleERC1155();
- example.initialize();
- }
-
- function testUpgradeable() public {
- TestableExampleERC1155 example2 = new TestableExampleERC1155();
- vm.expectEmit(true, true, false, true, address(example2));
- emit Initialized(1);
- example2.initialize();
- vm.expectRevert(bytes("Initializable: contract is already initialized"));
- example2.initialize();
- }
-
- function testFilter() public {
- vm.startPrank(address(filteredAddress));
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1, 1, "");
- uint256[] memory ids = new uint256[](1);
- ids[0] = 1;
- uint256[] memory amounts = new uint256[](1);
- amounts[0] = 1;
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeBatchTransferFrom(makeAddr("from"), makeAddr("to"), ids, amounts, "");
- }
-
- function testOwnersNotExcluded() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.safeTransferFrom(alice, makeAddr("to"), 1, 1, "");
- }
-
- function testOwnersNotExcludedBatch() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
- uint256[] memory ids = new uint256[](1);
- ids[0] = 1;
- uint256[] memory amounts = new uint256[](1);
- amounts[0] = 1;
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.safeBatchTransferFrom(alice, makeAddr("to"), ids, amounts, "");
- }
-
- function testExclusionExceptionDoesNotApplyToOperators() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.safeTransferFrom(bob, makeAddr("to"), 1, 1, "");
- }
-
- function testExcludeApprovals() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(bob);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.setApprovalForAll(alice, true);
- }
-
- function testSupportsInterface() public {
- assertTrue(example.supportsInterface(type(IERC165).interfaceId));
- assertTrue(example.supportsInterface(type(IERC1155).interfaceId));
- assertTrue(example.supportsInterface(type(IERC2981).interfaceId));
- }
-}
diff --git a/test/example/upgradeable/ExampleERC721Upgradeable.t.sol b/test/example/upgradeable/ExampleERC721Upgradeable.t.sol
deleted file mode 100644
index 16c5f74..0000000
--- a/test/example/upgradeable/ExampleERC721Upgradeable.t.sol
+++ /dev/null
@@ -1,116 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ExampleERC721Upgradeable} from "../../../src/example/upgradeable/ExampleERC721Upgradeable.sol";
-import {BaseRegistryTest} from "../../BaseRegistryTest.sol";
-import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol";
-import {IERC165} from "openzeppelin-contracts/interfaces/IERC165.sol";
-import {IERC721} from "openzeppelin-contracts/interfaces/IERC721.sol";
-import {IERC2981} from "openzeppelin-contracts/interfaces/IERC2981.sol";
-
-contract TestableExampleERC721 is ExampleERC721Upgradeable {
- function mint(address to, uint256 tokenId) external {
- _mint(to, tokenId);
- }
-}
-
-contract ExampleERC721UpgradeableTest is BaseRegistryTest, Initializable {
- TestableExampleERC721 example;
- address filteredAddress;
-
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public override {
- super.setUp();
-
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
-
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
- vm.stopPrank();
-
- example = new TestableExampleERC721();
- example.initialize();
- }
-
- function testUpgradeable() public {
- TestableExampleERC721 example2 = new TestableExampleERC721();
- vm.expectEmit(true, true, false, true, address(example2));
- emit Initialized(1);
- example2.initialize();
- vm.expectRevert(bytes("Initializable: contract is already initialized"));
- example2.initialize();
- }
-
- function testFilter() public {
- vm.startPrank(address(filteredAddress));
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.transferFrom(makeAddr("from"), makeAddr("to"), 1);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1, "");
- }
-
- function testOwnersNotExcluded() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.transferFrom(alice, makeAddr("to"), 1);
- }
-
- function testOwnersNotExcludedSafeTransfer() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
- example.mint(alice, 2);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- example.safeTransferFrom(alice, makeAddr("to"), 1);
- example.safeTransferFrom(alice, makeAddr("to"), 2, "");
- }
-
- function testExclusionExceptionDoesNotApplyToOperators() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.transferFrom(bob, makeAddr("to"), 1);
- }
-
- function testExcludeApprovals() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(bob);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.setApprovalForAll(alice, true);
-
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.approve(alice, 1);
- }
-
- function testSupportsInterface() public {
- assertTrue(example.supportsInterface(type(IERC165).interfaceId));
- assertTrue(example.supportsInterface(type(IERC721).interfaceId));
- assertTrue(example.supportsInterface(type(IERC2981).interfaceId));
- }
-}
diff --git a/test/example/upgradeable/RevokableExampleERC1155Upgradeable.t.sol b/test/example/upgradeable/RevokableExampleERC1155Upgradeable.t.sol
deleted file mode 100644
index 9fba1d1..0000000
--- a/test/example/upgradeable/RevokableExampleERC1155Upgradeable.t.sol
+++ /dev/null
@@ -1,135 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {RevokableExampleERC1155Upgradeable} from
- "../../../src/example/upgradeable/RevokableExampleERC1155Upgradeable.sol";
-import {BaseRegistryTest} from "../../BaseRegistryTest.sol";
-import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol";
-import {IERC165} from "openzeppelin-contracts/interfaces/IERC165.sol";
-import {IERC1155} from "openzeppelin-contracts/interfaces/IERC1155.sol";
-import {IERC2981} from "openzeppelin-contracts/interfaces/IERC2981.sol";
-
-contract TestableExampleERC1155 is RevokableExampleERC1155Upgradeable {
- function mint(address to, uint256 tokenId) external {
- _mint(to, tokenId, 1, "");
- }
-}
-
-contract RevokableExampleER1155UpgradeableTest is BaseRegistryTest, Initializable {
- TestableExampleERC1155 example;
- address filteredAddress;
-
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public override {
- super.setUp();
-
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
-
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
- vm.stopPrank();
-
- example = new TestableExampleERC1155();
- example.initialize();
- }
-
- function testUpgradeable() public {
- TestableExampleERC1155 example2 = new TestableExampleERC1155();
- vm.expectEmit(true, true, false, true, address(example2));
- emit Initialized(1);
- example2.initialize();
- vm.expectRevert(bytes("Initializable: contract is already initialized"));
- example2.initialize();
- }
-
- function testFilter() public {
- vm.startPrank(address(filteredAddress));
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1, 1, "");
- uint256[] memory ids = new uint256[](1);
- ids[0] = 1;
- uint256[] memory amounts = new uint256[](1);
- amounts[0] = 1;
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeBatchTransferFrom(makeAddr("from"), makeAddr("to"), ids, amounts, "");
- }
-
- function testOwnersNotExcluded() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.safeTransferFrom(alice, makeAddr("to"), 1, 1, "");
- }
-
- function testOwnersNotExcludedBatch() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
- uint256[] memory ids = new uint256[](1);
- ids[0] = 1;
- uint256[] memory amounts = new uint256[](1);
- amounts[0] = 1;
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.safeBatchTransferFrom(alice, makeAddr("to"), ids, amounts, "");
- }
-
- function testExclusionExceptionDoesNotApplyToOperators() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.safeTransferFrom(bob, makeAddr("to"), 1, 1, "");
- }
-
- function testExcludeApprovals() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(bob);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.setApprovalForAll(alice, true);
- }
-
- function testRevoke() public {
- address alice = makeAddr("alice");
- address bob = makeAddr("bob");
- example.mint(makeAddr("bob"), 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- example.revokeOperatorFilterRegistry();
-
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
- vm.startPrank(alice);
- example.safeTransferFrom(bob, makeAddr("to"), 1, 1, "");
- }
-
- function testSupportsInterface() public {
- assertTrue(example.supportsInterface(type(IERC165).interfaceId));
- assertTrue(example.supportsInterface(type(IERC1155).interfaceId));
- assertTrue(example.supportsInterface(type(IERC2981).interfaceId));
- }
-}
diff --git a/test/example/upgradeable/RevokableExampleERC721Upgradeable.t.sol b/test/example/upgradeable/RevokableExampleERC721Upgradeable.t.sol
deleted file mode 100644
index b92b0ed..0000000
--- a/test/example/upgradeable/RevokableExampleERC721Upgradeable.t.sol
+++ /dev/null
@@ -1,132 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {RevokableExampleERC721Upgradeable} from "../../../src/example/upgradeable/RevokableExampleERC721Upgradeable.sol";
-import {BaseRegistryTest} from "../../BaseRegistryTest.sol";
-import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol";
-import {IERC165} from "openzeppelin-contracts/interfaces/IERC165.sol";
-import {IERC721} from "openzeppelin-contracts/interfaces/IERC721.sol";
-import {IERC2981} from "openzeppelin-contracts/interfaces/IERC2981.sol";
-
-contract TestableExampleERC721 is RevokableExampleERC721Upgradeable {
- function mint(address to, uint256 tokenId) external {
- _mint(to, tokenId);
- }
-}
-
-contract ExampleERC721UpgradeableTest is BaseRegistryTest, Initializable {
- TestableExampleERC721 example;
- address filteredAddress;
-
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public override {
- super.setUp();
-
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
-
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
- vm.stopPrank();
-
- example = new TestableExampleERC721();
- example.initialize();
- }
-
- function testUpgradeable() public {
- TestableExampleERC721 example2 = new TestableExampleERC721();
- vm.expectEmit(true, true, false, true, address(example2));
- emit Initialized(1);
- example2.initialize();
- vm.expectRevert(bytes("Initializable: contract is already initialized"));
- example2.initialize();
- }
-
- function testFilter() public {
- vm.startPrank(address(filteredAddress));
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.transferFrom(makeAddr("from"), makeAddr("to"), 1);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1, "");
- }
-
- function testOwnersNotExcluded() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.transferFrom(alice, makeAddr("to"), 1);
- }
-
- function testOwnersNotExcludedSafeTransfer() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
- example.mint(alice, 2);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- example.safeTransferFrom(alice, makeAddr("to"), 1);
- example.safeTransferFrom(alice, makeAddr("to"), 2, "");
- }
-
- function testExclusionExceptionDoesNotApplyToOperators() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.transferFrom(bob, makeAddr("to"), 1);
- }
-
- function testExcludeApprovals() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(bob);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.setApprovalForAll(alice, true);
-
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.approve(alice, 1);
- }
-
- function testRevoke() public {
- address alice = makeAddr("alice");
- address bob = makeAddr("bob");
- example.mint(makeAddr("bob"), 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- example.revokeOperatorFilterRegistry();
-
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
- vm.startPrank(alice);
- example.safeTransferFrom(bob, makeAddr("to"), 1);
- }
-
- function testSupportsInterface() public {
- assertTrue(example.supportsInterface(type(IERC165).interfaceId));
- assertTrue(example.supportsInterface(type(IERC721).interfaceId));
- assertTrue(example.supportsInterface(type(IERC2981).interfaceId));
- }
-}
diff --git a/test/example/upgradeable/UpdatableExampleERC721Upgradeable.t.sol b/test/example/upgradeable/UpdatableExampleERC721Upgradeable.t.sol
deleted file mode 100644
index 9eda09a..0000000
--- a/test/example/upgradeable/UpdatableExampleERC721Upgradeable.t.sol
+++ /dev/null
@@ -1,272 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {Vm} from "forge-std/Vm.sol";
-import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol";
-import {OwnableUpgradeable} from "openzeppelin-contracts-upgradeable/access/OwnableUpgradeable.sol";
-
-import {UpdatableExampleERC721Upgradeable} from "../../../src/example/upgradeable/UpdatableExampleERC721Upgradeable.sol";
-import {UpdatableOperatorFiltererUpgradeable} from "../../../src/upgradeable/UpdatableOperatorFiltererUpgradeable.sol";
-import {BaseRegistryTest} from "../../BaseRegistryTest.sol";
-
-import {OperatorFilterRegistryStub} from "../../helpers/OperatorFilterRegistryStub.sol";
-
-import {OperatorFilterer} from "../../../src/OperatorFilterer.sol";
-
-contract TestableUpdatableExampleERC721Upgradeable is UpdatableExampleERC721Upgradeable {
- function mint(address to, uint256 tokenId) external {
- _mint(to, tokenId);
- }
-}
-
-contract UpdatableERC721UpgradeableForUpgradableTest is BaseRegistryTest, Initializable {
- TestableUpdatableExampleERC721Upgradeable example;
- address filteredAddress;
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public override {
- super.setUp();
-
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
-
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
- vm.stopPrank();
-
- example = new TestableUpdatableExampleERC721Upgradeable();
- example.initialize(address(registry), DEFAULT_SUBSCRIPTION, true);
- }
-
- function testUpgradeable() public {
- TestableUpdatableExampleERC721Upgradeable example2 = new TestableUpdatableExampleERC721Upgradeable();
- vm.expectEmit(true, true, false, true, address(example2));
- emit Initialized(1);
- example2.initialize(address(registry), DEFAULT_SUBSCRIPTION, true);
- vm.expectRevert(bytes("Initializable: contract is already initialized"));
- example2.initialize(address(registry), DEFAULT_SUBSCRIPTION, true);
- }
-
- function testFilter() public {
- vm.startPrank(address(filteredAddress));
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.transferFrom(makeAddr("from"), makeAddr("to"), 1);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- example.safeTransferFrom(makeAddr("from"), makeAddr("to"), 1, "");
- }
-
- function testOwnersNotExcluded() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.prank(alice);
- example.transferFrom(alice, makeAddr("to"), 1);
- }
-
- function testOwnersNotExcludedSafeTransfer() public {
- address alice = address(0xA11CE);
- example.mint(alice, 1);
- example.mint(alice, 2);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- example.safeTransferFrom(alice, makeAddr("to"), 1);
- example.safeTransferFrom(alice, makeAddr("to"), 2, "");
- }
-
- function testExclusionExceptionDoesNotApplyToOperators() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
- vm.prank(bob);
- example.setApprovalForAll(alice, true);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(alice);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.transferFrom(bob, makeAddr("to"), 1);
- }
-
- function testExcludeApprovals() public {
- address alice = address(0xA11CE);
- address bob = address(0xB0B);
- example.mint(bob, 1);
-
- vm.prank(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(address(DEFAULT_SUBSCRIPTION), alice, true);
-
- vm.startPrank(bob);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.setApprovalForAll(alice, true);
-
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, alice));
- example.approve(alice, 1);
- }
-}
-
-contract ConcreteUpdatableOperatorFiltererUpgradable is UpdatableOperatorFiltererUpgradeable, OwnableUpgradeable {
- function initialize(address registry, address registrant, bool sub) public initializer {
- __Ownable_init();
- __UpdatableOperatorFiltererUpgradeable_init(registry, registrant, sub);
- }
-
- function testFilter(address from) public view onlyAllowedOperator(from) returns (bool) {
- return true;
- }
-
- function checkFilterOperator(address operator) public view {
- _checkFilterOperator(operator);
- }
-
- function owner()
- public
- view
- virtual
- override(OwnableUpgradeable, UpdatableOperatorFiltererUpgradeable)
- returns (address)
- {
- return OwnableUpgradeable.owner();
- }
-}
-
-contract UpdatableERC721UpgradeableForUpdatableTest is BaseRegistryTest {
- ConcreteUpdatableOperatorFiltererUpgradable filterer;
- address filteredAddress;
- address filteredCodeHashAddress;
- bytes32 filteredCodeHash;
- address notFiltered;
-
- function setUp() public override {
- super.setUp();
- notFiltered = makeAddr("not filtered");
- filterer = new ConcreteUpdatableOperatorFiltererUpgradable();
- filterer.initialize(address(registry), address(0), false);
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(filterer), filteredAddress, true);
- filteredCodeHashAddress = makeAddr("filtered code hash");
- bytes memory code = hex"deadbeef";
- filteredCodeHash = keccak256(code);
- registry.updateCodeHash(address(filterer), filteredCodeHash, true);
- vm.etch(filteredCodeHashAddress, code);
- }
-
- function testFilter() public {
- assertTrue(filterer.testFilter(notFiltered));
- vm.startPrank(filteredAddress);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- filterer.testFilter(address(0));
- vm.stopPrank();
- vm.startPrank(filteredCodeHashAddress);
- vm.expectRevert(abi.encodeWithSelector(CodeHashFiltered.selector, filteredCodeHashAddress, filteredCodeHash));
- filterer.testFilter(address(0));
- }
-
- event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
-
- function testConstructory_noSubscribeOrCopy() public {
- vm.recordLogs();
- ConcreteUpdatableOperatorFiltererUpgradable filterer2 = new ConcreteUpdatableOperatorFiltererUpgradable();
- filterer2.initialize(address(registry), address(0), false);
- Vm.Log[] memory logs = vm.getRecordedLogs();
- assertEq(logs.length, 3);
- assertEq(logs[0].topics[0], keccak256("OwnershipTransferred(address,address)"));
- assertEq(logs[1].topics[0], keccak256("RegistrationUpdated(address,bool)"));
- assertEq(address(uint160(uint256(logs[1].topics[1]))), address(filterer2));
- assertEq(logs[2].topics[0], keccak256("Initialized(uint8)"));
- }
-
- function testConstructor_copy() public {
- address deployed = computeCreateAddress(address(this), vm.getNonce(address(this)));
- vm.expectEmit(true, false, false, false, address(registry));
- emit RegistrationUpdated(deployed, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit OperatorUpdated(deployed, filteredAddress, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit CodeHashUpdated(deployed, filteredCodeHash, true);
-
- vm.recordLogs();
- ConcreteUpdatableOperatorFiltererUpgradable filterer2 = new ConcreteUpdatableOperatorFiltererUpgradable();
- filterer2.initialize(address(registry), address(filterer), false);
-
- Vm.Log[] memory logs = vm.getRecordedLogs();
- assertEq(logs.length, 5);
- assertEq(logs[0].topics[0], keccak256("OwnershipTransferred(address,address)"));
- assertEq(logs[1].topics[0], keccak256("RegistrationUpdated(address,bool)"));
- assertEq(address(uint160(uint256(logs[1].topics[1]))), address(filterer2));
- assertEq(logs[2].topics[0], keccak256("OperatorUpdated(address,address,bool)"));
- assertEq(address(uint160(uint256(logs[2].topics[1]))), address(filterer2));
- assertEq(logs[3].topics[0], keccak256("CodeHashUpdated(address,bytes32,bool)"));
- assertEq(address(uint160(uint256(logs[3].topics[1]))), address(filterer2));
- assertEq(logs[4].topics[0], keccak256("Initialized(uint8)"));
- }
-
- function testConstructor_subscribe() public {
- address deployed = computeCreateAddress(address(this), vm.getNonce(address(this)));
- vm.expectEmit(true, false, false, false, address(registry));
- emit RegistrationUpdated(deployed, true);
- vm.expectEmit(true, true, true, false, address(registry));
- emit SubscriptionUpdated(deployed, address(filterer), true);
-
- vm.recordLogs();
- ConcreteUpdatableOperatorFiltererUpgradable filterer2 = new ConcreteUpdatableOperatorFiltererUpgradable();
- filterer2.initialize(address(registry), address(filterer), true);
-
- Vm.Log[] memory logs = vm.getRecordedLogs();
- assertEq(logs.length, 4);
- assertEq(logs[0].topics[0], keccak256("OwnershipTransferred(address,address)"));
- assertEq(logs[1].topics[0], keccak256("RegistrationUpdated(address,bool)"));
- assertEq(address(uint160(uint256(logs[1].topics[1]))), address(filterer2));
- assertEq(logs[2].topics[0], keccak256("SubscriptionUpdated(address,address,bool)"));
- assertEq(address(uint160(uint256(logs[2].topics[1]))), address(filterer2));
- assertEq(logs[3].topics[0], keccak256("Initialized(uint8)"));
- }
-
- function testRegistryNotDeployedDoesNotRevert() public {
- vm.etch(address(registry), "");
- ConcreteUpdatableOperatorFiltererUpgradable filterer2 = new ConcreteUpdatableOperatorFiltererUpgradable();
- filterer2.initialize(address(registry), address(0), false);
- assertTrue(filterer2.testFilter(notFiltered));
- }
-
- function testUpdateRegistry() public {
- address newRegistry = makeAddr("new registry");
- filterer.updateOperatorFilterRegistryAddress(newRegistry);
- assertEq(address(filterer.operatorFilterRegistry()), newRegistry);
- }
-
- function testUpdateRegistry_onlyOwner() public {
- vm.startPrank(makeAddr("notOwner"));
- vm.expectRevert(abi.encodeWithSignature("OnlyOwner()"));
- filterer.updateOperatorFilterRegistryAddress(address(0));
- }
-
- function testZeroAddressBypass() public {
- filterer.updateOperatorFilterRegistryAddress(address(0));
- vm.prank(filteredAddress);
- assertTrue(filterer.testFilter(address(0)));
-
- // can update even if registry is zero address
- filterer.updateOperatorFilterRegistryAddress(address(registry));
- vm.startPrank(filteredAddress);
- vm.expectRevert(abi.encodeWithSelector(AddressFiltered.selector, filteredAddress));
- filterer.testFilter(address(0));
- }
-
- function testRevert_OperatorNotAllowed() public {
- address stubRegistry = address(new OperatorFilterRegistryStub());
- ConcreteUpdatableOperatorFiltererUpgradable updatableFilterer =
- new ConcreteUpdatableOperatorFiltererUpgradable();
- updatableFilterer.initialize(stubRegistry, address(0), false);
- vm.expectRevert(abi.encodeWithSelector(OperatorFilterer.OperatorNotAllowed.selector, address(filteredAddress)));
- updatableFilterer.checkFilterOperator(filteredAddress);
- }
-}
diff --git a/test/helpers/DefaultFilterer.sol b/test/helpers/DefaultFilterer.sol
deleted file mode 100644
index 4da9fe7..0000000
--- a/test/helpers/DefaultFilterer.sol
+++ /dev/null
@@ -1,12 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {DefaultOperatorFilterer} from "../../src/DefaultOperatorFilterer.sol";
-
-contract DefaultFilterer is DefaultOperatorFilterer {
- constructor() DefaultOperatorFilterer() {}
-
- function filterTest(address from) public view onlyAllowedOperator(from) returns (bool) {
- return true;
- }
-}
diff --git a/test/helpers/Filterer.sol b/test/helpers/Filterer.sol
deleted file mode 100644
index 8e264ec..0000000
--- a/test/helpers/Filterer.sol
+++ /dev/null
@@ -1,17 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OperatorFilterer} from "../../src/OperatorFilterer.sol";
-import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
-
-contract Filterer is OperatorFilterer, Ownable {
- constructor() OperatorFilterer(address(0), false) {}
-
- function testFilter(address from) public view onlyAllowedOperator(from) returns (bool) {
- return true;
- }
-
- function checkFilterOperator(address operator) public view {
- _checkFilterOperator(operator);
- }
-}
diff --git a/test/helpers/OperatorFilterRegistryStub.sol b/test/helpers/OperatorFilterRegistryStub.sol
deleted file mode 100644
index 86522b0..0000000
--- a/test/helpers/OperatorFilterRegistryStub.sol
+++ /dev/null
@@ -1,10 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.17;
-
-contract OperatorFilterRegistryStub {
- function register(address) public pure {}
-
- function isOperatorAllowed(address, address) public pure returns (bool) {
- return false;
- }
-}
diff --git a/test/helpers/RevokableDefaultFilterer.sol b/test/helpers/RevokableDefaultFilterer.sol
deleted file mode 100644
index 839d292..0000000
--- a/test/helpers/RevokableDefaultFilterer.sol
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {RevokableDefaultOperatorFilterer} from "../../src/RevokableDefaultOperatorFilterer.sol";
-
-contract RevokableDefaultFilterer is RevokableDefaultOperatorFilterer {
- address _owner;
-
- constructor() RevokableDefaultOperatorFilterer() {
- _owner = msg.sender;
- }
-
- function filterTest(address from) public view onlyAllowedOperator(from) returns (bool) {
- return true;
- }
-
- function owner() public view override returns (address) {
- return _owner;
- }
-}
diff --git a/test/helpers/RevokableFilterer.sol b/test/helpers/RevokableFilterer.sol
deleted file mode 100644
index 0448cf5..0000000
--- a/test/helpers/RevokableFilterer.sol
+++ /dev/null
@@ -1,19 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {RevokableOperatorFilterer} from "../../src/RevokableOperatorFilterer.sol";
-import {UpdatableOperatorFilterer} from "../../src/UpdatableOperatorFilterer.sol";
-
-import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
-
-contract RevokableFilterer is RevokableOperatorFilterer, Ownable {
- constructor(address registry) RevokableOperatorFilterer(registry, address(0), false) {}
-
- function testFilter(address from) public view onlyAllowedOperator(from) returns (bool) {
- return true;
- }
-
- function owner() public view override(Ownable, UpdatableOperatorFilterer) returns (address) {
- return Ownable.owner();
- }
-}
diff --git a/test/helpers/RevokableUpgradeableFilterer.sol b/test/helpers/RevokableUpgradeableFilterer.sol
deleted file mode 100644
index 028cac8..0000000
--- a/test/helpers/RevokableUpgradeableFilterer.sol
+++ /dev/null
@@ -1,25 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {RevokableOperatorFiltererUpgradeable} from "../../src/upgradeable/RevokableOperatorFiltererUpgradeable.sol";
-import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
-
-contract RevokableUpgradeableFilterer is RevokableOperatorFiltererUpgradeable, Ownable {
- constructor() RevokableOperatorFiltererUpgradeable() {}
-
- function testFilter(address from) public view onlyAllowedOperator(from) returns (bool) {
- return true;
- }
-
- function checkFilterOperator(address operator) public view {
- _checkFilterOperator(operator);
- }
-
- function init(address subscription, bool subscribe) public initializer {
- __OperatorFilterer_init(subscription, subscribe);
- }
-
- function owner() public view override(Ownable, RevokableOperatorFiltererUpgradeable) returns (address) {
- return Ownable.owner();
- }
-}
diff --git a/test/helpers/UpdatableFilterer.sol b/test/helpers/UpdatableFilterer.sol
deleted file mode 100644
index af06c9b..0000000
--- a/test/helpers/UpdatableFilterer.sol
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {UpdatableOperatorFilterer} from "../../src/UpdatableOperatorFilterer.sol";
-import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
-
-contract UpdatableFilterer is UpdatableOperatorFilterer, Ownable {
- constructor(address registry) UpdatableOperatorFilterer(registry, address(0), false) {}
-
- function testFilter(address from) public view onlyAllowedOperator(from) returns (bool) {
- return true;
- }
-
- function owner() public view override(Ownable, UpdatableOperatorFilterer) returns (address) {
- return Ownable.owner();
- }
-
- function checkFilterOperator(address operator) public view {
- _checkFilterOperator(operator);
- }
-}
diff --git a/test/helpers/UpgradeableFilterer.sol b/test/helpers/UpgradeableFilterer.sol
deleted file mode 100644
index 1374d5f..0000000
--- a/test/helpers/UpgradeableFilterer.sol
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {OperatorFiltererUpgradeable} from "../../src/upgradeable/OperatorFiltererUpgradeable.sol";
-import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
-
-contract UpgradeableFilterer is OperatorFiltererUpgradeable, Ownable {
- constructor() OperatorFiltererUpgradeable() {}
-
- function testFilter(address from) public view onlyAllowedOperator(from) returns (bool) {
- return true;
- }
-
- function checkFilterOperator(address operator) public view {
- _checkFilterOperator(operator);
- }
-
- function init(address subscription, bool subscribe) public initializer {
- __OperatorFilterer_init(subscription, subscribe);
- }
-}
diff --git a/test/upgradeable/RevokableUpgradeableOperatorFilterer.t.sol b/test/upgradeable/RevokableUpgradeableOperatorFilterer.t.sol
deleted file mode 100644
index 8b4208f..0000000
--- a/test/upgradeable/RevokableUpgradeableOperatorFilterer.t.sol
+++ /dev/null
@@ -1,43 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.17;
-
-import {BaseRegistryTest} from "../BaseRegistryTest.sol";
-import {RevokableUpgradeableFilterer} from "../helpers/RevokableUpgradeableFilterer.sol";
-
-contract RevokableUpgradeableOperatorFiltererTest is BaseRegistryTest {
- RevokableUpgradeableFilterer filterer;
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
- address filteredAddress;
- address filteredCodeHashAddress;
- bytes32 filteredCodeHash;
- address notFiltered;
-
- function setUp() public virtual override {
- super.setUp();
- notFiltered = makeAddr("not filtered");
- filterer = new RevokableUpgradeableFilterer();
- filterer.init(address(0), false);
- filteredAddress = makeAddr("filtered address");
- registry.updateOperator(address(filterer), filteredAddress, true);
- filteredCodeHashAddress = makeAddr("filtered code hash");
- bytes memory code = hex"deadbeef";
- filteredCodeHash = keccak256(code);
- registry.updateCodeHash(address(filterer), filteredCodeHash, true);
- vm.etch(filteredCodeHashAddress, code);
- }
-
- function testRevoke() public {
- filterer.revokeOperatorFilterRegistry();
- vm.prank(filteredAddress);
- assertTrue(filterer.testFilter(address(0)));
-
- assertTrue(filterer.isOperatorFilterRegistryRevoked());
-
- vm.expectRevert(abi.encodeWithSignature("AlreadyRevoked()"));
- filterer.revokeOperatorFilterRegistry();
-
- vm.prank(makeAddr("not owner"));
- vm.expectRevert(abi.encodeWithSignature("OnlyOwner()"));
- filterer.revokeOperatorFilterRegistry();
- }
-}
diff --git a/test/upgradeable/UpgradeableOperatorFilterer.t.sol b/test/upgradeable/UpgradeableOperatorFilterer.t.sol
deleted file mode 100644
index cb0a849..0000000
--- a/test/upgradeable/UpgradeableOperatorFilterer.t.sol
+++ /dev/null
@@ -1,37 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.17;
-
-import {BaseRegistryTest} from "../BaseRegistryTest.sol";
-import {UpgradeableFilterer} from "../helpers/UpgradeableFilterer.sol";
-
-contract UpgradeableOperatorFiltererTest is BaseRegistryTest {
- UpgradeableFilterer filterer;
- address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
-
- function setUp() public virtual override {
- super.setUp();
- filterer = new UpgradeableFilterer();
- vm.startPrank(DEFAULT_SUBSCRIPTION);
- registry.register(DEFAULT_SUBSCRIPTION);
- registry.updateOperator(DEFAULT_SUBSCRIPTION, makeAddr("operator"), true);
- vm.stopPrank();
- }
-
- function testInit_copy() public {
- filterer.init(DEFAULT_SUBSCRIPTION, false);
- assertTrue(registry.isOperatorFiltered(address(filterer), makeAddr("operator")));
- }
-
- function testInit_noSubscription() public {
- filterer.init(address(0), false);
- assertTrue(registry.isRegistered(address(filterer)));
- }
-
- function testInit_registered() public {
- vm.prank(address(filterer));
- registry.register(address(filterer));
- filterer.init(DEFAULT_SUBSCRIPTION, true);
- // should not be subscribed since already registered
- assertEq(registry.subscriptionOf(address(filterer)), address(0));
- }
-}
diff --git a/test/validation/ExampleERC1155Validation.t.sol b/test/validation/ExampleERC1155Validation.t.sol
deleted file mode 100644
index ddced3d..0000000
--- a/test/validation/ExampleERC1155Validation.t.sol
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ValidationTest} from "./Validation.t.sol";
-import {TestableExampleERC1155} from "../example/ExampleERC1155.t.sol";
-
-interface IOperatorFilterRegistry {
- function filteredOperators(address addr) external returns (address[] memory);
-}
-
-contract ExampleERC1155ValidationTest is ValidationTest {
- function setUp() public override {
- owner = makeAddr("owner");
- tokenId = 1;
-
- // Fork mainnet
- vm.createSelectFork(getChain("mainnet").rpcUrl);
- filteredOperators =
- IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY).filteredOperators(CANONICAL_REGISTRANT);
- TestableExampleERC1155 nftContract = new TestableExampleERC1155();
- nftContract.mint(owner, tokenId);
- contractAddress = address(nftContract);
- }
-}
diff --git a/test/validation/ExampleERC721Validation.t.sol b/test/validation/ExampleERC721Validation.t.sol
deleted file mode 100644
index ac54155..0000000
--- a/test/validation/ExampleERC721Validation.t.sol
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {ValidationTest} from "./Validation.t.sol";
-import {TestableExampleERC721} from "../example/ExampleERC721.t.sol";
-
-interface IOperatorFilterRegistry {
- function filteredOperators(address addr) external returns (address[] memory);
-}
-
-contract ExampleERC721ValidationTest is ValidationTest {
- function setUp() public override {
- owner = makeAddr("owner");
- tokenId = 1;
-
- // Fork mainnet
- vm.createSelectFork(getChain("mainnet").rpcUrl);
- filteredOperators =
- IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY).filteredOperators(CANONICAL_REGISTRANT);
- TestableExampleERC721 nftContract = new TestableExampleERC721();
- nftContract.mint(owner, tokenId);
- contractAddress = address(nftContract);
- }
-}
diff --git a/test/validation/Validation.t.sol b/test/validation/Validation.t.sol
deleted file mode 100644
index 91e2ece..0000000
--- a/test/validation/Validation.t.sol
+++ /dev/null
@@ -1,220 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.13;
-
-import {Test, console2} from "forge-std/Test.sol";
-import {IERC721} from "forge-std/interfaces/IERC721.sol";
-import {IERC1155} from "forge-std/interfaces/IERC1155.sol";
-import {IERC165} from "forge-std/interfaces/IERC165.sol";
-import {TestableExampleERC721} from "../example/ExampleERC721.t.sol";
-
-interface IOperatorFilterRegistry {
- function filteredOperators(address addr) external returns (address[] memory);
-}
-
-interface IERC721SeaDrop {
- function owner() external view returns (address);
-
- function setMaxSupply(uint256 newMaxSupply) external;
-
- function updateAllowedSeaDrop(address[] calldata allowedSeaDrop) external;
-
- function mintSeaDrop(address minter, uint256 quantity) external;
-
- function totalSupply() external view returns (uint256);
-}
-
-contract ValidationTest is Test {
- address constant LOOKSRAREV2_TRANSFER_MANAGER = 0x000000000060C4Ca14CfC4325359062ace33Fe3D;
-
- address constant CANONICAL_OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;
- address constant CANONICAL_REGISTRANT = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
-
- // Contract to test against
- /// The token contract to test against.
- address contractAddress;
-
- /// The token ID to test against.
- uint256 tokenId;
-
- /// The owner of the NFT.
- address owner;
-
- /// The filtered operators to check compliance against.
- address[] filteredOperators;
-
- /// The canonical cross-chain SeaDrop contract.
- address seaDrop = 0x00005EA00Ac477B1030CE78506496e8C2dE24bf5;
-
- /// The INonFungibleSeaDropToken interface ID.
- bytes4 constant SEADROP_TOKEN_INTERFACE_ID = 0x1890fe8e;
-
- function setUp() public virtual {
- // Fork network
- try vm.envString("NETWORK") returns (string memory envNetwork) {
- vm.createSelectFork(getChain(envNetwork).rpcUrl);
- } catch {
- // fallback to mainnet
- vm.createSelectFork(getChain("mainnet").rpcUrl);
- }
-
- filteredOperators =
- IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY).filteredOperators(CANONICAL_REGISTRANT);
-
- // try to load token ID from .env
- try vm.envUint("TOKEN_ID") returns (uint256 _tokenId) {
- tokenId = _tokenId;
- } catch (bytes memory) {
- // fallback to 1
- tokenId = 1;
- }
-
- // try to load owner from .env
- try vm.envAddress("OWNER") returns (address _owner) {
- owner = _owner;
- } catch (bytes memory) {
- // fallback to dummy EOA
- owner = makeAddr("owner");
- }
-
- // try to load contract address from .env
- try vm.envAddress("CONTRACT_ADDRESS") returns (address _contractAddress) {
- contractAddress = _contractAddress;
- } catch (bytes memory) {
- // fallback to deploying new contract
- TestableExampleERC721 nftContract = new TestableExampleERC721();
- nftContract.mint(owner, tokenId);
- contractAddress = address(nftContract);
- }
- }
-
- function testValidateEnforcement() public {
- IERC165 tokenContract = IERC165(contractAddress);
- try tokenContract.supportsInterface(type(IERC721).interfaceId) returns (bool _supports) {
- if (_supports) {
- _testERC721();
- } else {
- if (tokenContract.supportsInterface(type(IERC1155).interfaceId)) {
- _testERC1155();
- } else {
- // else fall back to ERC721
- console2.log("ERC165 check returned false for both ERC721 and ERC1155, falling back to ERC721.");
- _testERC721();
- }
- }
- } catch {
- // if ERC165 check fails, fall back to ERC721
- console2.log("ERC165 check reverted, falling back to ERC721.");
- _testERC721();
- }
- }
-
- function _testERC721() internal {
- // Cast the contract to an ERC721.
- IERC721 nftContract = IERC721(contractAddress);
-
- // Get the current owner of the NFT
- try nftContract.ownerOf(tokenId) returns (address _owner) {
- owner = _owner;
- } catch {
- // If the tokenId doesn't exist, check if this is a SeaDrop token,
- // which we can simulate a mint for.
- if (!nftContract.supportsInterface(SEADROP_TOKEN_INTERFACE_ID)) {
- revert("The token reverted on ownerOf(tokenId) and it is not a SeaDrop token.");
- }
-
- // Cast the contract to a SeaDrop token.
- IERC721SeaDrop seaDropToken = IERC721SeaDrop(contractAddress);
-
- // Set the token owner to an address, it doesn't matter who this is.
- owner = makeAddr("alice");
-
- // Increase the max supply by 1 so we can mint.
- vm.startPrank(seaDropToken.owner());
- uint256 newMaxSupply = seaDropToken.totalSupply() + 1;
- seaDropToken.setMaxSupply(newMaxSupply);
-
- // Ensure SeaDrop is allowed to mint.
- address[] memory allowedSeaDrop = new address[](1);
- allowedSeaDrop[0] = seaDrop;
- seaDropToken.updateAllowedSeaDrop(allowedSeaDrop);
- vm.stopPrank();
-
- // Mint the token to the token owner.
- vm.prank(seaDrop);
- seaDropToken.mintSeaDrop(owner, 1);
-
- // SeaDrop tokens have a start token id of 1,
- // so the newly minted token id should be totalSupply()
- tokenId = seaDropToken.totalSupply();
- }
-
- for (uint256 i = 0; i < filteredOperators.length; i++) {
- // skip LOOKSRAREV2_TRANSFER_MANAGER as updates are subject to grace period
- if (filteredOperators[i] == LOOKSRAREV2_TRANSFER_MANAGER) {
- continue;
- }
- address operator = filteredOperators[i];
-
- // Try to set approval for the operator.
- vm.startPrank(owner);
- try nftContract.setApprovalForAll(operator, true) {
- // Blocking approvals is not required, so continue to check transfers.
- } catch {
- // Continue to test transfer methods, since marketplace approvals can be
- // hard-coded into contracts.
- }
-
- // Also include per-token approvals as those may not be blocked.
- try nftContract.approve(operator, tokenId) {
- // Continue to check transfers.
- } catch {
- // Continue to test transfer methods, since marketplace approvals can be
- // hard-coded into contracts.
- }
- vm.stopPrank();
-
- // Ensure operator is not able to transfer the token.
- vm.startPrank(operator);
- vm.expectRevert();
- nftContract.safeTransferFrom(owner, address(1), tokenId);
-
- vm.expectRevert();
- nftContract.safeTransferFrom(owner, address(1), tokenId, "");
-
- vm.expectRevert();
- nftContract.transferFrom(owner, address(1), tokenId);
- vm.stopPrank();
- }
- }
-
- function _testERC1155() internal {
- // Cast the contract to an ERC1155.
- IERC1155 nftContract = IERC1155(contractAddress);
-
- for (uint256 i = 0; i < filteredOperators.length; i++) {
- address operator = filteredOperators[i];
-
- // Try to set approval for the operator.
- vm.prank(owner);
- try nftContract.setApprovalForAll(operator, true) {}
- catch (bytes memory) {
- // even if approval reverts, continue to test transfer methods, since marketplace approvals can be
- // hard-coded into contracts
- }
-
- uint256[] memory tokenIds = new uint256[](1);
- tokenIds[0] = tokenId;
- uint256[] memory amounts = new uint256[](1);
- amounts[0] = 1;
-
- // Ensure operator is not able to transfer the token.
- vm.startPrank(operator);
- vm.expectRevert();
- nftContract.safeTransferFrom(owner, address(1), tokenId, 1, "");
-
- vm.expectRevert();
- nftContract.safeBatchTransferFrom(owner, address(1), tokenIds, amounts, "");
- vm.stopPrank();
- }
- }
-}
diff --git a/yarn.lock b/yarn.lock
deleted file mode 100644
index ebafeed..0000000
--- a/yarn.lock
+++ /dev/null
@@ -1,13 +0,0 @@
-# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
-# yarn lockfile v1
-
-
-"@openzeppelin/contracts-upgradeable@^4.8.2":
- version "4.8.2"
- resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.8.2.tgz#edef522bdbc46d478481391553bababdd2199e27"
- integrity sha512-zIggnBwemUmmt9IS73qxi+tumALxCY4QEs3zLCII78k0Gfse2hAOdAkuAeLUzvWUpneMUfFE5sGHzEUSTvn4Ag==
-
-"@openzeppelin/contracts@^4.7.3":
- version "4.7.3"
- resolved "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.7.3.tgz"
- integrity sha512-dGRS0agJzu8ybo44pCIf3xBaPQN/65AIXNgK8+4gzKd5kbvlqyxryUYVLJv7fK98Seyd2hDZzVEHSWAh0Bt1Yw==