From 5ca081ebd323c1bb228e6cb8d3c7775b5fb68cd1 Mon Sep 17 00:00:00 2001 From: Rohan Kulkarni Date: Wed, 11 Oct 2023 19:17:12 -0400 Subject: [PATCH] chore: add test with custom create referral --- .../ZoraCreator1155PremintExecutor.t.sol | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/packages/1155-contracts/test/premint/ZoraCreator1155PremintExecutor.t.sol b/packages/1155-contracts/test/premint/ZoraCreator1155PremintExecutor.t.sol index 43055245..ee8ba82e 100644 --- a/packages/1155-contracts/test/premint/ZoraCreator1155PremintExecutor.t.sol +++ b/packages/1155-contracts/test/premint/ZoraCreator1155PremintExecutor.t.sol @@ -86,10 +86,32 @@ contract ZoraCreator1155PreminterTest is ForkDeploymentConfig, Test { }); } + function makeTokenCreationConfigWithCreateReferral(address createReferral) internal view returns (TokenCreationConfig memory) { + IMinter1155 fixedPriceMinter = factory.defaultMinters()[0]; + return + TokenCreationConfig({ + tokenURI: "blah.token", + maxSupply: 10, + maxTokensPerAddress: 5, + pricePerToken: 0, + mintStart: 0, + mintDuration: 0, + royaltyMintSchedule: defaultRoyaltyConfig.royaltyMintSchedule, + royaltyBPS: defaultRoyaltyConfig.royaltyBPS, + royaltyRecipient: defaultRoyaltyConfig.royaltyRecipient, + fixedPriceMinter: address(fixedPriceMinter), + createReferral: createReferral + }); + } + function makeDefaultPremintConfig() internal view returns (PremintConfig memory) { return PremintConfig({tokenConfig: makeDefaultTokenCreationConfig(), uid: 100, version: 0, deleted: false}); } + function makePremintConfigWithCreateReferral(address createReferral) internal view returns (PremintConfig memory) { + return PremintConfig({tokenConfig: makeTokenCreationConfigWithCreateReferral(createReferral), uid: 100, version: 0, deleted: false}); + } + function test_successfullyMintsTokens() external { // 1. Make contract creation params @@ -729,6 +751,21 @@ contract ZoraCreator1155PreminterTest is ForkDeploymentConfig, Test { preminter.premint{value: mintCost}(contractConfig, premintConfig2, newCreatorSignature, quantityToMint, "yo"); } + function testPremintWithCreateReferral() public { + address createReferral = makeAddr('createReferral'); + + ContractCreationConfig memory contractConfig = makeDefaultContractCreationConfig(); + PremintConfig memory premintConfig = makePremintConfigWithCreateReferral(createReferral); + + uint256 createdTokenId = _signAndExecutePremint(contractConfig, premintConfig, creatorPrivateKey, block.chainid, premintExecutor, 1, "hi"); + + ZoraCreator1155Impl createdContract = ZoraCreator1155Impl(preminter.getContractAddress(contractConfig)); + + address storedCreateReferral = createdContract.createReferrals(createdTokenId); + + assertEq(storedCreateReferral, createReferral); + } + function _signAndExecutePremint( ContractCreationConfig memory contractConfig, PremintConfig memory premintConfig,