Skip to content

Commit 24978d9

Browse files
feat: support burning on all erc721M contracts
1 parent 4d7357b commit 24978d9

File tree

1 file changed

+47
-50
lines changed

1 file changed

+47
-50
lines changed

contracts/ERC721M.sol

Lines changed: 47 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
77
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
88
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
99
import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
10-
import "erc721a/contracts/extensions/ERC721AQueryable.sol";
10+
import "erc721a/contracts/extensions/ERC721ABurnable.sol";
1111
import "./IERC721M.sol";
1212

1313
/**
@@ -20,7 +20,7 @@ import "./IERC721M.sol";
2020
* - crossmint support
2121
* - anti-botting
2222
*/
23-
contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
23+
contract ERC721M is IERC721M, ERC721ABurnable, Ownable, ReentrancyGuard {
2424
using ECDSA for bytes32;
2525

2626
// Whether this contract is mintable.
@@ -255,11 +255,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
255255
*
256256
* New supply cannot be larger than the old.
257257
*/
258-
function setMaxMintableSupply(uint256 maxMintableSupply)
259-
external
260-
virtual
261-
onlyOwner
262-
{
258+
function setMaxMintableSupply(
259+
uint256 maxMintableSupply
260+
) external virtual onlyOwner {
263261
if (maxMintableSupply > _maxMintableSupply) {
264262
revert CannotIncreaseMaxMintableSupply();
265263
}
@@ -277,10 +275,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
277275
/**
278276
* @dev Sets global wallet limit.
279277
*/
280-
function setGlobalWalletLimit(uint256 globalWalletLimit)
281-
external
282-
onlyOwner
283-
{
278+
function setGlobalWalletLimit(
279+
uint256 globalWalletLimit
280+
) external onlyOwner {
284281
if (globalWalletLimit > _maxMintableSupply)
285282
revert GlobalWalletLimitOverflow();
286283
_globalWalletLimit = globalWalletLimit;
@@ -290,29 +287,18 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
290287
/**
291288
* @dev Returns number of minted token for a given address.
292289
*/
293-
function totalMintedByAddress(address a)
294-
external
295-
view
296-
virtual
297-
override
298-
returns (uint256)
299-
{
290+
function totalMintedByAddress(
291+
address a
292+
) external view virtual override returns (uint256) {
300293
return _numberMinted(a);
301294
}
302295

303296
/**
304297
* @dev Returns info for one stage specified by index (starting from 0).
305298
*/
306-
function getStageInfo(uint256 index)
307-
external
308-
view
309-
override
310-
returns (
311-
MintStageInfo memory,
312-
uint32,
313-
uint256
314-
)
315-
{
299+
function getStageInfo(
300+
uint256 index
301+
) external view override returns (MintStageInfo memory, uint32, uint256) {
316302
if (index >= _mintStages.length) {
317303
revert("InvalidStage");
318304
}
@@ -378,7 +364,7 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
378364
bytes32[] calldata proof,
379365
uint64 timestamp,
380366
bytes calldata signature
381-
) virtual external payable nonReentrant {
367+
) external payable virtual nonReentrant {
382368
_mintInternal(qty, msg.sender, proof, timestamp, signature);
383369
}
384370

@@ -473,11 +459,10 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
473459
* NOTE: This function bypasses validations thus only available for owner.
474460
* This is typically used for owner to pre-mint or mint the remaining of the supply.
475461
*/
476-
function ownerMint(uint32 qty, address to)
477-
external
478-
onlyOwner
479-
hasSupply(qty)
480-
{
462+
function ownerMint(
463+
uint32 qty,
464+
address to
465+
) external onlyOwner hasSupply(qty) {
481466
_safeMint(to, qty);
482467
}
483468

@@ -530,12 +515,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
530515
/**
531516
* @dev Returns token URI for a given token id.
532517
*/
533-
function tokenURI(uint256 tokenId)
534-
public
535-
view
536-
override(ERC721A, IERC721A)
537-
returns (string memory)
538-
{
518+
function tokenURI(
519+
uint256 tokenId
520+
) public view override(ERC721A, IERC721A) returns (string memory) {
539521
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
540522

541523
string memory baseURI = _currentBaseURI;
@@ -595,12 +577,9 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
595577
/**
596578
* @dev Returns the current active stage based on timestamp.
597579
*/
598-
function getActiveStageFromTimestamp(uint64 timestamp)
599-
public
600-
view
601-
override
602-
returns (uint256)
603-
{
580+
function getActiveStageFromTimestamp(
581+
uint64 timestamp
582+
) public view override returns (uint256) {
604583
for (uint256 i = 0; i < _mintStages.length; i++) {
605584
if (
606585
timestamp >= _mintStages[i].startTimeUnixSeconds &&
@@ -623,10 +602,10 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
623602
/**
624603
* @dev Validates the start timestamp is before end timestamp. Used when updating stages.
625604
*/
626-
function _assertValidStartAndEndTimestamp(uint64 start, uint64 end)
627-
internal
628-
pure
629-
{
605+
function _assertValidStartAndEndTimestamp(
606+
uint64 start,
607+
uint64 end
608+
) internal pure {
630609
if (start >= end) revert InvalidStartAndEndTimestamp();
631610
}
632611

@@ -640,4 +619,22 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
640619
}
641620
return chainID;
642621
}
622+
623+
function explicitOwnershipOf(
624+
uint256 tokenId
625+
) external view override returns (TokenOwnership memory) {}
626+
627+
function explicitOwnershipsOf(
628+
uint256[] memory tokenIds
629+
) external view override returns (TokenOwnership[] memory) {}
630+
631+
function tokensOfOwnerIn(
632+
address owner,
633+
uint256 start,
634+
uint256 stop
635+
) external view override returns (uint256[] memory) {}
636+
637+
function tokensOfOwner(
638+
address owner
639+
) external view override returns (uint256[] memory) {}
643640
}

0 commit comments

Comments
 (0)