ProjectOpenSea / seadrop

Smart contracts for primary drops on EVM chains

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setMaxSupply missing checks!

decapinator opened this issue · comments

ERC721A:

if(newMaxSupply < _totalMinted()){
     revert NewMaxSupplyLessThanTotalMinted(newMaxSupply);
  }

ERC1155:

 if(newMaxSupply < _tokenSupply[tokenid].totalMinted){ // or _tokenSupply[tokenid].totalSupply
      revert NewMaxSupplyLessThanTotalMinted(newMaxSupply);
 }

I guess those are require checks

i don't understand what you mean

setMaxSupply function in contractMetadata accept newMaxSupply which can be less then current minted amount ..

if the totalminted amount is 5000 , i can set the newMaxsupply to 2000 .. maybe it won't affect anything .. but why would u let the owner set it.

i would fix it like this :

if(newMaxSupply < _totalMinted()) {
    revert CannotBeLessThenTotalMinted();
 }

or

 if(newMaxSupply < _totalMinted()) {
      newMaxSupply = _totalMinted();
  }

good call, thanks!
added:

v1: f08a0e7
v2: fe0d47a