-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJaiKaeRaeBerachain.sol
61 lines (49 loc) · 1.93 KB
/
JaiKaeRaeBerachain.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "erc721a/contracts/ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract JaiKaeRae is ERC721A, Ownable {
// config
constructor() ERC721A("Jai Kae Rae", "JKR") {}
uint256 public MAX_SUPPLY = 100;
uint256 public MAX_MINT_PER_WALLET = 1;
uint256 public START_ID = 0;
bool public mintEnabled = true;
string public baseURI = "ipfs://bafybeibdipg4ouy4bnhagne5sj6vgmf5wy3lrrs55jimkxwoi4nykuwis4/";
// start token id
function _startTokenId() internal view virtual override returns (uint256) {
return START_ID;
}
// metadata
function setBaseURI(string calldata _newBaseURI) external onlyOwner {
baseURI = _newBaseURI;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
return string.concat(baseURI, Strings.toString(tokenId), ".json");
}
// toggle sale, round
function toggleSale() external onlyOwner {
mintEnabled = !mintEnabled;
}
// mint
function mint(uint quantity, bytes32[] calldata _merkleProof) external {
require(mintEnabled, "Sale is not enabled");
require(_numberMinted(msg.sender) + quantity <= MAX_MINT_PER_WALLET, "Over wallet limit");
_checkSupplyAndMint(msg.sender, quantity);
}
function adminMint(uint quantity) external onlyOwner {
_checkSupplyAndMint(msg.sender, quantity);
}
function _checkSupplyAndMint(address to, uint256 quantity) private {
require(_totalMinted() + quantity <= MAX_SUPPLY, "Over supply");
_mint(to, quantity);
}
// aliases
function numberMinted(address owner) external view returns (uint256) {
return _numberMinted(owner);
}
function remainingSupply() external view returns (uint256) {
return MAX_SUPPLY - _totalMinted();
}
}