0

Is it possible to Mint a whitelist and a public sale at the same time? I need to do it for a project but I'm stuck. The project has 3,000 free nft for the whitelist, but at the same time it will be the 7,000 Nft for public sale. How can I do it so that the totalsupply of the public sale minted does not affect the whitelist and they can mint the 3000 without a time limit? Thank you very much in advance!

uint16 private constant MAX_SUPPLY = 10000; //Max Supply
uint16 private constant MAX_WHITELIST = 3000; //Whitelist PASS
uint16 private constant MAX_PUBLIC = 7000;   //PUBLIC PASS


uint8 private maxMintPerWhitelist = 3; 

 function whitelistMint(uint8 _quantity, bytes32[] calldata merkleproof) external payable callerIsUser{

    require(sellingStep == Step.PublicSale, "Sale is not activated");
    require(isValid(merkleproof, keccak256(abi.encodePacked(msg.sender))),"Not in whitelist List");
    require(amountNFTsperWalletWhitelistSale[msg.sender] + _quantity <= maxMintPerWhitelist, "You can only get 3 NFT on the Whitelist Sale");
    require(totalSupply() + _quantity <= MAX_WHITELIST, "Max whitelist supply exceeded");
    require(msg.value >= wlSalePrice * _quantity, "Not enought funds");
    amountNFTsperWalletWhitelistSale[msg.sender] += _quantity;
    _safeMint(msg.sender, _quantity);
    }

function publicSaleMint(uint256 _quantity) external payable callerIsUser {
    require(sellingStep == Step.PublicSale, "Public sale is not  activated");
    require(totalSupply() + _quantity <= MAX_WHITELIST + MAX_PUBLIC, "Max supply exceeded");
    require(msg.value >= publicSalePrice * _quantity, "Not enought funds");
    _safeMint(msg.sender, _quantity);
}

How can modify my Smart Contract to make the Whitelistmint independent of the totalsupply of the publicmint? At this moment when totalsupply will be 3.000 people on whitelist couldn't mint anymore. Help please! Thanks you!

1 Answer 1

1

The issue will be solved by adding one variable that saves the count of whitelist minted

uint16 private whitelistMinted; //Add this variable that saves the count of the NFTs that the people in whitelist minted

function whitelistMint(uint8 _quantity, bytes32[] calldata merkleproof) external payable callerIsUser{
    require(sellingStep == Step.PublicSale, "Sale is not activated");
    require(isValid(merkleproof, keccak256(abi.encodePacked(msg.sender))),"Not in whitelist List");
    require(amountNFTsperWalletWhitelistSale[msg.sender] + _quantity <= maxMintPerWhitelist, "You can only get 3 NFT on the Whitelist Sale");

    //change this line
    require(whitelistMinted + _quantity <= MAX_WHITELIST, "Max whitelist supply exceeded");

    require(msg.value >= wlSalePrice * _quantity, "Not enought funds");
    amountNFTsperWalletWhitelistSale[msg.sender] += _quantity;
    _safeMint(msg.sender, _quantity);

   //add this line
   whitelistMinted = whitelistMinted + _quantity
}
1
  • Thank you so much Steve! I will add ad try as soon i arrive at home! Thanks!
    – edis3
    Aug 22, 2022 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.