Created
March 13, 2026 08:39
-
-
Save renso3x/67248c9d0773faf5e7e80197deb35fa9 to your computer and use it in GitHub Desktop.
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.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