Standard NFT
The ERC721 smart contract standard is the basic standard for NFTs on EVM compatible chains.
The ERC721 is a smart contract standard which is specialised in single-copy 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 of your NFT collection
_symbol: The symbol of your NFT collection
_owner: The owner of the NFT collection. Can be transferred and is initially set to the deployer wallet.
_currentTokenID: The Index of NFTs minted in this collection. 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, only callable by the owner. | None |
_exists |
| Internal function to check if a token exists. |
|
_isApprovedOrOwner |
| Internal function to check if an address is an approved spender or the owner of a specific token ID. |
|
_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