Why it is recommended to update the s_tokenCounter
before calling _safeMint(address, uint256)
function?
#1091
-
So, I was learning through the tutorial, and at 23:24:16, @PatrickAlphaC says that it is recommended to increment the Is there something under the hood happening, like updating the storage variables takes time as we're writing to the blockchain? If yes, then please, can someone elaborate? EditI also wanted to add I check in @openzepplien/contracts docs, and it increments the counter after the call to function https://docs.openzeppelin.com/contracts/4.x/erc721#constructing_an_erc721_token_contract EditThe GitHub repos associated with my doubt is is: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Can you reply with the entire code relevant to your question? Or, a link to the file if you have a repo works too. Thanks |
Beta Was this translation helpful? Give feedback.
-
I checked the GitHub repo associated with the tutorial. I think @PatrickAlphaC meant that emitting the event |
Beta Was this translation helpful? Give feedback.
I checked the GitHub repo associated with the tutorial. I think @PatrickAlphaC meant that emitting the event
CreatedNFT
is recommended before we actually minting the token by calling_safeMint()
function. I think he incorrectly pointed in the video at 23:24:16 about incrementing the_tokenCounter
before calling the_safeMint()` function.