Closed cryptedy closed 1 year ago
Hi @cryptedy
Yes, you are correct. This is a deliberate choice for gas saving on not maintaining a _burnCounter
.
Depending on you application, you can probably use _nextTokenId()
instead of totalSupply()
in the mint function.
e.g.
require(_nextTokenId() + amount < SOME_CAP)
If your application heavily uses burn
a lot, you might want to check another implementation I developed.
Hello. I am currently using PsiBurnable for some NFT contracts, but I am facing a problem with high mint cost. Looking at the code, I noticed that Burnable's
_burned()
counts up the_burnedToken
Bitmap and as the number of tokens increases, it accesses a lot of storage, which increases the gas cost.Checking the latest ERC721A, we see that the gas cost of
totalSupply()
is constant regardless of the number of tokens because_burnCounter
is incremented during the burn.