  function mintWithBudget(
    bytes32[] calldata proof
  )
    public
    payable
    whenNotPaused
    nonReentrant
    onlyWhitelisted(proof, keccak256(abi.encodePacked(msg.sender)))
  {
	    uint256 mintPrice = calculateMintPrice();
@=> 	uint256 amountMinted = 0;
	    uint256 budgetLeft = msg.value;
	
	    while (budgetLeft >= mintPrice && _tokenIds < maxTokensPerGen) { // @audit _tokenIds can only work with 1 generation
	      _mintInternal(msg.sender, mintPrice);
@=> 	  amountMinted++;
	      budgetLeft -= mintPrice;
	      mintPrice = calculateMintPrice();
	    }
	    if (budgetLeft > 0) {
	      (bool refundSuccess, ) = msg.sender.call{ value: budgetLeft }('');
	      require(refundSuccess, 'Refund failed.');
	    }
  }
