ProjectOpenSea / seadrop

Smart contracts for primary drops on EVM chains

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setMaxSupply fix

decapinator opened this issue · comments

Previously i suggested u check newMaxSupply against totalMinted() for ERC721 for the reason :

_checkMintQuantity Fn will always revert if u set newMaxSupply to a number less then totalMinted because totalSupply() returns
totalMinted() - burnedTokens.

        if (quantity + totalMinted > maxSupply) {
            revert MintQuantityExceedsMaxSupply(
                quantity + totalMinted,
                maxSupply
            );
        }

example :
-initial maxSupply : 5000

  • totalMinted : 5000
    -burn: 1000
    -setMaxSupply: 4500

Result : not possible to mint any more tokens . ERC721A version u use doesnt have spotMint to remint burned tokens ..

Adding to that :
ERC721SeaDropRandomOffset will revert always if u try to setRandomOffset after changing newMaxSupply to a number less then totalMinted().

        // Revert if the collection is not yet fully minted.
        if (_totalMinted() != maxSupply) {
            revert NotFullyMinted();
        }

Regarding ERC1155 . I didnt check

Thanks, just don't set max supply under total minted then?

My reasoning for using total supply instead of total minted is because if you have 1000 tokens and 100 burned, I think it's okay to set max supply to 900 to signal there will never be more than 900, instead of being limited to 1000, but you are right then you can't mint more unless you change it.

if its used for that purpose then its correct. But as i mentioned the ERC721A u are using doesnt have the latest feature ( spotMinting) means if the maxSupply 5000 and u burn 1000 .. the max mintable remains 5000 and can never change becuase the token ids are sequential.

no?

Sure, I don't see what's wrong with that, but I can change to checking total minted instead of total supply so it's less confusing.

this is done, thanks!