Skip to content

Commit

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

// Ensure the max supply does not exceed the total supply.
if (newMaxSupply < _tokenSupply[tokenId].totalSupply) {
revert NewMaxSupplyCannotBeLessThenTotalSupply(
// Ensure the max supply does not exceed the total minted.
if (newMaxSupply < _tokenSupply[tokenId].totalMinted) {
revert NewMaxSupplyCannotBeLessThenTotalMinted(
newMaxSupply,
_tokenSupply[tokenId].totalSupply
_tokenSupply[tokenId].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 @@ -35,11 +35,11 @@ interface ISeaDropTokenContractMetadata {
error CannotExceedMaxSupplyOfUint64(uint256 got);

/**
* @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
8 changes: 4 additions & 4 deletions src/lib/ERC1155ContractMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ contract ERC1155ContractMetadata is
revert CannotExceedMaxSupplyOfUint64(newMaxSupply);
}

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

Expand Down
8 changes: 4 additions & 4 deletions src/lib/ERC721ContractMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,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
4 changes: 2 additions & 2 deletions test/ERC1155ContractMetadata.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe(`ERC1155ContractMetadata (v${VERSION})`, function () {
.withArgs(BigNumber.from(2).pow(70));
});

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(1, 3);
await mintTokens({
marketplaceContract,
Expand All @@ -137,7 +137,7 @@ describe(`ERC1155ContractMetadata (v${VERSION})`, function () {
await expect(token.setMaxSupply(1, 2))
.to.be.revertedWithCustomError(
token,
"NewMaxSupplyCannotBeLessThenTotalSupply"
"NewMaxSupplyCannotBeLessThenTotalMinted"
)
.withArgs(2, 3);
});
Expand Down
4 changes: 2 additions & 2 deletions test/ERC721ContractMetadata.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe(`ERC721ContractMetadata (v${VERSION})`, function () {
.withArgs(BigNumber.from(2).pow(70));
});

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 mintTokens({
marketplaceContract,
Expand All @@ -134,7 +134,7 @@ describe(`ERC721ContractMetadata (v${VERSION})`, function () {
await expect(token.setMaxSupply(2))
.to.be.revertedWithCustomError(
token,
"NewMaxSupplyCannotBeLessThenTotalSupply"
"NewMaxSupplyCannotBeLessThenTotalMinted"
)
.withArgs(2, 3);
});
Expand Down

0 comments on commit 1525d67

Please sign in to comment.