diff --git a/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol b/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol index 78d865158..1888e4785 100644 --- a/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol +++ b/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol @@ -34,9 +34,10 @@ abstract contract CreatorRoyaltiesControl is CreatorRoyaltiesStorageV1, SharedBa } function _updateRoyalties(uint256 tokenId, RoyaltyConfiguration memory configuration) internal { - // Deprecate supply royalty support + // If a nonzero royalty mint schedule is set: if (configuration.royaltyMintSchedule != 0) { - revert InvalidMintSchedule(); + // Set the value to zero + configuration.royaltyMintSchedule = 0; } // Don't allow setting royalties to burn address if (configuration.royaltyRecipient == address(0) && configuration.royaltyBPS > 0) { diff --git a/packages/1155-contracts/test/nft/ZoraCreator1155.t.sol b/packages/1155-contracts/test/nft/ZoraCreator1155.t.sol index 8885f7a26..a19a92b17 100644 --- a/packages/1155-contracts/test/nft/ZoraCreator1155.t.sol +++ b/packages/1155-contracts/test/nft/ZoraCreator1155.t.sol @@ -572,10 +572,16 @@ contract ZoraCreator1155Test is Test { assertEq(target.balanceOf(recipient, tokenId2), quantity2); } - function test_adminMintWithInvalidScheduleSkipsSchedule() external { - // This configuration is invalid - vm.expectRevert(); - target.initialize("", "test", ICreatorRoyaltiesControl.RoyaltyConfiguration(10, 0, address(0)), admin, _emptyInitData()); + function test_adminMintWithInvalidScheduleSkipsSchedule(uint32 supplyRoyaltySchedule) external { + vm.assume(supplyRoyaltySchedule != 0); + + address supplyRoyaltyRecipient = makeAddr("supplyRoyaltyRecipient"); + + target.initialize("", "test", ICreatorRoyaltiesControl.RoyaltyConfiguration(supplyRoyaltySchedule, 0, supplyRoyaltyRecipient), admin, _emptyInitData()); + + ICreatorRoyaltiesControl.RoyaltyConfiguration memory storedConfig = target.getRoyalties(0); + + assertEq(storedConfig.royaltyMintSchedule, 0); } function test_adminMintWithEmptyScheduleSkipsSchedule() external { diff --git a/packages/protocol-deployments/test/ZoraCreator1155SupplyRoyaltyDeprecation.t.sol b/packages/protocol-deployments/test/ZoraCreator1155SupplyRoyaltyDeprecation.t.sol new file mode 100644 index 000000000..5f36f765d --- /dev/null +++ b/packages/protocol-deployments/test/ZoraCreator1155SupplyRoyaltyDeprecation.t.sol @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.17; + +import "forge-std/Test.sol"; + +import { + ForkDeploymentConfig, + Deployment, + ChainConfig +} from "@zoralabs/zora-1155-contracts/src/deployment/DeploymentConfig.sol"; +import {ZoraDeployerUtils} from "@zoralabs/zora-1155-contracts/src/deployment/ZoraDeployerUtils.sol"; + +import {Zora1155Factory} from "@zoralabs/zora-1155-contracts/src/proxies/Zora1155Factory.sol"; +import {ZoraCreator1155FactoryImpl} from "@zoralabs/zora-1155-contracts/src/factory/ZoraCreator1155FactoryImpl.sol"; +import {ZoraCreator1155Impl} from "@zoralabs/zora-1155-contracts/src/nft/ZoraCreator1155Impl.sol"; +import {ICreatorRoyaltiesControl} from "@zoralabs/zora-1155-contracts/src/interfaces/ICreatorRoyaltiesControl.sol"; +import {IMinter1155} from "@zoralabs/zora-1155-contracts/src/interfaces/IMinter1155.sol"; + +contract ZoraCreator1155SupplyRoyaltyDeprecationTest is Test, ForkDeploymentConfig { + address internal creator; + string[] internal chains; + + function setUp() public { + creator = makeAddr("creator"); + + chains = new string[](1); + chains[0] = "zora_goerli"; + } + + function testFork_SupplyRoyaltyDeprecation() public { + for (uint256 i; i < chains.length; ++i) { + string memory chain = chains[i]; + + vm.createSelectFork(vm.rpcUrl(chain)); + + Deployment memory deployment = getDeployment(); + ChainConfig memory chainConfig = getChainConfig(); + + ZoraCreator1155FactoryImpl factory = ZoraCreator1155FactoryImpl(deployment.factoryProxy); + + uint32 invalidRoyaltyMintSchedule = 10; + + ICreatorRoyaltiesControl.RoyaltyConfiguration memory royaltyConfig = ICreatorRoyaltiesControl + .RoyaltyConfiguration({ + royaltyBPS: 0, + royaltyRecipient: address(0), + royaltyMintSchedule: invalidRoyaltyMintSchedule + }); + + vm.expectRevert(abi.encodeWithSignature("InvalidMintSchedule()")); + factory.createContract("mock uri", "mock name", royaltyConfig, payable(creator), new bytes[](0)); + + (address newFactoryImpl,,) = ZoraDeployerUtils.deployNew1155AndFactoryImpl({ + upgradeGateAddress: deployment.upgradeGate, + mintFeeRecipient: chainConfig.mintFeeRecipient, + protocolRewards: chainConfig.protocolRewards, + merkleMinter: IMinter1155(deployment.merkleMintSaleStrategy), + redeemMinterFactory: IMinter1155(deployment.redeemMinterFactory), + fixedPriceMinter: IMinter1155(deployment.fixedPriceSaleStrategy) + }); + + ZoraCreator1155FactoryImpl newFactory = + ZoraCreator1155FactoryImpl(address(new Zora1155Factory(newFactoryImpl, ""))); + + address tokenContractAddress = + newFactory.createContract("mock uri", "mock name", royaltyConfig, payable(creator), new bytes[](0)); + + ZoraCreator1155Impl tokenContract = ZoraCreator1155Impl(tokenContractAddress); + + // Ensure the specified royalty mint schedule is ignored + set to zero + assertEq(tokenContract.getRoyalties(0).royaltyMintSchedule, 0); + } + } +}