Submitted by TopStar, also found by Rhaydden (1, 2), dimulski, 0xlemon, pep7siup, aldarion, gajiknownnothing, zhaojohnson, Fitro, eta, 0x3b, dontonka, p0wd3r, pipidu83, almurhasan, 0xDazai, ogKapten, samuraii77, 0xAleko, Ruhum, jesjupyter, stanchev, MinhTriet, avoloder, persik228, Abdessamed, Shubham, AvantGard, Akay, FastChecker, 0xHash, federodes, 0xlookman, y4y, peanuts, zhanmingjing, anonymousjoe, erike1, PENGUN, pfapostol (1, 2), onthehunt11, Autosaida, LeFy, yaioxy, hakunamatata, zeroProtocol, MrValioBg, blackVul, PASCAL, VulnViper, cryptomoon, binary, Daniel_eth, 0xcontrol, Bac0nj, sl1, vinica_boy, Kunhah, 3n0ch, SharpPeaks, inzinko, 0x0bserver, jeremie, DigiSafe, dvrkzy, Abhan, Nihavent, Udsen, 0xPwned, mashbust, shikhar229169, smbv-1923, Bob, Xcrypt, LonelyWolfDemon, frodoBaggins, gkrastenov, Shahil_Hussain, dhank, Topmark, rbserver, ArsenLupin, KupiaSec, gesha17, klau5, ilchovski, ke1caM, 0xrex, shaka, nnez, and 0xJoyBoy03
TraitForgeNft::mintWithBudget function is similar to mintToken, but allows users to mint multiple tokens in a single transaction if they have a budget exceeding the minting price for one token.
However, _tokenIds tracks the total number of tokens ever minted, not just the tokens in the current generation.
In the current implementation, _tokenIds is used to control the minting process. The check while (budgetLeft >= mintPrice && _tokenIds < maxTokensPerGen) ensures that minting will stop when current generation minted tokens reaches maxTokensPerGen.
Instead of checking the number of tokens minted in the current generation, the function incorrectly checks the total number of tokens minted across all generations (_tokenIds).
Here is the current implementation of the mintWithBudget function in the smart contract on line 215:
The function will not allow minting if _tokenIds is greater than 10,000, which will happen after the 1st generation is fully minted.
Use generationMintCounts[currentGeneration] instead of _tokenIds:
Invalid Validation
TForge1 (TraitForge) confirmed
