Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #108 from ProjectOpenSea/update-validation
Browse files Browse the repository at this point in the history
Update README and validation tests with LR V2 TransferManager; version bump
  • Loading branch information
operatorfilterer authored Jun 6, 2023
2 parents 1bc3358 + f542d9d commit 12dde4c
Show file tree
Hide file tree
Showing 22 changed files with 152 additions and 113 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ out/

# Dotenv file
.env
# Dotfiles generally
.*

remappings.txt
broadcast/

# nodejs files
node_modules
yarn-error.log

html/
html/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/openzeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
55 changes: 4 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,62 +88,15 @@ Entries in this list are added according to the following criteria:
<td>Ethereum Mainnet</td>
</tr>

</table>

## Deployments

<table>
<tr>
<th>Network</th>
<th>CORI Subscription TimelockController</th>
<th>OperatorFilterRegistry</th>
<th>CORI Curated Subscription Address</th>
</tr>

<tr><td>Ethereum</td>
<td>

0x178AD648e66815E1B01791eBBdbF7b2D7C5B1626

</td>
<td rowspan="20">

[0x000000000000AAeB6D7670E522A718067333cd4E](https://etherscan.io/address/0x000000000000AAeB6D7670E522A718067333cd4E#code)

</td><td rowspan="20">

0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6

</td></tr>

<tr>
<td>Polygon</td>

<td>
0x87bCD4735CbCF9CE98ea2822fBf3F05F2ce10f96
</td>
<td></td>
<td></td>
<td>Looksrare V2 TransferManager</td>
<td>0x000000000060C4Ca14CfC4325359062ace33Fe3D</td>
<td>Ethereum Mainnet</td>
</tr>

<tr><td>Goerli</td><td rowspan="20">0xe3A6CD067a1193b903143C36dA00557c9d95C41e</td></tr>
<tr><td>Mumbai</td></tr>
<tr><td>Optimism</td></tr>
<tr><td>Optimism Goerli</td></tr>
<tr><td>Arbitrum One</td></tr>
<tr><td>Arbitrum Nova</td></tr>
<tr><td>Arbitrum Goerli</td></tr>
<tr><td>Avalanche</td></tr>
<tr><td>Avalanche Fuji</td></tr>
<tr><td>Klaytn</td></tr>
<tr><td>Baobab</td></tr>
<tr><td>BSC</td></tr>
<tr><td>BSC Testnet</td></tr>
<tr><td>Gnosis</td></tr>

</table>

To mitigate abuse of the CORI curated subscription of filtered operators and codehashes, the CORI curated subscription is owned by a `TimelockController`, which is in turn owned by a multi-signature wallet. Any update to CORI's list of filtered operators must be approved by at least two members of the Creator Ownership Research Institute, and is then subject to a minimum 24-hour delay before being executed. During this time, updates may be reviewed and revoked.
## Deployments

## Usage

Expand Down
8 changes: 6 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ 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
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
1 change: 1 addition & 0 deletions lib/ds-test
Submodule ds-test added at e28215
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "operator-filter-registry",
"version": "1.4.0",
"version": "1.4.2",
"repository": "[email protected]:ProjectOpenSea/operator-filter-registry.git",
"author": "Operator Filterer <[email protected]>",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion script/ConfigureOwnedRegistrant.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract ConfigureOwnedRegistrant is ScriptBase {
string[] memory chains = vm.envString("CHAINS", ",");
for (uint256 i = 0; i < chains.length; i++) {
string memory chain = chains[i];
vm.createSelectFork(stdChains[chain].rpcUrl);
vm.createSelectFork(getChain(chain).rpcUrl);
vm.startBroadcast(deployer);
registry.updateOperators(address(registrant), add, true);
registry.updateOperators(address(registrant), remove, false);
Expand Down
2 changes: 1 addition & 1 deletion script/DeployRegistryAndRegistrant.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ contract DeployRegistryAndRegistrant is ScriptBase {
for (uint256 i; i < chains.length; i++) {
string memory chain = chains[i];
console2.log(chain);
vm.createSelectFork(stdChains[chain].rpcUrl);
vm.createSelectFork(getChain(chain).rpcUrl);
vm.startBroadcast(deployer);
IMMUTABLE_CREATE2_FACTORY.safeCreate2(salt, creationCode);
OwnedRegistrant registrant =
Expand Down
2 changes: 1 addition & 1 deletion src/example/ExampleERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ abstract contract ExampleERC1155 is ERC1155(""), ERC2981, DefaultOperatorFiltere
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, ERC2981) returns (bool) {
return super.supportsInterface(interfaceId);
return ERC1155.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId);
}
}
2 changes: 1 addition & 1 deletion src/example/upgradeable/ExampleERC1155Upgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ abstract contract ExampleERC1155Upgradeable is
public
view
virtual
override (ERC1155Upgradeable, ERC2981Upgradeable)
override(ERC1155Upgradeable, ERC2981Upgradeable)
returns (bool)
{
return super.supportsInterface(interfaceId);
Expand Down
2 changes: 1 addition & 1 deletion src/example/upgradeable/ExampleERC721Upgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ abstract contract ExampleERC721Upgradeable is
public
view
virtual
override (ERC721Upgradeable, ERC2981Upgradeable)
override(ERC721Upgradeable, ERC2981Upgradeable)
returns (bool)
{
return super.supportsInterface(interfaceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ abstract contract RevokableExampleERC1155Upgradeable is
public
view
virtual
override (OwnableUpgradeable, RevokableOperatorFiltererUpgradeable)
override(OwnableUpgradeable, RevokableOperatorFiltererUpgradeable)
returns (address)
{
return OwnableUpgradeable.owner();
Expand All @@ -85,7 +85,7 @@ abstract contract RevokableExampleERC1155Upgradeable is
public
view
virtual
override (ERC1155Upgradeable, ERC2981Upgradeable)
override(ERC1155Upgradeable, ERC2981Upgradeable)
returns (bool)
{
return super.supportsInterface(interfaceId);
Expand Down
4 changes: 2 additions & 2 deletions src/example/upgradeable/RevokableExampleERC721Upgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ abstract contract RevokableExampleERC721Upgradeable is
public
view
virtual
override (OwnableUpgradeable, RevokableOperatorFiltererUpgradeable)
override(OwnableUpgradeable, RevokableOperatorFiltererUpgradeable)
returns (address)
{
return OwnableUpgradeable.owner();
Expand All @@ -95,7 +95,7 @@ abstract contract RevokableExampleERC721Upgradeable is
public
view
virtual
override (ERC721Upgradeable, ERC2981Upgradeable)
override(ERC721Upgradeable, ERC2981Upgradeable)
returns (bool)
{
return super.supportsInterface(interfaceId);
Expand Down
5 changes: 2 additions & 3 deletions src/example/upgradeable/UpdatableExampleERC721Upgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ 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";
import {UpdatableOperatorFiltererUpgradeable} from "../../upgradeable/UpdatableOperatorFiltererUpgradeable.sol";

/**
* @title UpdatableExampleERC721Upgradeable
Expand Down Expand Up @@ -54,7 +53,7 @@ abstract contract UpdatableExampleERC721Upgradeable is
public
view
virtual
override (OwnableUpgradeable, UpdatableOperatorFiltererUpgradeable)
override(OwnableUpgradeable, UpdatableOperatorFiltererUpgradeable)
returns (address)
{
return OwnableUpgradeable.owner();
Expand Down
18 changes: 7 additions & 11 deletions test/example/upgradeable/UpdatableExampleERC721Upgradeable.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ 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 {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";
Expand All @@ -31,7 +29,7 @@ contract UpdatableERC721UpgradeableForUpgradableTest is BaseRegistryTest, Initia

vm.startPrank(DEFAULT_SUBSCRIPTION);
registry.register(DEFAULT_SUBSCRIPTION);

filteredAddress = makeAddr("filtered address");
registry.updateOperator(address(DEFAULT_SUBSCRIPTION), filteredAddress, true);
vm.stopPrank();
Expand Down Expand Up @@ -115,9 +113,7 @@ contract UpdatableERC721UpgradeableForUpgradableTest is BaseRegistryTest, Initia
}
}


contract ConcreteUpdatableOperatorFiltererUpgradable is UpdatableOperatorFiltererUpgradeable, OwnableUpgradeable {

function initialize(address registry, address registrant, bool sub) public initializer {
__Ownable_init();
__UpdatableOperatorFiltererUpgradeable_init(registry, registrant, sub);
Expand All @@ -135,7 +131,7 @@ contract ConcreteUpdatableOperatorFiltererUpgradable is UpdatableOperatorFiltere
public
view
virtual
override (OwnableUpgradeable, UpdatableOperatorFiltererUpgradeable)
override(OwnableUpgradeable, UpdatableOperatorFiltererUpgradeable)
returns (address)
{
return OwnableUpgradeable.owner();
Expand Down Expand Up @@ -186,7 +182,6 @@ contract UpdatableERC721UpgradeableForUpdatableTest is BaseRegistryTest {
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 {
Expand Down Expand Up @@ -220,7 +215,7 @@ contract UpdatableERC721UpgradeableForUpdatableTest is BaseRegistryTest {
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);
Expand Down Expand Up @@ -268,7 +263,8 @@ contract UpdatableERC721UpgradeableForUpdatableTest is BaseRegistryTest {

function testRevert_OperatorNotAllowed() public {
address stubRegistry = address(new OperatorFilterRegistryStub());
ConcreteUpdatableOperatorFiltererUpgradable updatableFilterer = new ConcreteUpdatableOperatorFiltererUpgradable();
ConcreteUpdatableOperatorFiltererUpgradable updatableFilterer =
new ConcreteUpdatableOperatorFiltererUpgradable();
updatableFilterer.initialize(stubRegistry, address(0), false);
vm.expectRevert(abi.encodeWithSelector(OperatorFilterer.OperatorNotAllowed.selector, address(filteredAddress)));
updatableFilterer.checkFilterOperator(filteredAddress);
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/RevokableFilterer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contract RevokableFilterer is RevokableOperatorFilterer, Ownable {
return true;
}

function owner() public view override (Ownable, UpdatableOperatorFilterer) returns (address) {
function owner() public view override(Ownable, UpdatableOperatorFilterer) returns (address) {
return Ownable.owner();
}
}
2 changes: 1 addition & 1 deletion test/helpers/RevokableUpgradeableFilterer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contract RevokableUpgradeableFilterer is RevokableOperatorFiltererUpgradeable, O
__OperatorFilterer_init(subscription, subscribe);
}

function owner() public view override (Ownable, RevokableOperatorFiltererUpgradeable) returns (address) {
function owner() public view override(Ownable, RevokableOperatorFiltererUpgradeable) returns (address) {
return Ownable.owner();
}
}
2 changes: 1 addition & 1 deletion test/helpers/UpdatableFilterer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contract UpdatableFilterer is UpdatableOperatorFilterer, Ownable {
return true;
}

function owner() public view override (Ownable, UpdatableOperatorFilterer) returns (address) {
function owner() public view override(Ownable, UpdatableOperatorFilterer) returns (address) {
return Ownable.owner();
}

Expand Down
4 changes: 2 additions & 2 deletions test/validation/ExampleERC1155Validation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ contract ExampleERC1155ValidationTest is ValidationTest {
tokenId = 1;

// Fork mainnet
vm.createSelectFork(stdChains["mainnet"].rpcUrl);
vm.createSelectFork(getChain("mainnet").rpcUrl);
filteredOperators =
IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY).filteredOperators(CANONICAL_OPENSEA_REGISTRANT);
IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY).filteredOperators(CANONICAL_REGISTRANT);
TestableExampleERC1155 nftContract = new TestableExampleERC1155();
nftContract.mint(owner, tokenId);
contractAddress = address(nftContract);
Expand Down
4 changes: 2 additions & 2 deletions test/validation/ExampleERC721Validation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ contract ExampleERC721ValidationTest is ValidationTest {
tokenId = 1;

// Fork mainnet
vm.createSelectFork(stdChains["mainnet"].rpcUrl);
vm.createSelectFork(getChain("mainnet").rpcUrl);
filteredOperators =
IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY).filteredOperators(CANONICAL_OPENSEA_REGISTRANT);
IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY).filteredOperators(CANONICAL_REGISTRANT);
TestableExampleERC721 nftContract = new TestableExampleERC721();
nftContract.mint(owner, tokenId);
contractAddress = address(nftContract);
Expand Down
Loading

0 comments on commit 12dde4c

Please sign in to comment.