Last active
February 16, 2022 21:49
-
-
Save dharniel45/02e02cba931198dd23ec3b3ab95da804 to your computer and use it in GitHub Desktop.
Show code
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.4; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
import "@openzeppelin/contracts/utils/Counters.sol"; | |
contract Rare is ERC721, ERC721Enumerable, Ownable { | |
using Counters for Counters.Counter; | |
Counters.Counter private _tokenIdCounter; | |
constructor() ERC721("Rare", "BLK") {} | |
function _baseURI() internal pure override returns (string memory) { | |
return "https://gateway.pinata.cloud/ipfs/QmbjasGHWhDyizG1YJYZAjiLp2gPtVs8ktGiqYnfbj5Di4"; | |
} | |
function safeMint(address to) public onlyOwner { | |
_tokenIdCounter.increment(); | |
uint256 tokenId = _tokenIdCounter.current(); | |
_safeMint(to, tokenId); | |
} | |
// The following functions are overrides required by Solidity. | |
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