Skip to content

Instantly share code, notes, and snippets.

@renso3x
Created March 13, 2026 08:39
Show Gist options
  • Select an option

  • Save renso3x/67248c9d0773faf5e7e80197deb35fa9 to your computer and use it in GitHub Desktop.

Select an option

Save renso3x/67248c9d0773faf5e7e80197deb35fa9 to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.31;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract NFTToken is ERC721, Ownable {
uint256 public nextTokenId;
uint256 public constant MAX_SUPPLY = 5;
constructor() ERC721("ChainNFT", "CNFT") Ownable(msg.sender) {}
function mint(address to) external onlyOwner {
require(nextTokenId < MAX_SUPPLY, "All NFT have been minted!");
_safeMint(to, nextTokenId);
nextTokenId++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment