@@ -12,7 +12,7 @@ This contract allows for minting with one of two strategies:
12
12
- ERC721: minting with specified tokenIDs (inefficient)
13
13
- ERC721Psi: minting in batches with consecutive tokenIDs (efficient)
14
14
15
- All other ERC721 functions are supported, with routing logic depending on the tokenId.
15
+ All other ERC721 functions are supported, with routing logic depending on the tokenId.
16
16
*/
17
17
18
18
abstract contract ERC721Hybrid is ERC721PsiBurnable , ERC721 , IImmutableERC721Errors {
@@ -56,13 +56,13 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
56
56
/** @dev returns the threshold that divides tokens that are minted by id and
57
57
* minted by quantity
58
58
**/
59
- function bulkMintThreshold () public pure virtual returns (uint256 ) {
59
+ function mintBatchByQuantityThreshold () public pure virtual returns (uint256 ) {
60
60
return 2 ** 128 ;
61
61
}
62
62
63
63
/// @dev returns the startTokenID for the minting by quantity section of the contract
64
64
function _startTokenId () internal pure virtual override (ERC721Psi ) returns (uint256 ) {
65
- return bulkMintThreshold ();
65
+ return mintBatchByQuantityThreshold ();
66
66
}
67
67
68
68
/// @dev mints number of tokens specified to the address given via erc721psi
@@ -93,7 +93,7 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
93
93
94
94
/// @dev mints by id to a specified address via erc721
95
95
function _mintByID (address to , uint256 tokenId ) internal {
96
- if (tokenId >= bulkMintThreshold ()) {
96
+ if (tokenId >= mintBatchByQuantityThreshold ()) {
97
97
revert IImmutableERC721IDAboveThreshold (tokenId);
98
98
}
99
99
@@ -106,7 +106,7 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
106
106
107
107
/// @dev safe mints by id to a specified address via erc721
108
108
function _safeMintByID (address to , uint256 tokenId ) internal {
109
- if (tokenId >= bulkMintThreshold ()) {
109
+ if (tokenId >= mintBatchByQuantityThreshold ()) {
110
110
revert IImmutableERC721IDAboveThreshold (tokenId);
111
111
}
112
112
@@ -192,22 +192,22 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
192
192
* the erc721psi method is invoked. They then behave like their specified ancestors methods.
193
193
**/
194
194
function _exists (uint256 tokenId ) internal view virtual override (ERC721 , ERC721PsiBurnable ) returns (bool ) {
195
- if (tokenId < bulkMintThreshold ()) {
195
+ if (tokenId < mintBatchByQuantityThreshold ()) {
196
196
return ERC721 ._ownerOf (tokenId) != address (0 ) && (! _burnedTokens.get (tokenId));
197
197
}
198
198
return ERC721PsiBurnable ._exists (tokenId);
199
199
}
200
200
201
201
function _transfer (address from , address to , uint256 tokenId ) internal virtual override (ERC721 , ERC721Psi ) {
202
- if (tokenId < bulkMintThreshold ()) {
202
+ if (tokenId < mintBatchByQuantityThreshold ()) {
203
203
ERC721 ._transfer (from, to, tokenId);
204
204
} else {
205
205
ERC721Psi ._transfer (from, to, tokenId);
206
206
}
207
207
}
208
208
209
209
function ownerOf (uint256 tokenId ) public view virtual override (ERC721 , ERC721Psi ) returns (address ) {
210
- if (tokenId < bulkMintThreshold ()) {
210
+ if (tokenId < mintBatchByQuantityThreshold ()) {
211
211
return ERC721 .ownerOf (tokenId);
212
212
}
213
213
return ERC721Psi .ownerOf (tokenId);
@@ -217,7 +217,7 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
217
217
* additional tracking is added for erc721 to prevent re-minting
218
218
**/
219
219
function _burn (uint256 tokenId ) internal virtual override (ERC721 , ERC721PsiBurnable ) {
220
- if (tokenId < bulkMintThreshold ()) {
220
+ if (tokenId < mintBatchByQuantityThreshold ()) {
221
221
ERC721 ._burn (tokenId);
222
222
_burnedTokens.set (tokenId);
223
223
_idMintTotalSupply-- ;
@@ -227,7 +227,7 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
227
227
}
228
228
229
229
function _approve (address to , uint256 tokenId ) internal virtual override (ERC721 , ERC721Psi ) {
230
- if (tokenId < bulkMintThreshold ()) {
230
+ if (tokenId < mintBatchByQuantityThreshold ()) {
231
231
return ERC721 ._approve (to, tokenId);
232
232
}
233
233
return ERC721Psi ._approve (to, tokenId);
@@ -237,7 +237,7 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
237
237
address spender ,
238
238
uint256 tokenId
239
239
) internal view virtual override (ERC721 , ERC721Psi ) returns (bool ) {
240
- if (tokenId < bulkMintThreshold ()) {
240
+ if (tokenId < mintBatchByQuantityThreshold ()) {
241
241
return ERC721 ._isApprovedOrOwner (spender, tokenId);
242
242
}
243
243
return ERC721Psi ._isApprovedOrOwner (spender, tokenId);
@@ -249,7 +249,7 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
249
249
uint256 tokenId ,
250
250
bytes memory _data
251
251
) internal virtual override (ERC721 , ERC721Psi ) {
252
- if (tokenId < bulkMintThreshold ()) {
252
+ if (tokenId < mintBatchByQuantityThreshold ()) {
253
253
return ERC721 ._safeTransfer (from, to, tokenId, _data);
254
254
}
255
255
return ERC721Psi ._safeTransfer (from, to, tokenId, _data);
@@ -261,7 +261,7 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
261
261
uint256 tokenId ,
262
262
bytes memory _data
263
263
) public virtual override (ERC721 , ERC721Psi ) {
264
- if (tokenId < bulkMintThreshold ()) {
264
+ if (tokenId < mintBatchByQuantityThreshold ()) {
265
265
return ERC721 .safeTransferFrom (from, to, tokenId, _data);
266
266
}
267
267
return ERC721Psi .safeTransferFrom (from, to, tokenId, _data);
@@ -275,21 +275,21 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
275
275
}
276
276
277
277
function getApproved (uint256 tokenId ) public view virtual override (ERC721 , ERC721Psi ) returns (address ) {
278
- if (tokenId < bulkMintThreshold ()) {
278
+ if (tokenId < mintBatchByQuantityThreshold ()) {
279
279
return ERC721 .getApproved (tokenId);
280
280
}
281
281
return ERC721Psi .getApproved (tokenId);
282
282
}
283
283
284
284
function approve (address to , uint256 tokenId ) public virtual override (ERC721 , ERC721Psi ) {
285
- if (tokenId < bulkMintThreshold ()) {
285
+ if (tokenId < mintBatchByQuantityThreshold ()) {
286
286
return ERC721 .approve (to, tokenId);
287
287
}
288
288
return ERC721Psi .approve (to, tokenId);
289
289
}
290
290
291
291
function transferFrom (address from , address to , uint256 tokenId ) public virtual override (ERC721 , ERC721Psi ) {
292
- if (tokenId < bulkMintThreshold ()) {
292
+ if (tokenId < mintBatchByQuantityThreshold ()) {
293
293
return ERC721 .transferFrom (from, to, tokenId);
294
294
}
295
295
return ERC721Psi .transferFrom (from, to, tokenId);
0 commit comments