hello everyone, I have a question:
in
contract MyToken is ERC721, ERC721Enumerable, ERC721URIStorage, ERC721Burnable, Ownable
...
function safeMint(address to, string memory uri) public onlyOwner {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
_setTokenURI(tokenId, uri);
}

why the user should be able to pass an arbitrary uri?
how can I create a 721 collection? each one with its own pre uploaded metadata

thank you so much!

Nov 9, 2022, 1:36 PM
_safeMint should be used internally in your mint() function

your mint() can use empty string ""

then users cant mess with metadata

make sure you add a function to setMetadata(string memory newbaseUri)
for example ipfs://Q123..456/

and override tokenUri so each nft points to the right path (ipfs://Q123..456/1)
Nov 9, 2022, 2:34 PM
all right thank you ^^
Nov 9, 2022, 2:55 PM

© 2024 Draquery.com All rights reserved.