Last active
November 16, 2021 15:33
-
-
Save mcpcpc/a912ddbcd6d42873fcbc73768f942070 to your computer and use it in GitHub Desktop.
This file contains 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.2; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
import "@openzeppelin/contracts/utils/Counters.sol"; | |
/// @custom:security-contact info@mcpcpc.com | |
contract Manifolds is ERC721, ERC721Enumerable, ERC721Burnable, Ownable { | |
using Counters for Counters.Counter; | |
Counters.Counter private _tokenIdCounter; | |
uint256 public mintPrice = 0.05 ether; | |
uint256 public maxSupply = 256; | |
constructor() ERC721("Manifolds", "MANI") {} | |
function _baseURI() internal pure override returns (string memory) { | |
return "https://gateway.pinata.cloud/ipfs/QmeEKPwzQ3mCY8QWajcZnPKT4a6xJAEhLMppZKtaHhoQpY/"; | |
} | |
function safeMint(address to) public payable { | |
require(totalSupply() < maxSupply, "Mintable limit reached."); | |
require(msg.value >= mintPrice, "Not enough ether sent."); | |
_tokenIdCounter.increment(); | |
uint256 tokenId = _tokenIdCounter.current(); | |
_safeMint(to, tokenId); | |
} | |
function withdraw() public onlyOwner | |
{ | |
require(address(this).balance > 0, "Balance is 0."); | |
payable(owner()).transfer(address(this).balance); | |
} | |
function _beforeTokenTransfer(address from, address to, uint256 tokenId) | |
internal | |
override(ERC721, ERC721Enumerable) | |
{ | |
super._beforeTokenTransfer(from, to, tokenId); | |
} | |
function supportsInterface(bytes4 interfaceId) | |
public | |
view | |
override(ERC721, ERC721Enumerable) | |
returns (bool) | |
{ | |
return super.supportsInterface(interfaceId); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment