Skip to content

Instantly share code, notes, and snippets.

@mcpcpc
Last active November 16, 2021 15:33
Show Gist options
  • Save mcpcpc/a912ddbcd6d42873fcbc73768f942070 to your computer and use it in GitHub Desktop.
Save mcpcpc/a912ddbcd6d42873fcbc73768f942070 to your computer and use it in GitHub Desktop.
// 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