Last active
October 10, 2022 19:11
-
-
Save merlox/c8ee15bce02f6a9d5d59e96c55a2bbef to your computer and use it in GitHub Desktop.
The simplest NFT contract you'll ever find
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.0; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; | |
contract NFT is ERC721URIStorage { | |
constructor( | |
string memory _name, | |
string memory _symbol, | |
string memory _metadataUrl | |
) ERC721(_name, _symbol) { | |
_safeMint(msg.sender, 1); // Token ID 1 | |
_setTokenURI(1, _metadataUrl); | |
} | |
function contractURI() public view returns (string memory) { | |
return tokenURI(1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment