Skip to content

Lesson 14 Error: call revert exception; VM Exception while processing transaction: reverted with reason string "URI Query for nonexistent token" #2435

Answered by RoboCrypter
zeledorka asked this question in Q&A
Discussion options

You must be logged in to vote

@zeledorka : I have found the mistake!

It is in your contract :

Change the mintNft function from this :

function mintNft(int256 highValue) public {
        s_tokenIdToHighValues[s_tokenCounter] = highValue;
        s_tokenCounter = s_tokenCounter + 1;
        _safeMint(msg.sender, s_tokenCounter);
        emit CreatedNFT(s_tokenCounter, highValue);
    }

To this :

function mintNft(int256 highValue) public {
        s_tokenIdToHighValues[s_tokenCounter] = highValue;
        _safeMint(msg.sender, s_tokenCounter);
        s_tokenCounter = s_tokenCounter + 1;
        emit CreatedNFT(s_tokenCounter, highValue);
    }

Just Copy this one, I have corrected the sequence in the function!

Then do h…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@RoboCrypter
Comment options

@zeledorka
Comment options

Answer selected by zeledorka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants