Closed Furqan558 closed 2 years ago
even though Patrick ran the test with tokenId=0; ( and it worked ) So that is what I am actually confused about 🤔
Can you:
sure!
I ran into the same issue here, but I figured out that in my case the cause of the issue is that after I copy and paste the contract BasicNft.sol
from GitHub repo, I didn't notice that in the function mintNft
, the s_tokenCounter
incremented before calling _safeMint
, so the solution to this issue is simply put that self-increment statement behind the _safeMint calling statement:
function mintNft() public { _safeMint(msg.sender, s_tokenCounter); s_tokenCounter = s_tokenCounter + 1; }
I got this error when I followed the course and create one test along with Patrick... and the issue was that, I was telling the test to read a tokenId = 0; when the tokens Start at "1" ( or at least I think so ) So, tokenId = 1; solved the issue. Any thoughts on this?