-
Notifications
You must be signed in to change notification settings - Fork 5
/
ATXDAONFT.sol
77 lines (62 loc) · 2.61 KB
/
ATXDAONFT.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
/$$$$$$ /$$$$$$$$ /$$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$
/$$__ $$|__ $$__/| $$ / $$| $$__ $$ /$$__ $$ /$$__ $$
| $$ \ $$ | $$ | $$/ $$/| $$ \ $$| $$ \ $$| $$ \ $$
| $$$$$$$$ | $$ \ $$$$/ | $$ | $$| $$$$$$$$| $$ | $$
| $$__ $$ | $$ >$$ $$ | $$ | $$| $$__ $$| $$ | $$
| $$ | $$ | $$ /$$/\ $$| $$ | $$| $$ | $$| $$ | $$
| $$ | $$ | $$ | $$ \ $$| $$$$$$$/| $$ | $$| $$$$$$/
|__/ |__/ |__/ |__/ |__/|_______/ |__/ |__/ \______/
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract ATXDAONFT is ERC721URIStorage, Ownable {
using Counters for Counters.Counter;
bool public isMintable = false;
uint256 public _mintPrice = 512000000000000000; // 0.512 ether
uint256 public _mintQuantity = 25;
Counters.Counter private _mintCount;
Counters.Counter private _tokenIds;
string private _tokenURI;
constructor() ERC721("ATX DAO", "ATX") {}
// Normal mint
function mint() external payable {
require(isMintable == true, "ATX DAO NFT is not mintable at the moment!");
require(balanceOf(msg.sender) == 0, "Minting is only available for non-holders");
require(_mintCount.current() < _mintQuantity, "No more NFTs remaining!");
require(msg.value >= _mintPrice, "Not enough ether sent to mint!");
require(msg.sender == tx.origin, "No contracts!");
// Mint
_tokenIds.increment();
uint256 newTokenId = _tokenIds.current();
_safeMint(msg.sender, newTokenId);
_setTokenURI(newTokenId, _tokenURI);
_mintCount.increment();
}
// Dev mint
function mintSpecial(address[] memory recipients, string memory tokenURI) external onlyOwner {
for (uint64 i = 0; i < recipients.length; i++) {
_tokenIds.increment();
uint256 newTokenId = _tokenIds.current();
_safeMint(recipients[i], newTokenId);
_setTokenURI(newTokenId, tokenURI);
}
}
function startMint(uint256 mintPrice, uint256 mintQuantity, string memory tokenURI) public onlyOwner {
isMintable = true;
_mintPrice = mintPrice;
_mintQuantity = mintQuantity;
_tokenURI = tokenURI;
_mintCount.reset();
}
function endMint() public onlyOwner {
isMintable = false;
}
function sweepEth() public onlyOwner {
uint256 _balance = address(this).balance;
payable(owner()).transfer(_balance);
}
}