-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEabt.sol
49 lines (38 loc) · 1.68 KB
/
Eabt.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract EnigmaticAuraBondToken is ERC721Enumerable, Ownable(msg.sender){
using SafeMath for uint256;
uint256 public constant MAX_SUPPLY = 6666;
uint256 public constant MAX_MINT_PER_TRANSACTION = 10;
uint256 public constant PRICE = 0.01 ether;
// Base URI for metadata
string private _baseTokenURI;
// Sale status
bool public saleActive;
constructor(string memory baseTokenURI) ERC721("EnigmaticAuraBondToken", "EABT") {
_baseTokenURI = baseTokenURI;
saleActive = false;
}
function mint(uint256 numberOfTokens) external payable {
require(saleActive, "Sale is not active");
require(numberOfTokens > 0 && numberOfTokens <= MAX_MINT_PER_TRANSACTION, "Invalid number of tokens");
require(totalSupply().add(numberOfTokens) <= MAX_SUPPLY, "Exceeds maximum supply");
require(msg.value == PRICE.mul(numberOfTokens), "Incorrect Ether value");
for (uint256 i = 0; i < numberOfTokens; i++) {
uint256 tokenId = totalSupply() + 1;
_safeMint(msg.sender, tokenId);
}
}
function toggleSaleStatus() external onlyOwner {
saleActive = !saleActive;
}
function setBaseURI(string memory baseTokenURI) external onlyOwner {
_baseTokenURI = baseTokenURI;
}
function _baseURI() internal view override returns (string memory) {
return _baseTokenURI;
}
}