fix: Improve mint limit check in LimitedMintPerAddress #492
+4
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Modified the
_requireMintNotOverLimitAndUpdate
function inLimitedMintPerAddress.sol
to check the mint limit before updating the counter. This prevents unnecessary state changes when the transaction would revert due to exceeding the limit.Changes:
Motivation and Context
The previous implementation updated the state before checking the limit, which could lead to unnecessary state changes in case of a revert. This change makes the contract more gas efficient and provides better error reporting.
Benefits:
Does this change the ABI/API?
No ABI changes - this is an internal implementation improvement.
What tests did you add/modify to account for these changes
Existing tests continue to pass as the external behavior remains the same. The change only affects internal implementation details and error reporting.
Types of changes
Checklist:
Reviewer Checklist: