Skip to content

Commit

Permalink
update new max supply check to check totalMinted instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanio committed Apr 6, 2024
1 parent d649b49 commit 43bc829
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src-upgradeable/src/ERC721ContractMetadataUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ contract ERC721ContractMetadataUpgradeable is
revert CannotExceedMaxSupplyOfUint64(newMaxSupply);
}

// Ensure the max supply does not exceed the total supply.
if (newMaxSupply < totalSupply()) {
revert NewMaxSupplyCannotBeLessThenTotalSupply(
// Ensure the max supply does not exceed the total minted.
if (newMaxSupply < _totalMinted()) {
revert NewMaxSupplyCannotBeLessThenTotalMinted(
newMaxSupply,
totalSupply()
_totalMinted()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface ISeaDropTokenContractMetadataUpgradeable is IERC2981Upgradeable {
/**
* @notice Throw if the max supply exceeds the total supply.
*/
error NewMaxSupplyCannotBeLessThenTotalSupply(
error NewMaxSupplyCannotBeLessThenTotalMinted(
uint256 got,
uint256 totalSupply
);
Expand Down
8 changes: 4 additions & 4 deletions src/ERC721ContractMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ contract ERC721ContractMetadata is
revert CannotExceedMaxSupplyOfUint64(newMaxSupply);
}

// Ensure the max supply does not exceed the total supply.
if (newMaxSupply < totalSupply()) {
revert NewMaxSupplyCannotBeLessThenTotalSupply(
// Ensure the max supply does not exceed the total minted.
if (newMaxSupply < _totalMinted()) {
revert NewMaxSupplyCannotBeLessThenTotalMinted(
newMaxSupply,
totalSupply()
_totalMinted()
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/clones/ERC721ContractMetadataCloneable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ contract ERC721ContractMetadataCloneable is
revert CannotExceedMaxSupplyOfUint64(newMaxSupply);
}

// Ensure the max supply does not exceed the total supply.
if (newMaxSupply < totalSupply()) {
revert NewMaxSupplyCannotBeLessThenTotalSupply(
// Ensure the max supply does not exceed the total minted.
if (newMaxSupply < _totalMinted()) {
revert NewMaxSupplyCannotBeLessThenTotalMinted(
newMaxSupply,
totalSupply()
_totalMinted()
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/interfaces/ISeaDropTokenContractMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ interface ISeaDropTokenContractMetadata is IERC2981 {
error CannotExceedMaxSupplyOfUint64(uint256 newMaxSupply);

/**
* @notice Throw if the max supply exceeds the total supply.
* @notice Throw if the max supply exceeds the total minted.
*/
error NewMaxSupplyCannotBeLessThenTotalSupply(
error NewMaxSupplyCannotBeLessThenTotalMinted(
uint256 got,
uint256 totalSupply
uint256 totalMinted
);

/**
Expand Down
4 changes: 2 additions & 2 deletions test/ERC721ContractMetadata.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe(`ERC721ContractMetadata (v${VERSION})`, function () {
);
});

it("Should not let the owner set the max supply over the totalSupply", async () => {
it("Should not let the owner set the max supply over the totalMinted", async () => {
await token.setMaxSupply(3);
await whileImpersonating(
seadrop.address,
Expand All @@ -121,7 +121,7 @@ describe(`ERC721ContractMetadata (v${VERSION})`, function () {
expect(await token.totalSupply()).to.equal(3);

await expect(token.setMaxSupply(2)).to.be.revertedWith(
"NewMaxSupplyCannotBeLessThenTotalSupply(2, 3)"
"NewMaxSupplyCannotBeLessThenTotalMinted(2, 3)"
);
});

Expand Down

0 comments on commit 43bc829

Please sign in to comment.