diff --git a/.changeset/thick-seals-pay.md b/.changeset/thick-seals-pay.md new file mode 100644 index 000000000..3b6d7d63f --- /dev/null +++ b/.changeset/thick-seals-pay.md @@ -0,0 +1,5 @@ +--- +"@zoralabs/zora-1155-contracts": patch +--- + +Revert #313 - include errors in abis. This caused a storage layout issue diff --git a/packages/1155-contracts/src/interfaces/ICreatorRoyaltiesControl.sol b/packages/1155-contracts/src/interfaces/ICreatorRoyaltiesControl.sol index 65c6d9d13..b6a27ce9f 100644 --- a/packages/1155-contracts/src/interfaces/ICreatorRoyaltiesControl.sol +++ b/packages/1155-contracts/src/interfaces/ICreatorRoyaltiesControl.sol @@ -3,11 +3,6 @@ pragma solidity 0.8.17; import {IERC2981} from "@openzeppelin/contracts/interfaces/IERC2981.sol"; -interface ICreatorRoyaltyErrors { - /// @notice Thrown when a user tries to have 100% supply royalties - error InvalidMintSchedule(); -} - interface ICreatorRoyaltiesControl is IERC2981 { /// @notice The RoyaltyConfiguration struct is used to store the royalty configuration for a given token. /// @param royaltyMintSchedule Every nth token will go to the royalty recipient. @@ -19,6 +14,9 @@ interface ICreatorRoyaltiesControl is IERC2981 { address royaltyRecipient; } + /// @notice Thrown when a user tries to have 100% supply royalties + error InvalidMintSchedule(); + /// @notice Event emitted when royalties are updated event UpdatedRoyalties(uint256 indexed tokenId, address indexed user, RoyaltyConfiguration configuration); diff --git a/packages/1155-contracts/src/interfaces/ILimitedMintPerAddress.sol b/packages/1155-contracts/src/interfaces/ILimitedMintPerAddress.sol index 3cd1d17c2..6b8df8344 100644 --- a/packages/1155-contracts/src/interfaces/ILimitedMintPerAddress.sol +++ b/packages/1155-contracts/src/interfaces/ILimitedMintPerAddress.sol @@ -3,10 +3,8 @@ pragma solidity 0.8.17; import {IERC165Upgradeable} from "@zoralabs/openzeppelin-contracts-upgradeable/contracts/interfaces/IERC165Upgradeable.sol"; -interface ILimitedMintPerAddressErrors { +interface ILimitedMintPerAddress is IERC165Upgradeable { error UserExceedsMintLimit(address user, uint256 limit, uint256 requestedAmount); -} -interface ILimitedMintPerAddress is IERC165Upgradeable, ILimitedMintPerAddressErrors { function getMintedPerWallet(address token, uint256 tokenId, address wallet) external view returns (uint256); } diff --git a/packages/1155-contracts/src/interfaces/IMinterErrors.sol b/packages/1155-contracts/src/interfaces/IMinterErrors.sol deleted file mode 100644 index 7ae33cc29..000000000 --- a/packages/1155-contracts/src/interfaces/IMinterErrors.sol +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.17; - -interface IMinterErrors { - error CallerNotZoraCreator1155(); - error MinterContractAlreadyExists(); - error MinterContractDoesNotExist(); - - error SaleEnded(); - error SaleHasNotStarted(); - error WrongValueSent(); - error InvalidMerkleProof(address mintTo, bytes32[] merkleProof, bytes32 merkleRoot); -} diff --git a/packages/1155-contracts/src/interfaces/IZoraCreator1155Errors.sol b/packages/1155-contracts/src/interfaces/IZoraCreator1155Errors.sol index b32a7d445..153cde73c 100644 --- a/packages/1155-contracts/src/interfaces/IZoraCreator1155Errors.sol +++ b/packages/1155-contracts/src/interfaces/IZoraCreator1155Errors.sol @@ -1,11 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.17; -import {ICreatorRoyaltyErrors} from "./ICreatorRoyaltiesControl.sol"; -import {ILimitedMintPerAddressErrors} from "./ILimitedMintPerAddress.sol"; -import {IMinterErrors} from "./IMinterErrors.sol"; - -interface IZoraCreator1155Errors is ICreatorRoyaltyErrors, ILimitedMintPerAddressErrors, IMinterErrors { +interface IZoraCreator1155Errors { error Call_TokenIdMismatch(); error TokenIdMismatch(uint256 expected, uint256 actual); error UserMissingRoleForToken(address user, uint256 tokenId, uint256 role); diff --git a/packages/1155-contracts/src/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.sol b/packages/1155-contracts/src/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.sol index 33042ff43..a2963325a 100644 --- a/packages/1155-contracts/src/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.sol +++ b/packages/1155-contracts/src/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.sol @@ -7,7 +7,6 @@ import {ICreatorCommands} from "../../interfaces/ICreatorCommands.sol"; import {SaleStrategy} from "../SaleStrategy.sol"; import {SaleCommandHelper} from "../utils/SaleCommandHelper.sol"; import {LimitedMintPerAddress} from "../utils/LimitedMintPerAddress.sol"; -import {IMinterErrors} from "../../interfaces/IMinterErrors.sol"; /* @@ -37,7 +36,7 @@ import {IMinterErrors} from "../../interfaces/IMinterErrors.sol"; /// @title ZoraCreatorFixedPriceSaleStrategy /// @notice A sale strategy for ZoraCreator that allows for fixed price sales over a given time period /// @author @iainnash / @tbtstl -contract ZoraCreatorFixedPriceSaleStrategy is Enjoy, SaleStrategy, LimitedMintPerAddress, IMinterErrors { +contract ZoraCreatorFixedPriceSaleStrategy is Enjoy, SaleStrategy, LimitedMintPerAddress { struct SalesConfig { /// @notice Unix timestamp for the sale start uint64 saleStart; @@ -70,6 +69,10 @@ contract ZoraCreatorFixedPriceSaleStrategy is Enjoy, SaleStrategy, LimitedMintPe return "1.1.0"; } + error WrongValueSent(); + error SaleEnded(); + error SaleHasNotStarted(); + event SaleSet(address indexed mediaContract, uint256 indexed tokenId, SalesConfig salesConfig); event MintComment(address indexed sender, address indexed tokenContract, uint256 indexed tokenId, uint256 quantity, string comment); diff --git a/packages/1155-contracts/src/minters/merkle/ZoraCreatorMerkleMinterStrategy.sol b/packages/1155-contracts/src/minters/merkle/ZoraCreatorMerkleMinterStrategy.sol index 0ae1186e4..e313f0883 100644 --- a/packages/1155-contracts/src/minters/merkle/ZoraCreatorMerkleMinterStrategy.sol +++ b/packages/1155-contracts/src/minters/merkle/ZoraCreatorMerkleMinterStrategy.sol @@ -9,7 +9,6 @@ import {SaleStrategy} from "../SaleStrategy.sol"; import {ICreatorCommands} from "../../interfaces/ICreatorCommands.sol"; import {SaleCommandHelper} from "../utils/SaleCommandHelper.sol"; import {LimitedMintPerAddress} from "../utils/LimitedMintPerAddress.sol"; -import {IMinterErrors} from "../../interfaces/IMinterErrors.sol"; /* @@ -39,7 +38,7 @@ import {IMinterErrors} from "../../interfaces/IMinterErrors.sol"; /// @title ZoraCreatorMerkleMinterStrategy /// @notice Mints tokens based on a merkle tree, for presales for example /// @author @iainnash / @tbtstl -contract ZoraCreatorMerkleMinterStrategy is Enjoy, SaleStrategy, LimitedMintPerAddress, IMinterErrors { +contract ZoraCreatorMerkleMinterStrategy is Enjoy, SaleStrategy, LimitedMintPerAddress { using SaleCommandHelper for ICreatorCommands.CommandSet; /// @notice General merkle sale settings @@ -59,6 +58,12 @@ contract ZoraCreatorMerkleMinterStrategy is Enjoy, SaleStrategy, LimitedMintPerA /// @notice Storage for allowed merkle settings for the sales configuration mapping(address => mapping(uint256 => MerkleSaleSettings)) public allowedMerkles; + // target -> tokenId -> settings + + error SaleEnded(); + error SaleHasNotStarted(); + error WrongValueSent(); + error InvalidMerkleProof(address mintTo, bytes32[] merkleProof, bytes32 merkleRoot); /// @notice ContractURI for contract information with the strategy function contractURI() external pure override returns (string memory) { diff --git a/packages/1155-contracts/src/minters/redeem/ZoraCreatorRedeemMinterFactory.sol b/packages/1155-contracts/src/minters/redeem/ZoraCreatorRedeemMinterFactory.sol index e2fba048e..c51c1182b 100644 --- a/packages/1155-contracts/src/minters/redeem/ZoraCreatorRedeemMinterFactory.sol +++ b/packages/1155-contracts/src/minters/redeem/ZoraCreatorRedeemMinterFactory.sol @@ -12,7 +12,6 @@ import {ICreatorCommands} from "../../interfaces/ICreatorCommands.sol"; import {ZoraCreatorRedeemMinterStrategy} from "./ZoraCreatorRedeemMinterStrategy.sol"; import {IZoraCreator1155} from "../../interfaces/IZoraCreator1155.sol"; import {SharedBaseConstants} from "../../shared/SharedBaseConstants.sol"; -import {IMinterErrors} from "../../interfaces/IMinterErrors.sol"; /* @@ -42,12 +41,16 @@ import {IMinterErrors} from "../../interfaces/IMinterErrors.sol"; /// @title ZoraCreatorRedeemMinterFactory /// @notice A factory for ZoraCreatorRedeemMinterStrategy contracts /// @author @jgeary -contract ZoraCreatorRedeemMinterFactory is Enjoy, IContractMetadata, SharedBaseConstants, IVersionedContract, IMinter1155, IMinterErrors { +contract ZoraCreatorRedeemMinterFactory is Enjoy, IContractMetadata, SharedBaseConstants, IVersionedContract, IMinter1155 { bytes4 constant LEGACY_ZORA_IMINTER1155_INTERFACE_ID = 0x6467a6fc; address public immutable zoraRedeemMinterImplementation; event RedeemMinterDeployed(address indexed creatorContract, address indexed minterContract); + error CallerNotZoraCreator1155(); + error MinterContractAlreadyExists(); + error MinterContractDoesNotExist(); + constructor() { zoraRedeemMinterImplementation = address(new ZoraCreatorRedeemMinterStrategy()); } diff --git a/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol b/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol index 1888e4785..7b6dc3079 100644 --- a/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol +++ b/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol @@ -4,14 +4,13 @@ pragma solidity 0.8.17; import {CreatorRoyaltiesStorageV1} from "./CreatorRoyaltiesStorageV1.sol"; import {ICreatorRoyaltiesControl} from "../interfaces/ICreatorRoyaltiesControl.sol"; import {SharedBaseConstants} from "../shared/SharedBaseConstants.sol"; -import {ICreatorRoyaltyErrors} from "../interfaces/ICreatorRoyaltiesControl.sol"; import {IERC2981} from "@openzeppelin/contracts/interfaces/IERC2981.sol"; /// Imagine. Mint. Enjoy. /// @title CreatorRoyaltiesControl /// @author ZORA @iainnash / @tbtstl /// @notice Contract for managing the royalties of an 1155 contract -abstract contract CreatorRoyaltiesControl is CreatorRoyaltiesStorageV1, SharedBaseConstants, ICreatorRoyaltyErrors { +abstract contract CreatorRoyaltiesControl is CreatorRoyaltiesStorageV1, SharedBaseConstants { uint256 immutable ROYALTY_BPS_TO_PERCENT = 10_000; /// @notice The royalty information for a given token. diff --git a/packages/1155-contracts/test/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.t.sol b/packages/1155-contracts/test/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.t.sol index b9047c8c8..58a677a2b 100644 --- a/packages/1155-contracts/test/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.t.sol +++ b/packages/1155-contracts/test/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.t.sol @@ -9,7 +9,7 @@ import {IZoraCreator1155Errors} from "../../../src/interfaces/IZoraCreator1155Er import {IMinter1155} from "../../../src/interfaces/IMinter1155.sol"; import {ICreatorRoyaltiesControl} from "../../../src/interfaces/ICreatorRoyaltiesControl.sol"; import {IZoraCreator1155Factory} from "../../../src/interfaces/IZoraCreator1155Factory.sol"; -import {ILimitedMintPerAddressErrors} from "../../../src/interfaces/ILimitedMintPerAddress.sol"; +import {ILimitedMintPerAddress} from "../../../src/interfaces/ILimitedMintPerAddress.sol"; import {ZoraCreatorFixedPriceSaleStrategy} from "../../../src/minters/fixed-price/ZoraCreatorFixedPriceSaleStrategy.sol"; contract ZoraCreatorFixedPriceSaleStrategyTest is Test { @@ -279,7 +279,7 @@ contract ZoraCreatorFixedPriceSaleStrategyTest is Test { vm.deal(tokenRecipient, totalValue); vm.prank(tokenRecipient); - vm.expectRevert(abi.encodeWithSelector(ILimitedMintPerAddressErrors.UserExceedsMintLimit.selector, tokenRecipient, 5, 6)); + vm.expectRevert(abi.encodeWithSelector(ILimitedMintPerAddress.UserExceedsMintLimit.selector, tokenRecipient, 5, 6)); target.mint{value: totalValue}(fixedPrice, newTokenId, numTokens, abi.encode(tokenRecipient, "")); } diff --git a/packages/1155-contracts/test/minters/merkle/ZoraCreatorMerkleMinterStrategy.t.sol b/packages/1155-contracts/test/minters/merkle/ZoraCreatorMerkleMinterStrategy.t.sol index 24fc6b10c..6de51e0b5 100644 --- a/packages/1155-contracts/test/minters/merkle/ZoraCreatorMerkleMinterStrategy.t.sol +++ b/packages/1155-contracts/test/minters/merkle/ZoraCreatorMerkleMinterStrategy.t.sol @@ -8,7 +8,7 @@ import {Zora1155} from "../../../src/proxies/Zora1155.sol"; import {IZoraCreator1155Errors} from "../../../src/interfaces/IZoraCreator1155Errors.sol"; import {IRenderer1155} from "../../../src/interfaces/IRenderer1155.sol"; import {ICreatorRoyaltiesControl} from "../../../src/interfaces/ICreatorRoyaltiesControl.sol"; -import {ILimitedMintPerAddressErrors} from "../../../src/interfaces/ILimitedMintPerAddress.sol"; +import {ILimitedMintPerAddress} from "../../../src/interfaces/ILimitedMintPerAddress.sol"; import {IZoraCreator1155Factory} from "../../../src/interfaces/IZoraCreator1155Factory.sol"; import {ZoraCreatorMerkleMinterStrategy} from "../../../src/minters/merkle/ZoraCreatorMerkleMinterStrategy.sol"; @@ -290,7 +290,7 @@ contract ZoraCreatorMerkleMinterStrategyTest is Test { vm.deal(mintTo, 1.000777 ether); - vm.expectRevert(abi.encodeWithSelector(ILimitedMintPerAddressErrors.UserExceedsMintLimit.selector, mintTo, 10, 11)); + vm.expectRevert(abi.encodeWithSelector(ILimitedMintPerAddress.UserExceedsMintLimit.selector, mintTo, 10, 11)); target.mint{value: 1.000777 ether}(merkleMinter, newTokenId, 1, abi.encode(mintTo, maxQuantity, pricePerToken, merkleProof)); vm.stopPrank(); diff --git a/packages/1155-contracts/test/premint/ZoraCreator1155PremintExecutor.t.sol b/packages/1155-contracts/test/premint/ZoraCreator1155PremintExecutor.t.sol index f4874a694..d18bdac4f 100644 --- a/packages/1155-contracts/test/premint/ZoraCreator1155PremintExecutor.t.sol +++ b/packages/1155-contracts/test/premint/ZoraCreator1155PremintExecutor.t.sol @@ -18,7 +18,6 @@ import {ZoraCreator1155PremintExecutorImpl} from "../../src/delegation/ZoraCreat import {ZoraCreator1155Attribution, ContractCreationConfig, TokenCreationConfig, PremintConfig} from "../../src/delegation/ZoraCreator1155Attribution.sol"; import {UUPSUpgradeable} from "@zoralabs/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol"; import {ProxyShim} from "../../src/utils/ProxyShim.sol"; -import {IMinterErrors} from "../../src/interfaces/IMinterErrors.sol"; contract ZoraCreator1155PreminterTest is Test { uint256 internal constant CONTRACT_BASE_ID = 0; @@ -565,7 +564,7 @@ contract ZoraCreator1155PreminterTest is Test { // execute mint directly on the contract - and check make sure it reverts if minted after sale start IMinter1155 fixedPriceMinter = factory.defaultMinters()[0]; if (shouldRevert) { - vm.expectRevert(IMinterErrors.SaleEnded.selector); + vm.expectRevert(ZoraCreatorFixedPriceSaleStrategy.SaleEnded.selector); } vm.deal(premintExecutor, mintCost);