@@ -9,29 +9,28 @@ import 'erc721a/contracts/ERC721A.sol';
9
9
10
10
pragma solidity >= 0.8.13 < 0.9.0 ;
11
11
12
- contract SampleNFTLowGas is ERC721A , Ownable , ReentrancyGuard { //Change contract name from SampleNFTLowGas
12
+ contract NFTcontractName is ERC721A , Ownable , ReentrancyGuard { //Change contract name from SampleNFTLowGas
13
13
14
14
using Strings for uint256 ;
15
15
16
16
// ================== Variables Start =======================
17
-
17
+
18
18
string public uri; //you don't change this
19
- string public hiddenMetadataUri; //you don't change this
20
19
string public uriSuffix = ".json " ; //you don't change this
21
- uint256 public cost1 = 0 ether ; //here you change phase 1 cost (for example first 1k for free, then 0.003eth each nft)
22
- uint256 public cost2 = 0.003 ether ; //here you change phase 2 cost
23
- uint256 public supplyPhase1 = 1000 ; //change to your NFT supply for phase1
24
- uint256 public supplyLimit = 3333 ; //change it to your total NFT supply
25
- uint256 public maxMintAmountPerTxPhase1 = 2 ; //decide how many NFT's you want to mint with cost1
26
- uint256 public maxMintAmountPerTxPhase2 = 8 ; //decide how many NFT's you want to mint with cost2
27
- uint256 public maxLimitPerWallet = 10 ; //decide how many NFT's you want to let customers mint per wallet
28
- bool public sale = true ; //if false, then mint is paused. If true - mint is started
20
+ string public hiddenMetadataUri; //you don't change this
21
+ uint256 public cost1 = 0 ether ; //here you change phase 1 cost (for example first 1k for free, then 0.004 eth each nft)
22
+ uint256 public cost2 = 0.004 ether ; //here you change phase 2 cost
23
+ uint256 public supplyLimitPhase1 = 1111 ; //change to your NFT supply for phase1
24
+ uint256 public supplyLimit = 3333 ; //change it to your total NFT supply
25
+ uint256 public maxMintAmountPerTxPhase1 = 1 ; //decide how many NFT's you want to mint with cost1
26
+ uint256 public maxMintAmountPerTxPhase2 = 5 ; //decide how many NFT's you want to mint with cost2
27
+ uint256 public maxLimitPerWallet = 20 ; //decide how many NFT's you want to let customers mint per wallet
28
+ bool public sale = false ; //if false, then mint is paused. If true - mint is started
29
29
bool public revealed = true ; //when you want instant reveal, leave true.
30
30
31
- // ================== Variables End =======================
31
+ // ================== Variables End =======================
32
32
33
33
// ================== Constructor Start =======================
34
-
35
34
constructor (
36
35
string memory _uri ,
37
36
string memory _hiddenMetadataUri
@@ -40,36 +39,26 @@ contract SampleNFTLowGas is ERC721A, Ownable, ReentrancyGuard { //Change contrac
40
39
setHiddenMetadataUri (_hiddenMetadataUri);
41
40
}
42
41
43
- // ================== Constructor End =======================
44
-
45
42
// ================== Mint Functions Start =======================
46
43
47
- function UpdateCost (uint256 _mintAmount ) internal view returns (uint256 _cost ) {
44
+ function UpdateCost (uint256 _mintAmount ) internal view returns (uint256 _cost ) {
48
45
49
- if (balanceOf (msg .sender ) + _mintAmount <= maxMintAmountPerTxPhase1 && totalSupply () < supplyPhase1 ) {
50
- return cost1;
51
- }
52
- if (balanceOf (msg .sender ) + _mintAmount > maxMintAmountPerTxPhase1 ){
53
- return cost2;
54
- }
46
+ if (balanceOf (msg .sender ) + _mintAmount <= maxMintAmountPerTxPhase1 && totalSupply () < supplyLimitPhase1 ) {
47
+ return cost1;
48
+ }
49
+ if (balanceOf (msg .sender ) + _mintAmount <= maxMintAmountPerTxPhase2 ){
50
+ return cost2;
51
+ }
55
52
}
56
53
57
54
function Mint (uint256 _mintAmount ) public payable {
58
-
59
- //Normal requirements
55
+ // Normal requirements
60
56
require (sale, 'The Sale is paused! ' );
61
- require (_mintAmount > 0 && _mintAmount <= maxLimitPerWallet , 'Invalid mint amount! ' );
57
+ require (_mintAmount > 0 && _mintAmount <= maxMintAmountPerTxPhase2 , 'Invalid mint amount! ' );
62
58
require (totalSupply () + _mintAmount <= supplyLimit, 'Max supply exceeded! ' );
63
59
require (balanceOf (msg .sender ) + _mintAmount <= maxLimitPerWallet, 'Max mint per wallet exceeded! ' );
64
- if (balanceOf (msg .sender ) == 0 ){
65
- require (msg .value >= UpdateCost (_mintAmount) * (_mintAmount- maxMintAmountPerTxPhase1), 'Insufficient funds! ' );
66
- }else {
67
60
require (msg .value >= UpdateCost (_mintAmount) * _mintAmount, 'Insufficient funds! ' );
68
- }
69
- require ((balanceOf (msg .sender ) + _mintAmount <= maxMintAmountPerTxPhase1 && totalSupply () < supplyPhase1) ||
70
- (balanceOf (msg .sender ) + _mintAmount <= maxMintAmountPerTxPhase2 && totalSupply () <= supplyPhase1), 'Max mint amount exceeded! ' );
71
-
72
- //Mint
61
+
73
62
_safeMint (_msgSender (), _mintAmount);
74
63
}
75
64
@@ -78,10 +67,6 @@ contract SampleNFTLowGas is ERC721A, Ownable, ReentrancyGuard { //Change contrac
78
67
_safeMint (_receiver, _mintAmount);
79
68
}
80
69
81
- // ================== Mint Functions End =======================
82
-
83
- // ================== Set Functions Start =======================
84
-
85
70
function setRevealed (bool _state ) public onlyOwner {
86
71
revealed = _state;
87
72
}
@@ -91,7 +76,7 @@ contract SampleNFTLowGas is ERC721A, Ownable, ReentrancyGuard { //Change contrac
91
76
}
92
77
93
78
function setHiddenMetadataUri (string memory _hiddenMetadataUri ) public onlyOwner {
94
- hiddenMetadataUri = _hiddenMetadataUri;
79
+ hiddenMetadataUri = _hiddenMetadataUri;
95
80
}
96
81
97
82
function setUriSuffix (string memory _uriSuffix ) public onlyOwner {
@@ -132,15 +117,15 @@ contract SampleNFTLowGas is ERC721A, Ownable, ReentrancyGuard { //Change contrac
132
117
(bool os , ) = payable (owner ()).call {value: address (this ).balance}("" );
133
118
require (os);
134
119
}
135
-
120
+
136
121
function price (uint256 _mintAmount ) public view returns (uint256 ){
137
- if (balanceOf (msg .sender ) + _mintAmount <= maxMintAmountPerTxPhase1 && totalSupply () < supplyPhase1 ) {
122
+ if (balanceOf (msg .sender ) + _mintAmount <= maxMintAmountPerTxPhase1 && totalSupply () < supplyLimitPhase1 ) {
138
123
return cost1;
139
124
}
140
- if (balanceOf (msg .sender ) + _mintAmount <= maxLimitPerWallet && totalSupply () >= supplyPhase1 ){
125
+ if (balanceOf (msg .sender ) + _mintAmount <= maxMintAmountPerTxPhase2 && totalSupply () < supplyLimit ){
141
126
return cost2;
142
127
}
143
- return cost2;
128
+ return cost2;
144
129
}
145
130
146
131
function tokensOfOwner (address owner ) external view returns (uint256 [] memory ) {
@@ -185,7 +170,4 @@ function tokensOfOwner(address owner) external view returns (uint256[] memory) {
185
170
function _baseURI () internal view virtual override returns (string memory ) {
186
171
return uri;
187
172
}
188
-
189
- // ================== Read Functions End =======================
190
-
191
173
}
0 commit comments