Skip to content

Commit 970af37

Browse files
authored
Remove virtual from claim of LazyMint bases (#257)
Remove from of LazyMint bases
1 parent 5a253fa commit 970af37

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

contracts/base/ERC1155LazyMint.sol

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,15 @@ contract ERC1155LazyMint is
9999

100100
/**
101101
* @notice Lets an address claim multiple lazy minted NFTs at once to a recipient.
102-
* Contract creators should override this function to create custom logic for claiming,
102+
* This function prevents any reentrant calls, and is not allowed to be overridden.
103+
*
104+
* Contract creators should override `verifyClaim` and `transferTokensOnClaim`
105+
* functions to create custom logic for verification and claiming,
103106
* for e.g. price collection, allowlist, max quantity, etc.
104107
*
105-
* @dev The logic in the `verifyClaim` function determines whether the caller is authorized to mint NFTs.
108+
* @dev The logic in `verifyClaim` determines whether the caller is authorized to mint NFTs.
109+
* The logic in `transferTokensOnClaim` does actual minting of tokens,
110+
* can also be used to apply other state changes.
106111
*
107112
* @param _receiver The recipient of the tokens to mint.
108113
* @param _tokenId The tokenId of the lazy minted NFT to mint.
@@ -112,7 +117,7 @@ contract ERC1155LazyMint is
112117
address _receiver,
113118
uint256 _tokenId,
114119
uint256 _quantity
115-
) public payable virtual nonReentrant {
120+
) public payable nonReentrant {
116121
require(_tokenId < nextTokenIdToMint(), "invalid id");
117122
verifyClaim(msg.sender, _tokenId, _quantity); // Add your claim verification logic by overriding this function.
118123

@@ -208,9 +213,11 @@ contract ERC1155LazyMint is
208213

209214
/**
210215
* @notice Mints tokens to receiver on claim.
211-
* Can also use this function to apply any state changes before minting.
216+
* Any state changes related to `claim` must be applied
217+
* here by overriding this function.
212218
*
213219
* @dev Override this function to add logic for state updation.
220+
* When overriding, apply any state changes before `_mint`.
214221
*/
215222
function transferTokensOnClaim(
216223
address _receiver,

contracts/base/ERC721LazyMint.sol

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,20 @@ contract ERC721LazyMint is
101101

102102
/**
103103
* @notice Lets an address claim multiple lazy minted NFTs at once to a recipient.
104-
* Contract creators should override this function to create custom logic for claiming,
104+
* This function prevents any reentrant calls, and is not allowed to be overridden.
105+
*
106+
* Contract creators should override `verifyClaim` and `transferTokensOnClaim`
107+
* functions to create custom logic for verification and claiming,
105108
* for e.g. price collection, allowlist, max quantity, etc.
106109
*
107-
* @dev The logic in the `verifyClaim` function determines whether the caller is authorized to mint NFTs.
110+
* @dev The logic in `verifyClaim` determines whether the caller is authorized to mint NFTs.
111+
* The logic in `transferTokensOnClaim` does actual minting of tokens,
112+
* can also be used to apply other state changes.
108113
*
109114
* @param _receiver The recipient of the NFT to mint.
110115
* @param _quantity The number of NFTs to mint.
111116
*/
112-
function claim(address _receiver, uint256 _quantity) public payable virtual nonReentrant {
117+
function claim(address _receiver, uint256 _quantity) public payable nonReentrant {
113118
require(_currentIndex + _quantity <= nextTokenIdToLazyMint, "Not enough lazy minted tokens.");
114119
verifyClaim(msg.sender, _quantity); // Add your claim verification logic by overriding this function.
115120

@@ -154,9 +159,11 @@ contract ERC721LazyMint is
154159

155160
/**
156161
* @notice Mints tokens to receiver on claim.
157-
* Can also use this function to apply any state changes before minting.
162+
* Any state changes related to `claim` must be applied
163+
* here by overriding this function.
158164
*
159165
* @dev Override this function to add logic for state updation.
166+
* When overriding, apply any state changes before `_safeMint`.
160167
*/
161168
function transferTokensOnClaim(address _receiver, uint256 _quantity)
162169
internal

0 commit comments

Comments
 (0)