I've been confused about the ERC721 standard. We pass a name and symbol to the constructor. What do they represent? In the source code, it just says token name and token symbol.
Are they the name and symbol of an NFT? (Do NFTs have unique names & symbols?)
- If so, then won't every NFT I mint using that contract have the same name and symbol?
- Where do I specify the name of the collection that it belongs to?
Or are they the name and symbol of the collection to which the NFT belongs too? So that after I deploy the contract, every NFT I mint has that collection name and symbol.
- I was looking at the contract of an NFT on OpenSea - link - and the name and symbol were of the collection that it belongs to (Kitty Crypto Gang (KCG)).
This is sample code from openzeppelin. The constructor is in line 8.
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract GameItem is ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor() ERC721("GameItem", "ITM") {} // constructor is here <---------------------
function awardItem(address player, string memory tokenURI)
public
returns (uint256)
{
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(player, newItemId);
_setTokenURI(newItemId, tokenURI);
return newItemId;
}
}
Also, do NFTs have to be part of a collection? When I go to OpenSea, it seems that there are no individual NFTs. There are only collections.