Skip to content

Commit

Permalink
remove operator filterer registry from 721 (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
iainnash authored Sep 14, 2023
1 parent 9228c58 commit 30ab758
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 912 deletions.
11 changes: 0 additions & 11 deletions DEPLOYING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ Make sure required addresses / multisigs are setup for
1. funds recipient
2. contract factory upgrade owner address

Ensure that the default operator-filterer-registry deployment is on the current chain.

If not, use the mainnet default filter address to re-deploy on the chain using ImmutableCreate2Factory (required also for seaport).

To deploy ImmutableCreate2Factory, follow the steps in the seaport deploy scripts: https://github.com/ProjectOpenSea/seaport/blob/main/docs/Deployment.md#setting-up-factory-on-a-new-chain

example call:
cast send 0x0000000000FFe8B47B3e2130213B802212439497 'function safeCreate2(bytes32,bytes)' [...] --rpc-url $(rpc base) --interactive

copied from the mainnet deploy txn: https://etherscan.io/tx/0x4c2038f55147cae309c2e597a5323b42b63fd556a15d2f1b5a799eee1b3ddf04

### 1. Setup `chainConfigs` file.

Use `1.json` for reference. We are ordering keys alphabetically.
Expand Down
4 changes: 0 additions & 4 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {ERC721Drop} from "../src/ERC721Drop.sol";
import {ERC721DropProxy} from "../src/ERC721DropProxy.sol";
import {ZoraNFTCreatorV1} from "../src/ZoraNFTCreatorV1.sol";
import {ZoraNFTCreatorProxy} from "../src/ZoraNFTCreatorProxy.sol";
import {IOperatorFilterRegistry} from "../src/interfaces/IOperatorFilterRegistry.sol";
import {FactoryUpgradeGate} from "../src/FactoryUpgradeGate.sol";
import {DropMetadataRenderer} from "../src/metadata/DropMetadataRenderer.sol";
import {EditionMetadataRenderer} from "../src/metadata/EditionMetadataRenderer.sol";
Expand All @@ -25,8 +24,6 @@ contract Deploy is ZoraDropsDeployBase {
console2.log("Factory Owner", chainConfig.factoryOwner);
console2.log("Fee Recipient", chainConfig.mintFeeRecipient);
console2.log("Fee Amount", chainConfig.mintFeeAmount);
console2.log("Filterer Registry", chainConfig.subscriptionMarketFilterAddress);
console2.log("Filterer Subscription", chainConfig.subscriptionMarketFilterOwner);

console2.log("Setup contracts ---");

Expand All @@ -41,7 +38,6 @@ contract Deploy is ZoraDropsDeployBase {
ERC721Drop dropImplementation = new ERC721Drop({
_zoraERC721TransferHelper: address(0x0),
_factoryUpgradeGate: factoryUpgradeGate,
_marketFilterDAOAddress: address(chainConfig.subscriptionMarketFilterAddress),
_mintFeeAmount: chainConfig.mintFeeAmount,
_mintFeeRecipient: payable(chainConfig.mintFeeRecipient),
_protocolRewards: address(chainConfig.protocolRewards)
Expand Down
2 changes: 0 additions & 2 deletions script/TestUpgradeAndMint.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {ZoraNFTCreatorV1} from "../src/ZoraNFTCreatorV1.sol";
import {IERC721Drop} from "../src/interfaces/IERC721Drop.sol";

import {ZoraNFTCreatorProxy} from "../src/ZoraNFTCreatorProxy.sol";
import {IOperatorFilterRegistry} from "../src/interfaces/IOperatorFilterRegistry.sol";
import {OwnedSubscriptionManager} from "../src/filter/OwnedSubscriptionManager.sol";
import {FactoryUpgradeGate} from "../src/FactoryUpgradeGate.sol";
import {DropMetadataRenderer} from "../src/metadata/DropMetadataRenderer.sol";
import {EditionMetadataRenderer} from "../src/metadata/EditionMetadataRenderer.sol";
Expand Down
3 changes: 0 additions & 3 deletions script/UpgradeERC721DropFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {ERC721Drop} from "../src/ERC721Drop.sol";
import {ERC721DropProxy} from "../src/ERC721DropProxy.sol";
import {ZoraNFTCreatorV1} from "../src/ZoraNFTCreatorV1.sol";
import {ZoraNFTCreatorProxy} from "../src/ZoraNFTCreatorProxy.sol";
import {IOperatorFilterRegistry} from "../src/interfaces/IOperatorFilterRegistry.sol";
import {OwnedSubscriptionManager} from "../src/filter/OwnedSubscriptionManager.sol";
import {FactoryUpgradeGate} from "../src/FactoryUpgradeGate.sol";
import {DropMetadataRenderer} from "../src/metadata/DropMetadataRenderer.sol";
import {EditionMetadataRenderer} from "../src/metadata/EditionMetadataRenderer.sol";
Expand Down Expand Up @@ -57,7 +55,6 @@ contract UpgradeERC721DropFactory is ZoraDropsDeployBase {
ERC721Drop dropImplementation = new ERC721Drop({
_zoraERC721TransferHelper: chainConfig.zoraERC721TransferHelper,
_factoryUpgradeGate: IFactoryUpgradeGate(deployment.factoryUpgradeGate),
_marketFilterDAOAddress: chainConfig.subscriptionMarketFilterAddress,
_mintFeeAmount: chainConfig.mintFeeAmount,
_mintFeeRecipient: payable(chainConfig.mintFeeRecipient),
_protocolRewards: chainConfig.protocolRewards
Expand Down
7 changes: 0 additions & 7 deletions src/DeploymentConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ struct ChainConfig {
uint256 mintFeeAmount;
/// @notice Mint fee recipient user
address mintFeeRecipient;
/// @notice Subscription address for operator-filterer-registry (opensea / cori)
address subscriptionMarketFilterAddress;
/// @notice Owner for subscription of operator-filterer-registry (opensea / cori)
address subscriptionMarketFilterOwner;
/// @notice Auto-approved hyperstructure on mainnet for enabling ZORA v3 with less gas. Deprecated – safe to set to address(0x)
address zoraERC721TransferHelper;
/// @notice The Protocol Rewards contract
Expand Down Expand Up @@ -65,8 +61,6 @@ abstract contract DeploymentConfig is StdChains, StdCheatsSafe, StdUtils, Script
string constant FACTORY_UPGRADE_GATE_OWNER = "FACTORY_OWNER";
string constant MINT_FEE_AMOUNT = "MINT_FEE_AMOUNT";
string constant MINT_FEE_RECIPIENT = "MINT_FEE_RECIPIENT";
string constant SUBSCRIPTION_MARKET_FILTER_ADDRESS = "SUBSCRIPTION_MARKET_FILTER_ADDRESS";
string constant SUBSCRIPTION_MARKET_FILTER_OWNER = "SUBSCRIPTION_MARKET_FILTER_OWNER";
string constant ZORA_ERC721_TRANSFER_HELPER = "ZORA_ERC721_TRANSFER_HELPER";
string constant PROTOCOL_REWARDS = "PROTOCOL_REWARDS";

Expand All @@ -93,7 +87,6 @@ abstract contract DeploymentConfig is StdChains, StdCheatsSafe, StdUtils, Script
chainConfig.factoryUpgradeGateOwner = json.readAddress(getKeyPrefix(FACTORY_UPGRADE_GATE_OWNER));
chainConfig.mintFeeAmount = json.readUint(getKeyPrefix(MINT_FEE_AMOUNT));
chainConfig.mintFeeRecipient = json.readAddress(getKeyPrefix(MINT_FEE_RECIPIENT));
chainConfig.subscriptionMarketFilterAddress = json.readAddress(getKeyPrefix(SUBSCRIPTION_MARKET_FILTER_ADDRESS));
chainConfig.zoraERC721TransferHelper = json.readAddress(getKeyPrefix(ZORA_ERC721_TRANSFER_HELPER));
chainConfig.protocolRewards = json.readAddress(getKeyPrefix(PROTOCOL_REWARDS));
}
Expand Down
79 changes: 0 additions & 79 deletions src/ERC721Drop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {ERC721Rewards} from "@zoralabs/protocol-rewards/src/abstract/ERC721/ERC7
import {ERC721RewardsStorageV1} from "@zoralabs/protocol-rewards/src/abstract/ERC721/ERC721RewardsStorageV1.sol";

import {IMetadataRenderer} from "./interfaces/IMetadataRenderer.sol";
import {IOperatorFilterRegistry} from "./interfaces/IOperatorFilterRegistry.sol";
import {IERC721Drop} from "./interfaces/IERC721Drop.sol";
import {IOwnable} from "./interfaces/IOwnable.sol";
import {IERC4906} from "./interfaces/IERC4906.sol";
Expand Down Expand Up @@ -97,12 +96,6 @@ contract ERC721Drop is
// /// @notice Empty string for blank comments
// string constant EMPTY_STRING = "";

/// @notice Market filter DAO address for opensea filter registry
address public immutable marketFilterDAOAddress;

IOperatorFilterRegistry immutable operatorFilterRegistry =
IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);

/// @notice Only allow for users with admin access
modifier onlyAdmin() {
if (!hasRole(DEFAULT_ADMIN_ROLE, _msgSender())) {
Expand Down Expand Up @@ -178,20 +171,17 @@ contract ERC721Drop is
/// @dev Marked as an initializer to prevent storage being used of base implementation. Can only be init'd by a proxy.
/// @param _zoraERC721TransferHelper Transfer helper
/// @param _factoryUpgradeGate Factory upgrade gate address
/// @param _marketFilterDAOAddress Market filter DAO address
/// @param _mintFeeAmount Mint fee amount in wei
/// @param _mintFeeRecipient Mint fee recipient address
constructor(
address _zoraERC721TransferHelper,
IFactoryUpgradeGate _factoryUpgradeGate,
address _marketFilterDAOAddress,
uint256 _mintFeeAmount,
address payable _mintFeeRecipient,
address _protocolRewards
) initializer ERC721Rewards(_protocolRewards, _mintFeeRecipient) {
zoraERC721TransferHelper = _zoraERC721TransferHelper;
factoryUpgradeGate = _factoryUpgradeGate;
marketFilterDAOAddress = _marketFilterDAOAddress;
ZORA_MINT_FEE = _mintFeeAmount;
ZORA_MINT_FEE_RECIPIENT = _mintFeeRecipient;
}
Expand Down Expand Up @@ -759,75 +749,6 @@ contract ERC721Drop is
return firstMintedTokenId;
}

/**
*** ---------------------------------- ***
*** ***
*** ADMIN OPERATOR FILTERING ***
*** ***
*** ---------------------------------- ***
***/

/// @notice Proxy to update market filter settings in the main registry contracts
/// @notice Requires admin permissions
/// @param args Calldata args to pass to the registry
function updateMarketFilterSettings(bytes calldata args)
external
onlyAdmin
returns (bytes memory)
{
(bool success, bytes memory ret) = address(operatorFilterRegistry).call(
args
);
if (!success) {
revert RemoteOperatorFilterRegistryCallFailed();
}
return ret;
}

/// @notice Manage subscription to the DAO for marketplace filtering based off royalty payouts.
/// @param enable Enable filtering to non-royalty payout marketplaces
function manageMarketFilterDAOSubscription(bool enable) external onlyAdmin {
address self = address(this);
if (marketFilterDAOAddress == address(0x0)) {
revert MarketFilterDAOAddressNotSupportedForChain();
}
if (!operatorFilterRegistry.isRegistered(self) && enable) {
operatorFilterRegistry.registerAndSubscribe(
self,
marketFilterDAOAddress
);
} else if (enable) {
operatorFilterRegistry.subscribe(self, marketFilterDAOAddress);
} else {
operatorFilterRegistry.unsubscribe(self, false);
operatorFilterRegistry.unregister(self);
}
}

/// @notice Hook to filter operators (no-op if no filters are registered)
/// @dev Part of ERC721A token hooks
/// @param from Transfer from user
function _beforeTokenTransfers(
address from,
address,
uint256,
uint256
) internal virtual override {
if (
from != address(0) && // skip on mints
from != msg.sender // skip on transfers from sender
) {
if (
!operatorFilterRegistry.isOperatorAllowed(
address(this),
msg.sender
)
) {
revert OperatorNotAllowed(msg.sender);
}
}
}

/**
*** ---------------------------------- ***
*** ***
Expand Down
14 changes: 0 additions & 14 deletions src/filter/OwnedSubscriptionManager.sol

This file was deleted.

30 changes: 0 additions & 30 deletions src/interfaces/IOperatorFilterRegistry.sol

This file was deleted.

Loading

0 comments on commit 30ab758

Please sign in to comment.