Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Improve mint limit check in LimitedMintPerAddress #492

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ contract LimitedMintPerAddress is ILimitedMintPerAddress {
}

function _requireMintNotOverLimitAndUpdate(uint256 limit, uint256 numRequestedMint, address tokenContract, uint256 tokenId, address wallet) internal {
mintedPerAddress[tokenContract][tokenId][wallet] += numRequestedMint;
if (mintedPerAddress[tokenContract][tokenId][wallet] > limit) {
revert UserExceedsMintLimit(wallet, limit, mintedPerAddress[tokenContract][tokenId][wallet]);
uint256 newMintCount = mintedPerAddress[tokenContract][tokenId][wallet] + numRequestedMint;
if (newMintCount > limit) {
revert UserExceedsMintLimit(wallet, limit, newMintCount);
}
mintedPerAddress[tokenContract][tokenId][wallet] = newMintCount;
}

function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) {
Expand Down