Skip to content

Commit

Permalink
chore: add test with custom create referral
Browse files Browse the repository at this point in the history
  • Loading branch information
kulkarohan committed Oct 11, 2023
1 parent be6ca3d commit 4127639
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/premint/ZoraCreator1155PremintExecutor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4127639

Please sign in to comment.