Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/MirakaiScrolls.sol
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ contract MirakaiScrolls is Ownable, ERC721 {

if (tx.origin != msg.sender) revert CallerIsContract();
if (!mintIsActive) revert MintNotActive();
if (currSupply + quantity >= MAX_SUPPLY) revert NotEnoughSupply();
if (currSupply + quantity > MAX_SUPPLY) revert NotEnoughSupply();
if (quantity > 5) revert MintQuantityTooHigh();
if (quantity * mintprice != msg.value) revert IncorrectEtherValue();

Expand All @@ -146,7 +146,7 @@ contract MirakaiScrolls is Ownable, ERC721 {
// tokenDna
if (tx.origin != msg.sender) revert CallerIsContract();
if (!allowListMintIsActive) revert MintNotActive();
if (currSupply + 1 >= MAX_SUPPLY) revert NotEnoughSupply();
if (currSupply + 1 > MAX_SUPPLY) revert NotEnoughSupply();
if (msg.value != mintprice) revert IncorrectEtherValue();
if (allowListMinted[msg.sender] > 0) revert WalletAlreadyMinted();
if (!verify(getMessageHash(msg.sender, 1, 0), signature))
Expand Down Expand Up @@ -177,7 +177,7 @@ contract MirakaiScrolls is Ownable, ERC721 {
// tokenDna
if (tx.origin != msg.sender) revert CallerIsContract();
if (!cc0MintIsActive) revert MintNotActive();
if (currSupply + 1 >= MAX_SUPPLY) revert NotEnoughSupply();
if (currSupply + 1 > MAX_SUPPLY) revert NotEnoughSupply();

// msg.value can be > basePrice due to tipping
if (msg.value < basePrice) revert IncorrectEtherValue();
Expand Down Expand Up @@ -459,7 +459,7 @@ contract MirakaiScrolls is Ownable, ERC721 {
numTeamMints > TEAM_RESERVE
) revert TeamMintOver();
// check MAX_SUPPLY incase we try to mint after we open public mints
if (currSupply + quantity >= MAX_SUPPLY) revert NotEnoughSupply();
if (currSupply + quantity > MAX_SUPPLY) revert NotEnoughSupply();

unchecked {
for (uint256 i = 0; i < quantity; i++) {
Expand Down
22 changes: 22 additions & 0 deletions test/MirakaiScrolls.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,28 @@ contract MirakaiScrollsTest is DSTest, TestVm {
assertEq(mirakaiScrolls.totalSupply(), 0);
}

function testNotEnoughSupply() public {
mirakaiScrolls.flipMint();
mirakaiScrolls.flipAllowListMint();
mirakaiScrolls.flipCC0Mint();

vm.startPrank(user1, user1);
for (uint256 i = 0; i < mirakaiScrolls.MAX_SUPPLY(); ++i) {
mirakaiScrolls.publicMint(1);
}
bytes memory allowlistSignature = signMessage(user1, 1, 0);
bytes memory cc0Signature = signMessage(user1, 1, 1);

vm.expectRevert(MirakaiScrolls.NotEnoughSupply.selector);
mirakaiScrolls.publicMint(1);

vm.expectRevert(MirakaiScrolls.NotEnoughSupply.selector);
mirakaiScrolls.allowListMint(allowlistSignature);

vm.expectRevert(MirakaiScrolls.NotEnoughSupply.selector);
mirakaiScrolls.cc0Mint(1, cc0Signature);
}

// --- utils ---
function signMessage(
address minter,
Expand Down