diff --git a/test/DiscountTest.ts b/test/DiscountTest.ts index 66e51b2..b2cb174 100644 --- a/test/DiscountTest.ts +++ b/test/DiscountTest.ts @@ -29,7 +29,12 @@ describe("Discounts", () => { let annualPassContract: TestPassOne; let lifetimePassContract: TestPassTwo; - const nullAddress = "0x0000000000000000000000000000000000000000"; + const mintCostAllowlist = ethers.utils.parseEther("0.4"); + const mintCostGeneral = ethers.utils.parseEther("0.8"); + + const hundreadPercentInBps = 10000; + const annualPassDiscountBps = 2500; + const lifetimePassDiscountBps = 5000; beforeEach(async () => { signer = (await ethers.getSigners())[0]; @@ -78,10 +83,8 @@ describe("Discounts", () => { )) as TestPassTwo; lifetimePassContract.initialize(); - const mintCostAllowlist = ethers.utils.parseEther("0.4"); - const mintCostGeneral = ethers.utils.parseEther("0.8"); await minterContract.setPricing(10, 500, mintCostAllowlist, mintCostGeneral, 2, 1); - await minterContract.updateDiscounts(annualPassContract.address, lifetimePassContract.address, 2500, 5000); + await minterContract.updateDiscounts(annualPassContract.address, lifetimePassContract.address, annualPassDiscountBps, lifetimePassDiscountBps); }); it("A non pass holder can not mint while the drop is not for sale", async () => { @@ -337,4 +340,35 @@ describe("Discounts", () => { await expect(minterContract.connect(user).mintEditions([signerAddress], { value: ethers.utils.parseEther("0.9") })).to.be.revertedWith("Wrong price"); }); + + it("A pass holder can mint for free with 100% discount", async () => { + await minterContract.updateDiscounts(annualPassContract.address, lifetimePassContract.address, hundreadPercentInBps, hundreadPercentInBps); + + await annualPassContract.connect(user).mint(userAddress); + await minterContract.setAllowedMinter(2); + + expect(await minterContract.connect(user).mintEditions([signerAddress], { value: ethers.utils.parseEther("0") })).to.emit(minterContract, "EditionSold"); + + expect(await minterContract.totalSupply()).to.be.equal(1); + expect(await minterContract.getAllowListMintLimit()).to.be.equal(2); + expect(await minterContract.getGeneralMintLimit()).to.be.equal(1); + expect(await minterContract.getMintLimit(signerAddress)).to.be.equal(9); + + }); + + it("A pass holder can mint for the standard cost with 0% discount", async () => { + await minterContract.updateDiscounts(annualPassContract.address, lifetimePassContract.address, 0, 0); + + await annualPassContract.connect(user).mint(userAddress); + await minterContract.setAllowedMinter(2); + + expect(await minterContract.connect(user).mintEditions([signerAddress], { value: ethers.utils.parseEther("0.8") })).to.emit(minterContract, "EditionSold"); + + expect(await minterContract.totalSupply()).to.be.equal(1); + expect(await minterContract.getAllowListMintLimit()).to.be.equal(2); + expect(await minterContract.getGeneralMintLimit()).to.be.equal(1); + expect(await minterContract.getMintLimit(signerAddress)).to.be.equal(9); + + }); + }); diff --git a/test/MintRandomlyTest.ts b/test/MintRandomlyTest.ts index 1635c75..3f689c0 100644 --- a/test/MintRandomlyTest.ts +++ b/test/MintRandomlyTest.ts @@ -108,6 +108,19 @@ describe("Mint randomly", () => { expect(await minterContract.getMintLimit(signerAddress)).to.be.equal(9); }); + it("Mint 2 editions via mintMultipleEditions", async () => { + await minterContract.setAllowedMinter(2); + const mintCost = ethers.utils.parseEther("0.1"); + await minterContract.setPricing(10, 500, mintCost, mintCost, 2, 2); + + expect(await minterContract.mintMultipleEditions(signerAddress, 2, { value: ethers.utils.parseEther("0.2") })).to.emit(minterContract, "EditionSold"); + + expect(await minterContract.totalSupply()).to.be.equal(2); + expect(await minterContract.getAllowListMintLimit()).to.be.equal(2); + expect(await minterContract.getGeneralMintLimit()).to.be.equal(2); + expect(await minterContract.getMintLimit(signerAddress)).to.be.equal(8); + }); + it("Can mint zero cost", async () => { const mintCost = ethers.utils.parseEther("0.0"); await minterContract.setPricing(10, 500, mintCost, mintCost, 2, 1);