From 8d151340c83049dcf871887afa134894b938774d Mon Sep 17 00:00:00 2001 From: Dan Oved Date: Mon, 6 Nov 2023 10:17:44 -0800 Subject: [PATCH] Rename payout address to payout recipient --- .changeset/violet-starfishes-visit.md | 4 +-- .../delegation/ZoraCreator1155Attribution.sol | 28 +++++++++++++------ .../test/fixtures/Zora1155PremintFixtures.sol | 4 +-- .../test/nft/ZoraCreator1155.t.sol | 2 +- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.changeset/violet-starfishes-visit.md b/.changeset/violet-starfishes-visit.md index c9a3dc03a..9861cd323 100644 --- a/.changeset/violet-starfishes-visit.md +++ b/.changeset/violet-starfishes-visit.md @@ -39,8 +39,8 @@ struct TokenCreationConfigV2 { uint64 mintDuration; // RoyaltyBPS for created tokens. The royalty amount in basis points for secondary sales. uint32 royaltyBPS; - // The address that will receive creatorRewards, secondary royalties, and paid mint funds. - address payoutAddress; + // The address that will receive creatorRewards, secondary royalties, and paid mint funds. This is the address that will be set on the `royaltyRecipient` for the created token on the 1155 contract, which is the address that receives creator rewards and secondary royalties for the token, and on the `fundsRecipient` on the ZoraCreatorFixedPriceSaleStrategy contract for the token, which is the address that receives paid mint funds for the token. + address payoutRecipient; // Fixed price minter address address fixedPriceMinter; // create referral diff --git a/packages/1155-contracts/src/delegation/ZoraCreator1155Attribution.sol b/packages/1155-contracts/src/delegation/ZoraCreator1155Attribution.sol index 3946a5993..32ac750e8 100644 --- a/packages/1155-contracts/src/delegation/ZoraCreator1155Attribution.sol +++ b/packages/1155-contracts/src/delegation/ZoraCreator1155Attribution.sol @@ -80,7 +80,11 @@ struct TokenCreationConfigV2 { // RoyaltyBPS for created tokens. The royalty amount in basis points for secondary sales. uint32 royaltyBPS; // The address that will receive creatorRewards, secondary royalties, and paid mint funds. - address payoutAddress; + // This is the address that will be set on the `royaltyRecipient` for the created token on the 1155 contract, + // which is the address that receives creator rewards and secondary royalties for the token, + // and on the `fundsRecipient` on the ZoraCreatorFixedPriceSaleStrategy contract for the token, + // which is the address that receives paid mint funds for the token. + address payoutRecipient; // Fixed price minter address address fixedPriceMinter; // create referral @@ -195,7 +199,7 @@ library ZoraCreator1155Attribution { bytes32 constant TOKEN_DOMAIN_V2 = keccak256( - "TokenCreationConfig(string tokenURI,uint256 maxSupply,uint64 maxTokensPerAddress,uint96 pricePerToken,uint64 mintStart,uint64 mintDuration,uint32 royaltyBPS,address payoutAddress,address fixedPriceMinter,address createReferral)" + "TokenCreationConfig(string tokenURI,uint256 maxSupply,uint64 maxTokensPerAddress,uint96 pricePerToken,uint64 mintStart,uint64 mintDuration,uint32 royaltyBPS,address payoutRecipient,address fixedPriceMinter,address createReferral)" ); function _hashToken(TokenCreationConfigV2 memory tokenConfig) private pure returns (bytes32) { @@ -210,7 +214,7 @@ library ZoraCreator1155Attribution { tokenConfig.mintStart, tokenConfig.mintDuration, tokenConfig.royaltyBPS, - tokenConfig.payoutAddress, + tokenConfig.payoutRecipient, tokenConfig.fixedPriceMinter, tokenConfig.createReferral ) @@ -266,7 +270,7 @@ library PremintTokenSetup { maxTokensPerAddress: tokenConfig.maxTokensPerAddress, mintDuration: tokenConfig.mintDuration, royaltyBPS: tokenConfig.royaltyBPS, - payoutAddress: tokenConfig.payoutAddress + payoutRecipient: tokenConfig.payoutRecipient }); } @@ -280,7 +284,7 @@ library PremintTokenSetup { maxTokensPerAddress: tokenConfig.maxTokensPerAddress, mintDuration: tokenConfig.mintDuration, royaltyBPS: tokenConfig.royaltyBPS, - payoutAddress: tokenConfig.royaltyRecipient + payoutRecipient: tokenConfig.royaltyRecipient }); } @@ -291,7 +295,7 @@ library PremintTokenSetup { uint64 maxTokensPerAddress, uint64 mintDuration, uint32 royaltyBPS, - address payoutAddress + address payoutRecipient ) private view returns (bytes[] memory calls) { calls = new bytes[](3); @@ -318,7 +322,7 @@ library PremintTokenSetup { calls[2] = abi.encodeWithSelector( IZoraCreator1155.updateRoyaltiesForToken.selector, newTokenId, - ICreatorRoyaltiesControl.RoyaltyConfiguration({royaltyBPS: royaltyBPS, royaltyRecipient: payoutAddress, royaltyMintSchedule: 0}) + ICreatorRoyaltiesControl.RoyaltyConfiguration({royaltyBPS: royaltyBPS, royaltyRecipient: payoutRecipient, royaltyMintSchedule: 0}) ); } @@ -400,7 +404,7 @@ library DelegatedTokenCreation { ); (params, tokenSetupActions) = _recoverDelegatedTokenSetup(premintConfig, newTokenId); - } else { + } else if (premintVersion == ZoraCreator1155Attribution.HASHED_VERSION_2) { PremintConfigV2 memory premintConfig = abi.decode(premintConfigEncoded, (PremintConfigV2)); creatorAttribution = _recoverCreatorAttribution( @@ -412,6 +416,14 @@ library DelegatedTokenCreation { (params, tokenSetupActions) = _recoverDelegatedTokenSetup(premintConfig, newTokenId); } + + revert IZoraCreator1155Errors.InvalidSignatureVersion(); + } + + function supportedPremintSignatureVersions() external pure returns (string[] memory versions) { + versions = new string[](2); + versions[0] = ZoraCreator1155Attribution.VERSION_1; + versions[1] = ZoraCreator1155Attribution.VERSION_2; } function _recoverCreatorAttribution( diff --git a/packages/1155-contracts/test/fixtures/Zora1155PremintFixtures.sol b/packages/1155-contracts/test/fixtures/Zora1155PremintFixtures.sol index 7847426f0..99acb2d6c 100644 --- a/packages/1155-contracts/test/fixtures/Zora1155PremintFixtures.sol +++ b/packages/1155-contracts/test/fixtures/Zora1155PremintFixtures.sol @@ -26,7 +26,7 @@ library Zora1155PremintFixtures { mintStart: 0, mintDuration: 0, fixedPriceMinter: address(fixedPriceMinter), - payoutAddress: royaltyRecipient, + payoutRecipient: royaltyRecipient, royaltyBPS: 0, createReferral: address(0) }); @@ -46,7 +46,7 @@ library Zora1155PremintFixtures { mintStart: 0, mintDuration: 0, fixedPriceMinter: address(fixedPriceMinter), - payoutAddress: royaltyRecipient, + payoutRecipient: royaltyRecipient, royaltyBPS: 10, createReferral: createReferral }); diff --git a/packages/1155-contracts/test/nft/ZoraCreator1155.t.sol b/packages/1155-contracts/test/nft/ZoraCreator1155.t.sol index e07443f82..55ba19ba2 100644 --- a/packages/1155-contracts/test/nft/ZoraCreator1155.t.sol +++ b/packages/1155-contracts/test/nft/ZoraCreator1155.t.sol @@ -1063,7 +1063,7 @@ contract ZoraCreator1155Test is Test { mintStart: 0, // The duration of the mint, starting from the first mint of this token. 0 for infinite mintDuration: type(uint64).max - 1, - payoutAddress: admin, + payoutRecipient: admin, royaltyBPS: 0, // Fixed price minter address fixedPriceMinter: address(fixedPriceMinter),