Skip to content

Instantly share code, notes, and snippets.

@merlox
Last active October 10, 2022 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merlox/c8ee15bce02f6a9d5d59e96c55a2bbef to your computer and use it in GitHub Desktop.
Save merlox/c8ee15bce02f6a9d5d59e96c55a2bbef to your computer and use it in GitHub Desktop.
The simplest NFT contract you'll ever find
// 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