From a9bdce6904c7f9edeb4b160ba2250bf309ecc01c Mon Sep 17 00:00:00 2001 From: Rohan Kulkarni Date: Wed, 27 Sep 2023 15:04:12 -0400 Subject: [PATCH 1/8] refactor: implement first minter reward on adminMint --- src/nft/ZoraCreator1155Impl.sol | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/nft/ZoraCreator1155Impl.sol b/src/nft/ZoraCreator1155Impl.sol index be267bc3b..1a683153f 100644 --- a/src/nft/ZoraCreator1155Impl.sol +++ b/src/nft/ZoraCreator1155Impl.sol @@ -365,15 +365,6 @@ contract ZoraCreator1155Impl is return config.owner; } - /// @notice AdminMint that only checks if the requested quantity can be minted and has a re-entrant guard - /// @param recipient recipient for admin minted tokens - /// @param tokenId token id to mint - /// @param quantity quantity to mint - /// @param data callback data as specified by the 1155 spec - function _adminMint(address recipient, uint256 tokenId, uint256 quantity, bytes memory data) internal { - _mint(recipient, tokenId, quantity, data); - } - /// @notice Mint a token to a user as the admin or minter /// @param recipient The recipient of the token /// @param tokenId The token ID to mint @@ -385,8 +376,15 @@ contract ZoraCreator1155Impl is uint256 quantity, bytes memory data ) external nonReentrant onlyAdminOrRole(tokenId, PERMISSION_BIT_MINTER) { - // Call internal admin mint - _adminMint(recipient, tokenId, quantity, data); + // If this is the token's first mint: + if (firstMinters[tokenId] == address(0)) { + // Store the recipient address as the first minter + // Note: If the recipient is address(0) the tx will revert in the `_mint` call below + firstMinters[tokenId] = recipient; + } + + // Mint the specified tokens + _mint(recipient, tokenId, quantity, data); } /// @notice Batch mint tokens to a user as the admin or minter From 5a678f8681f85310d7e7617fb33dcdddbd1a2fdc Mon Sep 17 00:00:00 2001 From: Rohan Kulkarni Date: Wed, 27 Sep 2023 15:49:57 -0400 Subject: [PATCH 2/8] chore: update runs --- foundry.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/foundry.toml b/foundry.toml index 46a4a6152..1d0038496 100644 --- a/foundry.toml +++ b/foundry.toml @@ -2,7 +2,7 @@ fs_permissions = [{access = "read", path = "./addresses"}, {access = "read", path = "./chainConfigs"}, {access = "read", path = "./package.json"}] libs = ['_imagine', 'node_modules', 'script'] optimizer = true -optimizer_runs = 150 +optimizer_runs = 50 out = 'out' solc_version = '0.8.17' src = 'src' @@ -10,7 +10,7 @@ via_ir = true [profile.optimized] optimizer = true -optimizer_runs = 150 +optimizer_runs = 50 out = 'out' script = 'src' solc_version = '0.8.17' @@ -19,7 +19,7 @@ test = 'src' via_ir = true [profile.fast_compilation] -optimizer_runs = 150 +optimizer_runs = 50 solc_version = '0.8.17' [rpc_endpoints] From 9a6b85c95697a9b9b80bc993363ea29d86b0d12e Mon Sep 17 00:00:00 2001 From: Rohan Kulkarni Date: Wed, 27 Sep 2023 16:17:28 -0400 Subject: [PATCH 3/8] refactor: remove mint fee amount deploy param --- script/Deploy.s.sol | 1 - script/TestCreateDeterministic.sol | 3 +-- script/Upgrade.s.sol | 5 ++--- script/ZoraDeployerBase.sol | 1 - src/deployment/DeploymentConfig.sol | 4 ---- src/nft/ZoraCreator1155Impl.sol | 1 - test/factory/ZoraCreator1155Factory.t.sol | 8 +++----- test/factory/ZoraCreator1155Factory_Fork.t.sol | 5 +---- test/fixtures/Zora1155FactoryFixtures.sol | 7 +++---- .../fixed-price/ZoraCreatorFixedPriceSaleStrategy.t.sol | 2 +- test/minters/merkle/ZoraCreatorMerkleMinterStrategy.t.sol | 2 +- test/minters/redeem/ZoraCreatorRedeemMinterFactory.t.sol | 2 +- test/minters/redeem/ZoraCreatorRedeemMinterStrategy.t.sol | 2 +- test/nft/ZoraCreator1155.t.sol | 6 +++--- test/nft/ZoraCreator1155AccessControlGeneralTest.sol | 2 +- test/premint/Zora1155PremintExecutorProxy.t.sol | 2 +- test/premint/ZoraCreator1155PremintExecutor.t.sol | 2 +- test/royalties/CreatorRoyaltiesControl.t.sol | 4 ++-- 18 files changed, 22 insertions(+), 37 deletions(-) diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol index 1cbf10167..ed153813e 100644 --- a/script/Deploy.s.sol +++ b/script/Deploy.s.sol @@ -22,7 +22,6 @@ contract DeployScript is ZoraDeployerBase { Deployment memory deployment; ChainConfig memory chainConfig = getChainConfig(); - console2.log("zoraFeeAmount", chainConfig.mintFeeAmount); console2.log("zoraFeeRecipient", chainConfig.mintFeeRecipient); console2.log("factoryOwner", chainConfig.factoryOwner); console2.log("protocolRewards", chainConfig.protocolRewards); diff --git a/script/TestCreateDeterministic.sol b/script/TestCreateDeterministic.sol index 28ae44a4d..e197822a6 100644 --- a/script/TestCreateDeterministic.sol +++ b/script/TestCreateDeterministic.sol @@ -24,7 +24,6 @@ contract DeployScript is ZoraDeployerBase { function run() public { // ChainConfig memory chainConfig = getChainConfig(); - // console2.log("zoraFeeAmount", chainConfig.mintFeeAmount); // console2.log("zoraFeeRecipient", chainConfig.mintFeeRecipient); // console2.log("factoryOwner", chainConfig.factoryOwner); @@ -43,7 +42,7 @@ contract DeployScript is ZoraDeployerBase { vm.startBroadcast(deployerPrivateKey); - ZoraCreator1155Impl zoraCreator1155Impl = new ZoraCreator1155Impl(0, address(0), address(0), address(new ProtocolRewards())); + ZoraCreator1155Impl zoraCreator1155Impl = new ZoraCreator1155Impl(address(0), address(0), address(new ProtocolRewards())); // get above constructor args encoded for verification later: ZoraCreator1155FactoryImpl factory = new ZoraCreator1155FactoryImpl( zoraCreator1155Impl, diff --git a/script/Upgrade.s.sol b/script/Upgrade.s.sol index a2e7328d6..8cbdaf776 100644 --- a/script/Upgrade.s.sol +++ b/script/Upgrade.s.sol @@ -53,10 +53,9 @@ contract UpgradeScript is ZoraDeployerBase { bool isNewNFTImpl = deployment.contract1155Impl == address(0); if (isNewNFTImpl) { - console2.log("mintFeeAmount", chainConfig.mintFeeAmount); - console2.log("minFeeRecipient", chainConfig.mintFeeRecipient); + console2.log("mintFeeRecipient", chainConfig.mintFeeRecipient); console2.log("protocolRewards", chainConfig.protocolRewards); - deployment.contract1155Impl = address(new ZoraCreator1155Impl(chainConfig.mintFeeAmount, chainConfig.mintFeeRecipient, deployment.factoryProxy, chainConfig.protocolRewards)); + deployment.contract1155Impl = address(new ZoraCreator1155Impl(chainConfig.mintFeeRecipient, deployment.factoryProxy, chainConfig.protocolRewards)); console2.log("New NFT_IMPL", deployment.contract1155Impl); } else { console2.log("Existing NFT_IMPL", deployment.contract1155Impl); diff --git a/script/ZoraDeployerBase.sol b/script/ZoraDeployerBase.sol index 99d527f8c..c5809b60a 100644 --- a/script/ZoraDeployerBase.sol +++ b/script/ZoraDeployerBase.sol @@ -42,7 +42,6 @@ abstract contract ZoraDeployerBase is ScriptDeploymentConfig { ChainConfig memory chainConfig = getChainConfig(); ZoraCreator1155Impl creatorImpl = new ZoraCreator1155Impl( - chainConfig.mintFeeAmount, chainConfig.mintFeeRecipient, address(factoryProxy), chainConfig.protocolRewards diff --git a/src/deployment/DeploymentConfig.sol b/src/deployment/DeploymentConfig.sol index 2e9dfb82c..746b85fa3 100644 --- a/src/deployment/DeploymentConfig.sol +++ b/src/deployment/DeploymentConfig.sol @@ -10,8 +10,6 @@ import {Script} from "forge-std/Script.sol"; struct ChainConfig { /// @notice The user that owns the factory proxy. Allows ability to upgrade for new implementations deployed. address factoryOwner; - /// @notice Mint fee amount in WEI charged for each mint - uint256 mintFeeAmount; /// @notice Mint fee recipient user address mintFeeRecipient; /// @notice Protocol rewards contract address @@ -50,7 +48,6 @@ abstract contract DeploymentConfig is Script { /// string constant FACTORY_OWNER = "FACTORY_OWNER"; - string constant MINT_FEE_AMOUNT = "MINT_FEE_AMOUNT"; string constant MINT_FEE_RECIPIENT = "MINT_FEE_RECIPIENT"; string constant PROTOCOL_REWARDS = "PROTOCOL_REWARDS"; @@ -75,7 +72,6 @@ abstract contract DeploymentConfig is Script { function getChainConfig() internal view returns (ChainConfig memory chainConfig) { string memory json = vm.readFile(string.concat("chainConfigs/", Strings.toString(chainId()), ".json")); chainConfig.factoryOwner = json.readAddress(getKeyPrefix(FACTORY_OWNER)); - chainConfig.mintFeeAmount = json.readUint(getKeyPrefix(MINT_FEE_AMOUNT)); chainConfig.mintFeeRecipient = json.readAddress(getKeyPrefix(MINT_FEE_RECIPIENT)); chainConfig.protocolRewards = json.readAddress(getKeyPrefix(PROTOCOL_REWARDS)); } diff --git a/src/nft/ZoraCreator1155Impl.sol b/src/nft/ZoraCreator1155Impl.sol index 1a683153f..c0e2ba2e6 100644 --- a/src/nft/ZoraCreator1155Impl.sol +++ b/src/nft/ZoraCreator1155Impl.sol @@ -70,7 +70,6 @@ contract ZoraCreator1155Impl is IUpgradeGate internal immutable upgradeGate; constructor( - uint256, // TODO remove address _mintFeeRecipient, address _upgradeGate, address _protocolRewards diff --git a/test/factory/ZoraCreator1155Factory.t.sol b/test/factory/ZoraCreator1155Factory.t.sol index 91ff31ebf..bc80526f0 100644 --- a/test/factory/ZoraCreator1155Factory.t.sol +++ b/test/factory/ZoraCreator1155Factory.t.sol @@ -34,7 +34,7 @@ contract ZoraCreator1155FactoryTest is Test { Zora1155Factory factoryProxy = new Zora1155Factory(factoryShimAddress, ""); ProtocolRewards protocolRewards = new ProtocolRewards(); - ZoraCreator1155Impl zoraCreator1155Impl = new ZoraCreator1155Impl(mintFeeAmount, zora, address(upgradeGate), address(protocolRewards)); + ZoraCreator1155Impl zoraCreator1155Impl = new ZoraCreator1155Impl(zora, address(upgradeGate), address(protocolRewards)); factoryImpl = new ZoraCreator1155FactoryImpl(zoraCreator1155Impl, IMinter1155(address(1)), IMinter1155(address(2)), IMinter1155(address(3))); factory = ZoraCreator1155FactoryImpl(address(factoryProxy)); @@ -198,8 +198,7 @@ contract ZoraCreator1155FactoryTest is Test { // * create a new version of the erc1155 implementation // * create a new factory that points to that new erc1155 implementation, // * upgrade the proxy to point to the new factory - uint256 newMintFeeAmount = 0.000888 ether; - IZoraCreator1155 newZoraCreator = new ZoraCreator1155Impl(newMintFeeAmount, zora, address(factory), address(new ProtocolRewards())); + IZoraCreator1155 newZoraCreator = new ZoraCreator1155Impl(zora, address(factory), address(new ProtocolRewards())); ZoraCreator1155FactoryImpl newFactoryImpl = new ZoraCreator1155FactoryImpl( newZoraCreator, @@ -250,8 +249,7 @@ contract ZoraCreator1155FactoryTest is Test { ZoraCreator1155Impl creatorProxy = ZoraCreator1155Impl(createdAddress); // 2. upgrade the created contract by creating a new contract and upgrading the existing one to point to it. - uint256 newMintFeeAmount = 0.000888 ether; - IZoraCreator1155 newZoraCreator = new ZoraCreator1155Impl(newMintFeeAmount, zora, address(0), address(new ProtocolRewards())); + IZoraCreator1155 newZoraCreator = new ZoraCreator1155Impl(zora, address(0), address(new ProtocolRewards())); address[] memory baseImpls = new address[](1); baseImpls[0] = address(factory.zora1155Impl()); diff --git a/test/factory/ZoraCreator1155Factory_Fork.t.sol b/test/factory/ZoraCreator1155Factory_Fork.t.sol index 82a083834..210b3ceec 100644 --- a/test/factory/ZoraCreator1155Factory_Fork.t.sol +++ b/test/factory/ZoraCreator1155Factory_Fork.t.sol @@ -70,9 +70,6 @@ contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test { // create the contract, with no toekns bytes[] memory initSetup = new bytes[](0); - uint32 royaltyMintSchedule = 10; - uint32 royaltyBPS = 100; - address admin = creator; string memory contractURI = "ipfs://asdfasdf"; string memory name = "Test"; @@ -122,7 +119,7 @@ contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test { uint256 tokenId = _setupToken(target, fixedPrice, tokenPrice); // ** 3. Mint on that contract ** - uint256 mintFee = getChainConfig().mintFeeAmount; + uint256 mintFee = block.chainid == 5 ? 10000 : 777000000000000; // mint 3 tokens uint256 valueToSend = quantityToMint * (tokenPrice + mintFee); diff --git a/test/fixtures/Zora1155FactoryFixtures.sol b/test/fixtures/Zora1155FactoryFixtures.sol index 83fbf19d9..d6ccfae24 100644 --- a/test/fixtures/Zora1155FactoryFixtures.sol +++ b/test/fixtures/Zora1155FactoryFixtures.sol @@ -12,9 +12,9 @@ import {ProtocolRewards} from "@zoralabs/protocol-rewards/src/ProtocolRewards.so import {ProxyShim} from "../../src/utils/ProxyShim.sol"; library Zora1155FactoryFixtures { - function setupZora1155Impl(uint256 mintFeeAmount, address zora, Zora1155Factory factoryProxy) internal returns (ZoraCreator1155Impl) { + function setupZora1155Impl(address zora, Zora1155Factory factoryProxy) internal returns (ZoraCreator1155Impl) { ProtocolRewards rewards = new ProtocolRewards(); - return new ZoraCreator1155Impl(mintFeeAmount, zora, address(factoryProxy), address(rewards)); + return new ZoraCreator1155Impl(zora, address(factoryProxy), address(rewards)); } function upgradeFactoryProxyToUse1155( @@ -37,13 +37,12 @@ library Zora1155FactoryFixtures { } function setup1155AndFactoryProxy( - uint256 mintFeeAmount, address zora, address deployer ) internal returns (ZoraCreator1155Impl zoraCreator1155Impl, IMinter1155 fixedPriceMinter, Zora1155Factory factoryProxy) { factoryProxy = setupFactoryProxy(deployer); fixedPriceMinter = new ZoraCreatorFixedPriceSaleStrategy(); - zoraCreator1155Impl = setupZora1155Impl(mintFeeAmount, zora, factoryProxy); + zoraCreator1155Impl = setupZora1155Impl(zora, factoryProxy); upgradeFactoryProxyToUse1155(factoryProxy, zoraCreator1155Impl, fixedPriceMinter, deployer); } } diff --git a/test/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.t.sol b/test/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.t.sol index c9b2eae77..58a677a2b 100644 --- a/test/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.t.sol +++ b/test/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.t.sol @@ -30,7 +30,7 @@ contract ZoraCreatorFixedPriceSaleStrategyTest is Test { bytes[] memory emptyData = new bytes[](0); ProtocolRewards protocolRewards = new ProtocolRewards(); - ZoraCreator1155Impl targetImpl = new ZoraCreator1155Impl(0, zora, address(0), address(protocolRewards)); + ZoraCreator1155Impl targetImpl = new ZoraCreator1155Impl(zora, address(0), address(protocolRewards)); Zora1155 proxy = new Zora1155(address(targetImpl)); target = ZoraCreator1155Impl(address(proxy)); target.initialize("test", "test", ICreatorRoyaltiesControl.RoyaltyConfiguration(0, 0, address(0)), admin, emptyData); diff --git a/test/minters/merkle/ZoraCreatorMerkleMinterStrategy.t.sol b/test/minters/merkle/ZoraCreatorMerkleMinterStrategy.t.sol index 972553200..6de51e0b5 100644 --- a/test/minters/merkle/ZoraCreatorMerkleMinterStrategy.t.sol +++ b/test/minters/merkle/ZoraCreatorMerkleMinterStrategy.t.sol @@ -27,7 +27,7 @@ contract ZoraCreatorMerkleMinterStrategyTest is Test { mintTo = address(1); bytes[] memory emptyData = new bytes[](0); protocolRewards = new ProtocolRewards(); - ZoraCreator1155Impl targetImpl = new ZoraCreator1155Impl(0, zora, address(0), address(protocolRewards)); + ZoraCreator1155Impl targetImpl = new ZoraCreator1155Impl(zora, address(0), address(protocolRewards)); Zora1155 proxy = new Zora1155(address(targetImpl)); target = ZoraCreator1155Impl(address(proxy)); target.initialize("test", "test", ICreatorRoyaltiesControl.RoyaltyConfiguration(0, 0, address(0)), admin, emptyData); diff --git a/test/minters/redeem/ZoraCreatorRedeemMinterFactory.t.sol b/test/minters/redeem/ZoraCreatorRedeemMinterFactory.t.sol index 738feab88..42ed96d21 100644 --- a/test/minters/redeem/ZoraCreatorRedeemMinterFactory.t.sol +++ b/test/minters/redeem/ZoraCreatorRedeemMinterFactory.t.sol @@ -31,7 +31,7 @@ contract ZoraCreatorRedeemMinterFactoryTest is Test { zora = makeAddr("zora"); bytes[] memory emptyData = new bytes[](0); protocolRewards = new ProtocolRewards(); - ZoraCreator1155Impl targetImpl = new ZoraCreator1155Impl(0, zora, address(0), address(protocolRewards)); + ZoraCreator1155Impl targetImpl = new ZoraCreator1155Impl(zora, address(0), address(protocolRewards)); Zora1155 proxy = new Zora1155(address(targetImpl)); target = ZoraCreator1155Impl(address(proxy)); target.initialize("test", "test", ICreatorRoyaltiesControl.RoyaltyConfiguration(0, 0, address(0)), tokenAdmin, emptyData); diff --git a/test/minters/redeem/ZoraCreatorRedeemMinterStrategy.t.sol b/test/minters/redeem/ZoraCreatorRedeemMinterStrategy.t.sol index e2b95c56f..b94a5157c 100644 --- a/test/minters/redeem/ZoraCreatorRedeemMinterStrategy.t.sol +++ b/test/minters/redeem/ZoraCreatorRedeemMinterStrategy.t.sol @@ -31,7 +31,7 @@ contract ZoraCreatorRedeemMinterStrategyTest is Test { zora = makeAddr("zora"); bytes[] memory emptyData = new bytes[](0); protocolRewards = new ProtocolRewards(); - ZoraCreator1155Impl targetImpl = new ZoraCreator1155Impl(0, zora, address(0), address(protocolRewards)); + ZoraCreator1155Impl targetImpl = new ZoraCreator1155Impl(zora, address(0), address(protocolRewards)); Zora1155 proxy = new Zora1155(address(targetImpl)); target = ZoraCreator1155Impl(address(proxy)); target.initialize("test", "test", ICreatorRoyaltiesControl.RoyaltyConfiguration(0, 0, address(0)), admin, emptyData); diff --git a/test/nft/ZoraCreator1155.t.sol b/test/nft/ZoraCreator1155.t.sol index 5947e06d4..4bdf5ea45 100644 --- a/test/nft/ZoraCreator1155.t.sol +++ b/test/nft/ZoraCreator1155.t.sol @@ -87,7 +87,7 @@ contract ZoraCreator1155Test is Test { protocolRewards = new ProtocolRewards(); upgradeGate = new UpgradeGate(admin); - zoraCreator1155Impl = new ZoraCreator1155Impl(0, zora, address(upgradeGate), address(protocolRewards)); + zoraCreator1155Impl = new ZoraCreator1155Impl(zora, address(upgradeGate), address(protocolRewards)); target = ZoraCreator1155Impl(address(new Zora1155(address(zoraCreator1155Impl)))); simpleMinter = new SimpleMinter(); fixedPriceMinter = new ZoraCreatorFixedPriceSaleStrategy(); @@ -1367,7 +1367,7 @@ contract ZoraCreator1155Test is Test { } function test_unauthorizedUpgradeFails() external { - address new1155Impl = address(new ZoraCreator1155Impl(0, zora, address(0), address(protocolRewards))); + address new1155Impl = address(new ZoraCreator1155Impl(zora, address(0), address(protocolRewards))); vm.expectRevert(); target.upgradeTo(new1155Impl); @@ -1379,7 +1379,7 @@ contract ZoraCreator1155Test is Test { oldImpls[0] = address(zoraCreator1155Impl); - address new1155Impl = address(new ZoraCreator1155Impl(0, zora, address(0), address(protocolRewards))); + address new1155Impl = address(new ZoraCreator1155Impl(zora, address(0), address(protocolRewards))); vm.prank(upgradeGate.owner()); upgradeGate.registerUpgradePath(oldImpls, new1155Impl); diff --git a/test/nft/ZoraCreator1155AccessControlGeneralTest.sol b/test/nft/ZoraCreator1155AccessControlGeneralTest.sol index 72f70c1e4..14d9a59f9 100644 --- a/test/nft/ZoraCreator1155AccessControlGeneralTest.sol +++ b/test/nft/ZoraCreator1155AccessControlGeneralTest.sol @@ -25,7 +25,7 @@ contract ZoraCreator1155AccessControlGeneralTest is Test { function setUp() external { zora = makeAddr("zora"); protocolRewards = new ProtocolRewards(); - zoraCreator1155Impl = new ZoraCreator1155Impl(0, zora, address(0), address(protocolRewards)); + zoraCreator1155Impl = new ZoraCreator1155Impl(zora, address(0), address(protocolRewards)); target = ZoraCreator1155Impl(address(new Zora1155(address(zoraCreator1155Impl)))); admin = payable(address(0x9)); target.initialize("", "test", ICreatorRoyaltiesControl.RoyaltyConfiguration(0, 0, address(0)), admin, _emptyInitData()); diff --git a/test/premint/Zora1155PremintExecutorProxy.t.sol b/test/premint/Zora1155PremintExecutorProxy.t.sol index 107238020..02ac578a7 100644 --- a/test/premint/Zora1155PremintExecutorProxy.t.sol +++ b/test/premint/Zora1155PremintExecutorProxy.t.sol @@ -33,7 +33,7 @@ contract Zora1155PremintExecutorProxyTest is Test, IHasContractName { (creator, creatorPrivateKey) = makeAddrAndKey("creator"); vm.startPrank(zora); - (, , factoryProxy) = Zora1155FactoryFixtures.setup1155AndFactoryProxy(mintFeeAmount, zora, zora); + (, , factoryProxy) = Zora1155FactoryFixtures.setup1155AndFactoryProxy(zora, zora); factoryAtProxy = ZoraCreator1155FactoryImpl(address(factoryProxy)); vm.stopPrank(); diff --git a/test/premint/ZoraCreator1155PremintExecutor.t.sol b/test/premint/ZoraCreator1155PremintExecutor.t.sol index 5ace65879..17b05336f 100644 --- a/test/premint/ZoraCreator1155PremintExecutor.t.sol +++ b/test/premint/ZoraCreator1155PremintExecutor.t.sol @@ -55,7 +55,7 @@ contract ZoraCreator1155PreminterTest is ForkDeploymentConfig, Test { collector = makeAddr("collector"); vm.startPrank(zora); - (, , factoryProxy) = Zora1155FactoryFixtures.setup1155AndFactoryProxy(mintFeeAmount, zora, zora); + (, , factoryProxy) = Zora1155FactoryFixtures.setup1155AndFactoryProxy(zora, zora); vm.stopPrank(); factoryImpl = ZoraCreator1155FactoryImpl(address(factoryProxy)); diff --git a/test/royalties/CreatorRoyaltiesControl.t.sol b/test/royalties/CreatorRoyaltiesControl.t.sol index f8bcda849..162a7afaa 100644 --- a/test/royalties/CreatorRoyaltiesControl.t.sol +++ b/test/royalties/CreatorRoyaltiesControl.t.sol @@ -48,7 +48,7 @@ contract CreatorRoyaltiesControlTest is Test { function test_GetsRoyaltiesInfoGlobalDefault() external { address royaltyPayout = address(0x999); - zoraCreator1155Impl = new ZoraCreator1155Impl(0, recipient, address(0), address(protocolRewards)); + zoraCreator1155Impl = new ZoraCreator1155Impl(recipient, address(0), address(protocolRewards)); target = ZoraCreator1155Impl(address(new Zora1155(address(zoraCreator1155Impl)))); adminRole = target.PERMISSION_BIT_ADMIN(); target.initialize("", "test", ICreatorRoyaltiesControl.RoyaltyConfiguration(10, 10, address(royaltyPayout)), admin, _emptyInitData()); @@ -65,7 +65,7 @@ contract CreatorRoyaltiesControlTest is Test { function test_GetsRoyaltiesInfoSpecificToken() external { address royaltyPayout = address(0x999); - zoraCreator1155Impl = new ZoraCreator1155Impl(0, recipient, address(0), address(protocolRewards)); + zoraCreator1155Impl = new ZoraCreator1155Impl(recipient, address(0), address(protocolRewards)); target = ZoraCreator1155Impl(address(new Zora1155(address(zoraCreator1155Impl)))); adminRole = target.PERMISSION_BIT_ADMIN(); target.initialize("", "test", ICreatorRoyaltiesControl.RoyaltyConfiguration(100, 10, address(royaltyPayout)), admin, _emptyInitData()); From aa824fa877b898e23b26d40dfa980e885efcd827 Mon Sep 17 00:00:00 2001 From: Rohan Kulkarni Date: Wed, 27 Sep 2023 16:20:31 -0400 Subject: [PATCH 4/8] chore: run lint --- src/nft/ZoraCreator1155Impl.sol | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/nft/ZoraCreator1155Impl.sol b/src/nft/ZoraCreator1155Impl.sol index c0e2ba2e6..a751780af 100644 --- a/src/nft/ZoraCreator1155Impl.sol +++ b/src/nft/ZoraCreator1155Impl.sol @@ -69,11 +69,7 @@ contract ZoraCreator1155Impl is /// @notice Factory contract IUpgradeGate internal immutable upgradeGate; - constructor( - address _mintFeeRecipient, - address _upgradeGate, - address _protocolRewards - ) ERC1155Rewards(_protocolRewards, _mintFeeRecipient) initializer { + constructor(address _mintFeeRecipient, address _upgradeGate, address _protocolRewards) ERC1155Rewards(_protocolRewards, _mintFeeRecipient) initializer { upgradeGate = IUpgradeGate(_upgradeGate); } @@ -383,7 +379,7 @@ contract ZoraCreator1155Impl is } // Mint the specified tokens - _mint(recipient, tokenId, quantity, data); + _mint(recipient, tokenId, quantity, data); } /// @notice Batch mint tokens to a user as the admin or minter From d700ff480d61038f965f3a202bf68ba6c5333620 Mon Sep 17 00:00:00 2001 From: Rohan Kulkarni Date: Wed, 27 Sep 2023 16:20:56 -0400 Subject: [PATCH 5/8] chore: run lint --- src/nft/ZoraCreator1155Impl.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nft/ZoraCreator1155Impl.sol b/src/nft/ZoraCreator1155Impl.sol index 1a683153f..2a5f3ddf4 100644 --- a/src/nft/ZoraCreator1155Impl.sol +++ b/src/nft/ZoraCreator1155Impl.sol @@ -384,7 +384,7 @@ contract ZoraCreator1155Impl is } // Mint the specified tokens - _mint(recipient, tokenId, quantity, data); + _mint(recipient, tokenId, quantity, data); } /// @notice Batch mint tokens to a user as the admin or minter From 704070a69edbd47f0e0a7ed1be768efbcaa53166 Mon Sep 17 00:00:00 2001 From: Rohan Kulkarni Date: Wed, 27 Sep 2023 17:02:29 -0400 Subject: [PATCH 6/8] chore: remove mint fee amount from chain configs --- chainConfigs/1.json | 1 - chainConfigs/10.json | 1 - chainConfigs/11155111.json | 1 - chainConfigs/420.json | 1 - chainConfigs/424.json | 10 ++++------ chainConfigs/5.json | 1 - chainConfigs/58008.json | 1 - chainConfigs/7777777.json | 10 ++++------ chainConfigs/8453.json | 1 - chainConfigs/84531.json | 1 - chainConfigs/999.json | 1 - 11 files changed, 8 insertions(+), 21 deletions(-) diff --git a/chainConfigs/1.json b/chainConfigs/1.json index 3787dde27..19c70df06 100644 --- a/chainConfigs/1.json +++ b/chainConfigs/1.json @@ -1,6 +1,5 @@ { "FACTORY_OWNER": "0xDB392f4391462d60B8B4413ef72018Ab595Af9D0", - "MINT_FEE_AMOUNT": 777000000000000, "MINT_FEE_RECIPIENT": "0xd1d1D4e36117aB794ec5d4c78cBD3a8904E691D0", "PROTOCOL_REWARDS": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B" } diff --git a/chainConfigs/10.json b/chainConfigs/10.json index 4befb90ad..7e84531d8 100644 --- a/chainConfigs/10.json +++ b/chainConfigs/10.json @@ -1,6 +1,5 @@ { "FACTORY_OWNER": "0x4c7f7b6067fac9a737ecf2ca1a733fc85dd65a2b", - "MINT_FEE_AMOUNT": 777000000000000, "MINT_FEE_RECIPIENT": "0x7A810DCd0f8d83B20212326813Db6EF7E9FD030c", "PROTOCOL_REWARDS": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B" } diff --git a/chainConfigs/11155111.json b/chainConfigs/11155111.json index 7a1fae4c3..7641360a4 100644 --- a/chainConfigs/11155111.json +++ b/chainConfigs/11155111.json @@ -1,5 +1,4 @@ { "FACTORY_OWNER": "0xE51051a204afb2fC071A2406914cdEA5638e5018", - "MINT_FEE_AMOUNT": 111000000000000, "MINT_FEE_RECIPIENT": "0xE51051a204afb2fC071A2406914cdEA5638e5018" } diff --git a/chainConfigs/420.json b/chainConfigs/420.json index e3cff4e7e..3e9f03e55 100644 --- a/chainConfigs/420.json +++ b/chainConfigs/420.json @@ -1,6 +1,5 @@ { "FACTORY_OWNER": "0xbb45052B2260707655Dfd916a416264f5981192c", - "MINT_FEE_AMOUNT": 777000000000000, "MINT_FEE_RECIPIENT": "0x5dEe21327CD7CD6725C2578DA1c3E5bb2D2D34b2", "PROTOCOL_REWARDS": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B" } diff --git a/chainConfigs/424.json b/chainConfigs/424.json index 1f5f921ba..be44a25b3 100644 --- a/chainConfigs/424.json +++ b/chainConfigs/424.json @@ -1,7 +1,5 @@ { - "FACTORY_OWNER": "0x8fbC66d36cceB3Ad69B4d672756da54CcFec1cD2", - "MINT_FEE_AMOUNT": 777000000000000, - "MINT_FEE_RECIPIENT": "0x95FD5d77B206cCc0B1f7D7A4077fbE8eb4fC31eF", - "PROTOCOL_REWARDS": "0x7777777A456fF23D9b6851184472c08FBDa73e32" - } - \ No newline at end of file + "FACTORY_OWNER": "0x8fbC66d36cceB3Ad69B4d672756da54CcFec1cD2", + "MINT_FEE_RECIPIENT": "0x95FD5d77B206cCc0B1f7D7A4077fbE8eb4fC31eF", + "PROTOCOL_REWARDS": "0x7777777A456fF23D9b6851184472c08FBDa73e32" +} diff --git a/chainConfigs/5.json b/chainConfigs/5.json index d59951055..fcb2cc815 100644 --- a/chainConfigs/5.json +++ b/chainConfigs/5.json @@ -1,6 +1,5 @@ { "FACTORY_OWNER": "0xDC498668B5e6CC518fD58A2ADBF614Fd3A13D3a0", - "MINT_FEE_AMOUNT": 10000, "MINT_FEE_RECIPIENT": "0x9444390c01Dd5b7249E53FAc31290F7dFF53450D", "PROTOCOL_REWARDS": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B" } diff --git a/chainConfigs/58008.json b/chainConfigs/58008.json index 948db1f24..4914ebc19 100644 --- a/chainConfigs/58008.json +++ b/chainConfigs/58008.json @@ -1,5 +1,4 @@ { "FACTORY_OWNER": "0xfAe426B462f4Bc9857ED28D8473Fb85192f23E9b", - "MINT_FEE_AMOUNT": 777000000000000, "MINT_FEE_RECIPIENT": "0x917D86f1eBD1d9f59Dae1C00e5Af7f8689299EC4" } diff --git a/chainConfigs/7777777.json b/chainConfigs/7777777.json index 189616809..2923bf324 100644 --- a/chainConfigs/7777777.json +++ b/chainConfigs/7777777.json @@ -1,7 +1,5 @@ { - "FACTORY_OWNER": "0xdEA20c96253dc2d64897D2b8d27A8d935dE74955", - "MINT_FEE_AMOUNT": 777000000000000, - "MINT_FEE_RECIPIENT": "0xEcfc2ee50409E459c554a2b0376F882Ce916D853", - "PROTOCOL_REWARDS": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B" - } - \ No newline at end of file + "FACTORY_OWNER": "0xdEA20c96253dc2d64897D2b8d27A8d935dE74955", + "MINT_FEE_RECIPIENT": "0xEcfc2ee50409E459c554a2b0376F882Ce916D853", + "PROTOCOL_REWARDS": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B" +} diff --git a/chainConfigs/8453.json b/chainConfigs/8453.json index c30525d3b..8ad8edc6f 100644 --- a/chainConfigs/8453.json +++ b/chainConfigs/8453.json @@ -1,6 +1,5 @@ { "FACTORY_OWNER": "0x004d6611884B4A661749B64b2ADc78505c3e1AB3", - "MINT_FEE_AMOUNT": 777000000000000, "MINT_FEE_RECIPIENT": "0x7bf90111Ad7C22bec9E9dFf8A01A44713CC1b1B6", "PROTOCOL_REWARDS": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B" } diff --git a/chainConfigs/84531.json b/chainConfigs/84531.json index 7100f5028..2dbb7aa54 100644 --- a/chainConfigs/84531.json +++ b/chainConfigs/84531.json @@ -1,6 +1,5 @@ { "FACTORY_OWNER": "0x02539E813cA450C2c7334e885423f4A899a063Fe", - "MINT_FEE_AMOUNT": 777000000000000, "MINT_FEE_RECIPIENT": "0x02539E813cA450C2c7334e885423f4A899a063Fe", "PROTOCOL_REWARDS": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B" } diff --git a/chainConfigs/999.json b/chainConfigs/999.json index 6324fee71..086eb0fae 100644 --- a/chainConfigs/999.json +++ b/chainConfigs/999.json @@ -1,6 +1,5 @@ { "FACTORY_OWNER": "0xE84DBB2B25F761751231a9D0DAfbdD4dC3aa8252", - "MINT_FEE_AMOUNT": 777000000000000, "MINT_FEE_RECIPIENT": "0xE84DBB2B25F761751231a9D0DAfbdD4dC3aa8252", "PROTOCOL_REWARDS": "0x7777777F279eba3d3Ad8F4E708545291A6fDBA8B" } From ec07204b218eb72cd0d41810d09a0fafc16f6dd4 Mon Sep 17 00:00:00 2001 From: Rohan Kulkarni Date: Wed, 27 Sep 2023 17:05:55 -0400 Subject: [PATCH 7/8] chore: update fork test --- test/factory/ZoraCreator1155Factory_Fork.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/factory/ZoraCreator1155Factory_Fork.t.sol b/test/factory/ZoraCreator1155Factory_Fork.t.sol index 210b3ceec..f47711ec3 100644 --- a/test/factory/ZoraCreator1155Factory_Fork.t.sol +++ b/test/factory/ZoraCreator1155Factory_Fork.t.sol @@ -119,7 +119,7 @@ contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test { uint256 tokenId = _setupToken(target, fixedPrice, tokenPrice); // ** 3. Mint on that contract ** - uint256 mintFee = block.chainid == 5 ? 10000 : 777000000000000; + uint256 mintFee = target.mintFee(); // mint 3 tokens uint256 valueToSend = quantityToMint * (tokenPrice + mintFee); From 7415a4d56aa0efde08ca9bfd6c947d350cf00a76 Mon Sep 17 00:00:00 2001 From: Rohan Kulkarni Date: Wed, 27 Sep 2023 17:26:45 -0400 Subject: [PATCH 8/8] fix: use mint w rewards to gurantee mint fee amount --- test/factory/ZoraCreator1155Factory_Fork.t.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/factory/ZoraCreator1155Factory_Fork.t.sol b/test/factory/ZoraCreator1155Factory_Fork.t.sol index f47711ec3..f8fc0d349 100644 --- a/test/factory/ZoraCreator1155Factory_Fork.t.sol +++ b/test/factory/ZoraCreator1155Factory_Fork.t.sol @@ -20,6 +20,7 @@ contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test { uint256 constant tokenMaxSupply = 100; uint32 constant royaltyMintSchedule = 10; uint32 constant royaltyBPS = 100; + uint256 constant mintFee = 0.000777 ether; address collector; address creator; @@ -119,7 +120,6 @@ contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test { uint256 tokenId = _setupToken(target, fixedPrice, tokenPrice); // ** 3. Mint on that contract ** - uint256 mintFee = target.mintFee(); // mint 3 tokens uint256 valueToSend = quantityToMint * (tokenPrice + mintFee); @@ -127,7 +127,7 @@ contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test { // mint the token vm.deal(collector, valueToSend); vm.startPrank(collector); - target.mint{value: valueToSend}(fixedPrice, tokenId, quantityToMint, abi.encode(collector)); + ZoraCreator1155Impl(address(target)).mintWithRewards{value: valueToSend}(fixedPrice, tokenId, quantityToMint, abi.encode(collector), address(0)); assertEq(target.balanceOf(collector, tokenId), quantityToMint, chainName); }