1

I have this kind of scenario to mint an NFT.

_tokenIdTracker.increment();
_safeMint(_to, _tokenId);

What I am curious about is which is the right order - Increase token before or after _safeMint?

0

1 Answer 1

0

My instinct says that we should update/increment tokenId count after minting. It's obvious if we increment tokenId before minting then very first tokenId => (0) will be useless and it's not mentioned anywhere Or by patrick that tokenId with value 0 isn't accessible. So it should be considered best practice if we increment/update tokenId after minting. But i'm not sure even don't know anything about asynchronous behaviour of blockchain/solidity techno.

_safeMint(_to, _tokenId);
_tokenIdTracker.increment();

Hope it helps ❤

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.