NFT Contract Generator (BETA)








Powered by LazyDevsâ„¢

Help us by donating to this wallet: 0x1C0A6c9b0622419EE940Db940b1dE9415F89ed97

We accept test-net tokens ;)

1
2// SPDX-License-Identifier: MIT
3
4//Powered By LazyDevs
5//!Disclaimer!
6//    please review this code on your own before using any of
7//    the following code for production.
8//    LazyDevs will not be liable in any way if for the use 
9//    of the code. That being said, the code has been tested 
10//    to the best of the developers' knowledge to work as intended.
11//    If you find any problems please let the dev know in order to improve
12//    the contract and fix vulnerabilities if there is one.
13
14pragma solidity ^0.8.10;
15
16import "@openzeppelin/contracts/access/Ownable.sol";
17import "erc721a/contracts/ERC721A.sol";
18import "@openzeppelin/contracts/utils/Strings.sol";
19
20import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
21
22
23contract LazyDevs is ERC721A, Ownable, ReentrancyGuard {
24
25    using Strings for uint256;
26    
27
28    uint256 price;
29    uint256 _maxSupply;
30    uint256 maxMintAmountPerTx;
31    uint256 maxMintAmountPerWallet;
32
33    string baseURL = "";
34    string ExtensionURL = ".json";
35    
36
37
38    
39    
40    bool paused = false;
41    
42
43    constructor(uint256 _price, uint256 __maxSupply, string memory _initBaseURI, uint256 _maxMintAmountPerTx, uint256 _maxMintAmountPerWallet) ERC721A("Lazy Devs", "LDS") {
44
45        baseURL = _initBaseURI;
46        price = _price;
47        _maxSupply = __maxSupply;
48        maxMintAmountPerTx = _maxMintAmountPerTx;
49        maxMintAmountPerWallet = _maxMintAmountPerWallet;
50        
51        
52        
53    }
54
55    // ================== Mint Function =======================
56
57      function mint(address to, uint256 _mintAmount) public payable{
58          require(!paused, "The contract is paused!");
59          require(_mintAmount > 0 && _mintAmount <= maxMintAmountPerTx, "Invalid mint amount!");
60          require(totalSupply() + _mintAmount <= _maxSupply, "Max supply exceeded!");
61          require(msg.value >= price * _mintAmount, "You dont have enough funds!");
62          require(balanceOf(msg.sender) + _mintAmount <= maxMintAmountPerWallet, "Max mint per wallet exceeded!");
63          
64          
65    
66    
67
68          _safeMint(to, _mintAmount);
69      }
70    // ================== Orange Functions (Owner Only) ===============
71
72    function pause(bool state) public onlyOwner {
73        paused = state;
74    }
75
76    function safeMint(address to, uint256 quantity) public onlyOwner {
77        _safeMint(to, quantity);
78    }
79    
80    function setbaseURL(string memory uri) public onlyOwner{
81        baseURL = uri;
82    }
83
84    function setExtensionURL(string memory uri) public onlyOwner{
85        ExtensionURL = uri;
86    }
87
88    function setCostPrice(uint256 _cost) public onlyOwner{
89        price = _cost;
90    } 
91
92    function setSupply(uint256 supply) public onlyOwner{
93        _maxSupply = supply;
94    }
95    
96    // ================================ Withdraw Function ====================
97
98    function withdraw() public onlyOwner nonReentrant{
99
100        uint256 CurrentContractBalance = address(this).balance;
101        (bool os, ) = payable(owner()).call{value: CurrentContractBalance}("");
102        require(os);
103
104    }
105
106    // =================== Blue Functions (View Only) ====================
107
108    function tokenURI(uint256 tokenId) public view override(ERC721A) returns (string memory){
109
110        require(_exists(tokenId),"ERC721Metadata: URI query for nonexistent token");
111        
112        string memory currentBaseURI = _baseURI();
113        return bytes(currentBaseURI).length > 0
114            ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), ExtensionURL))
115            : '';
116
117    }
118
119    function cost() public view returns (uint256){
120        return price;
121    }
122
123    function _baseURI() internal view virtual override returns (string memory) {
124        return baseURL;
125    }
126
127    function maxSupply() public view returns (uint256){
128        return _maxSupply;
129
130    }  
131}
132//Powered By LazyDevs
133