Created
March 25, 2022 09:58
-
-
Save santhosh-reddy-6404/3be347e535e7e8b7bee44dfd6de412b1 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=builtin&optimize=false&runs=200&gist=
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.0; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/contracts/utils/Counters.sol"; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol"; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/contracts/access/Ownable.sol"; | |
contract NFTify is ERC721URIStorage, Ownable { | |
using Counters for Counters.Counter; | |
Counters.Counter private tokenIds; | |
string internal _contractURI; | |
constructor(string memory url) ERC721("NFTify", "NFY") { | |
_contractURI = url; | |
} | |
function mintNFT(string memory tokenURI) public returns (uint) { | |
tokenIds.increment(); | |
uint256 newItemId = tokenIds.current(); | |
_mint(msg.sender, newItemId); | |
_setTokenURI(newItemId, tokenURI); | |
return newItemId; | |
} | |
function currentID() public view returns (uint) { | |
return tokenIds.current(); | |
} | |
function contractIRI() external view returns(string memory) { | |
return _contractURI; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment