NFT with fixed Supply
The ERC721 smart contract standard is the basic standard for NFTs on EVM compatible chains. The fixed supply limits the total amount of NFTs that can exist from a collection.
The ERC721 is a smart contract standard which is specialised in Non Fungible Tokens (NFT) and out-of-the-box compatible with Opensea. In an ERC721, every NFT is unique which means you have to reference the content for each NFT.
Variables
_name: The name for your NFT collection.
_symbol: The ticker symbol of your NFT collection.
_owner: The current owner of your collection. Initially set to your deployer wallet.
_fixedSupply: The maximum amount of NFTs that can exist for this collection.
_currentTokenID: The current ID of the last minted NFT. This is initially set to 1.
Function | Input Parameters | Description | Output |
---|---|---|---|
constructor | None | Initializes the contract by setting the NFT's name and symbol, and assigns the contract deployer as the initial owner. | None |
name | None | Returns the name of the NFT. |
|
symbol | None | Returns the symbol of the NFT. |
|
balanceOf |
| Returns the number of NFT tokens owned by a specific address. |
|
ownerOf |
| Returns the owner address of the specified token ID. |
|
tokenImage |
| Retrieves the image URL linked to a specific token ID. |
|
transferFrom |
| Transfers a token from one address to another, if the sender is approved or the owner. | None |
approve |
| Approves another address to transfer a specific token ID. | None |
setApprovalForAll |
| Sets or unsets approval for an operator to manage all of the sender's tokens. | None |
isApprovedForAll |
| Checks if an operator is approved to manage all tokens of a given owner. | bool |
getApproved |
| Returns the approved address for a specific token ID. |
|
mint |
| Mints a new token to a specified address with an associated image URL, respecting the fixed supply limit. | None |
totalSupply | None | Returns the total fixed supply of tokens. |
|
_exists |
| Internal function to check if a token exists. | bool |
_isApprovedOrOwner |
| Internal function to check if an address is an approved spender or the owner of a specific token ID. | bool |
_transfer |
| Internal function to handle the token transfer mechanics. | None |
_approve |
| Internal function to set the approval of a given address to manage a specific token ID. | None |
Last updated