33
44pragma solidity ^ 0.8.24 ;
55
6- import {IERC721A , ERC721A } from "erc721a/contracts/ERC721A.sol " ;
7- import {ERC2981 } from "@openzeppelin/contracts/token/common/ERC2981.sol " ;
8- import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol " ;
9- import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol " ;
10- import {ERC721Whitelist } from "./extensions/ERC721Whitelist.sol " ;
6+ import { IERC721A , ERC721A } from "erc721a/contracts/ERC721A.sol " ;
7+ import { ERC2981 } from "@openzeppelin/contracts/token/common/ERC2981.sol " ;
8+ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol " ;
9+ import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol " ;
10+ import { ERC721Whitelist } from "./extensions/ERC721Whitelist.sol " ;
1111
1212contract ExampleERC721a is ERC721A , ERC721Whitelist , Ownable , ReentrancyGuard {
1313 //////////////////////////////////////////////////////////////////
@@ -39,7 +39,10 @@ contract ExampleERC721a is ERC721A, ERC721Whitelist, Ownable, ReentrancyGuard {
3939 string memory symbol_ ,
4040 string memory baseTokenURI_ ,
4141 address payable wallet_
42- ) ERC721A (name_, symbol_) Ownable (msg .sender ) {
42+ )
43+ ERC721A (name_, symbol_)
44+ Ownable (msg .sender )
45+ {
4346 _baseTokenURI = baseTokenURI_;
4447 _wallet = wallet_;
4548 }
@@ -56,14 +59,9 @@ contract ExampleERC721a is ERC721A, ERC721Whitelist, Ownable, ReentrancyGuard {
5659 return _baseTokenURI;
5760 }
5861
59- function tokenURI (
60- uint256 tokenId
61- ) public view virtual override returns (string memory ) {
62+ function tokenURI (uint256 tokenId ) public view virtual override returns (string memory ) {
6263 string memory tokenUri = super .tokenURI (tokenId);
63- return
64- bytes (tokenUri).length > 0
65- ? string (abi.encodePacked (tokenUri, ".json " ))
66- : "" ;
64+ return bytes (tokenUri).length > 0 ? string (abi.encodePacked (tokenUri, ".json " )) : "" ;
6765 }
6866
6967 //////////////////////////////////////////////////////////////////
@@ -78,10 +76,7 @@ contract ExampleERC721a is ERC721A, ERC721Whitelist, Ownable, ReentrancyGuard {
7876 function gift (address [] calldata recipients_ ) external onlyOwner {
7977 require (_totalMinted () > 0 , "Reserves not taken yet " );
8078 uint256 recipients = recipients_.length ;
81- require (
82- _totalMinted () + recipients <= MAX_SUPPLY,
83- "Excedes max supply "
84- );
79+ require (_totalMinted () + recipients <= MAX_SUPPLY, "Excedes max supply " );
8580 for (uint256 i = 0 ; i < recipients; i++ ) {
8681 _safeMint (recipients_[i], 1 );
8782 }
@@ -91,31 +86,16 @@ contract ExampleERC721a is ERC721A, ERC721Whitelist, Ownable, ReentrancyGuard {
9186 // WHITELIST SALE //
9287 //////////////////////////////////////////////////////////////////
9388
94- function setWhitelistMerkleRoot (
95- bytes32 whitelistMerkleRoot_
96- ) external onlyOwner {
89+ function setWhitelistMerkleRoot (bytes32 whitelistMerkleRoot_ ) external onlyOwner {
9790 _setWhitelistMerkleRoot (whitelistMerkleRoot_);
9891 }
9992
100- function whitelistMint (
101- uint256 count ,
102- uint256 allowance ,
103- bytes32 [] calldata proof
104- ) public payable nonReentrant {
93+ function whitelistMint (uint256 count , uint256 allowance , bytes32 [] calldata proof ) public payable nonReentrant {
10594 require (_totalMinted () > 0 , "Reserves not taken yet " );
10695 require (_totalMinted () + count <= MAX_SUPPLY, "Exceeds max supply " );
107- require (
108- _validateWhitelistMerkleProof (allowance, proof),
109- "Invalid Merkle Tree proof supplied "
110- );
111- require (
112- _addressToMinted[_msgSender ()] + count <= allowance,
113- "Exceeds whitelist allowance "
114- );
115- require (
116- count * PRICE_IN_WEI_WHITELIST == msg .value ,
117- "Invalid funds provided "
118- );
96+ require (_validateWhitelistMerkleProof (allowance, proof), "Invalid Merkle Tree proof supplied " );
97+ require (_addressToMinted[_msgSender ()] + count <= allowance, "Exceeds whitelist allowance " );
98+ require (count * PRICE_IN_WEI_WHITELIST == msg .value , "Invalid funds provided " );
11999 _addressToMinted[_msgSender ()] += count;
120100 _safeMint (_msgSender (), count);
121101 }
@@ -130,15 +110,12 @@ contract ExampleERC721a is ERC721A, ERC721Whitelist, Ownable, ReentrancyGuard {
130110 }
131111
132112 function publicMint (uint256 count ) public payable nonReentrant {
133- require (_whitelistMerkleRoot == 0 , "Public sale not active " );
113+ require (_whiteListMerkleRoot == 0 , "Public sale not active " );
134114 require (_publicSaleOpen, "Public sale not active " );
135115 require (_totalMinted () > 0 , "Reserves not taken yet " );
136116 require (_totalMinted () + count <= MAX_SUPPLY, "Exceeds max supply " );
137117 require (count < MAX_PER_TX, "Exceeds max per transaction " );
138- require (
139- count * PRICE_IN_WEI_PUBLIC == msg .value ,
140- "Invalid funds provided "
141- );
118+ require (count * PRICE_IN_WEI_PUBLIC == msg .value , "Invalid funds provided " );
142119 _safeMint (_msgSender (), count);
143120 }
144121
@@ -162,15 +139,9 @@ contract ExampleERC721a is ERC721A, ERC721Whitelist, Ownable, ReentrancyGuard {
162139 // ERC165 //
163140 //////////////////////////////////////////////////////////////////
164141
165- function supportsInterface (
166- bytes4 interfaceId
167- ) public view virtual override (ERC721A ) returns (bool ) {
168- return
169- interfaceId == type (Ownable).interfaceId ||
170- interfaceId == type (IERC721A ).interfaceId ||
171- interfaceId == type (ERC721Whitelist ).interfaceId ||
172- ERC721A .supportsInterface (interfaceId) ||
173- interfaceId == type (ERC2981 ).interfaceId ||
174- super .supportsInterface (interfaceId);
142+ function supportsInterface (bytes4 interfaceId ) public view virtual override (ERC721A ) returns (bool ) {
143+ return interfaceId == type (Ownable).interfaceId || interfaceId == type (IERC721A ).interfaceId
144+ || interfaceId == type (ERC721Whitelist ).interfaceId || ERC721A .supportsInterface (interfaceId)
145+ || interfaceId == type (ERC2981 ).interfaceId || super .supportsInterface (interfaceId);
175146 }
176147}
0 commit comments