Last active
September 28, 2022 07:46
-
-
Save KBPsystem777/1d3928ca49a1badf555bba9d15066ba3 to your computer and use it in GitHub Desktop.
MirrorBallNFT.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.4; | |
import "erc721a/contracts/ERC721A.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
contract MirrorBallNFT is ERC721A, Ownable { | |
uint256 MAX_MINTS = 2000; | |
uint256 MAX_SUPPLY = 101714; | |
uint256 public mintRate = 0.000101714 ether; | |
// Using temporary metadata from MFERS' IPFS | |
string public baseURI = "ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/"; | |
constructor() ERC721A("Mirror Ball NFT", "MBL") {} | |
function mint(uint256 quantity) external payable { | |
// _safeMint's second argument now takes in a quantity, not a tokenId. | |
require(quantity + _numberMinted(msg.sender) <= MAX_MINTS, "Exceeded the limit"); | |
require(totalSupply() + quantity <= MAX_SUPPLY, "Not enough tokens left"); | |
require(msg.value >= (mintRate * quantity), "Not enough ether sent"); | |
_safeMint(msg.sender, quantity); | |
} | |
function getEthBalance() public view returns(uint256) { | |
return address(this).balance; | |
} | |
function withdraw() external payable onlyOwner { | |
payable(owner()).transfer(address(this).balance); | |
} | |
function _baseURI() internal view override returns (string memory) { | |
return baseURI; | |
} | |
function setMintRate(uint256 _mintRate) public onlyOwner { | |
mintRate = _mintRate; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment