[Ethereum] Help with tokenURI (ERC-721 NFTs)

contract-debuggingcontract-developmenterc-721nftsolidity

I am learning how to make NFTs in Solidity. I have two questions:

1.) what is token URI? What does it mean?

2.) I am following a ERC-721 guide, but I think the _setTokenURI function has been removed from the OpenZeppelin ERC-721 standard because this code will not compile, so how do I set the new URI?

pragma solidity ^ 0.8.10;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract EGM_NFT is ERC721 {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIDs;
    constructor() ERC721("Gato NFT", "GFT") {}

    function createGatoNFT (string memory tokenURI) public returns (uint256) {
        _tokenIDs.increment();
        uint256 newTokenID = _tokenIDs.current();
        _safeMint(msg.sender, newTokenID);
        _setTokenURI(newTokenID, tokenURI);
        return newTokenID;
        
    }

}

Best Answer

I think is because you must install the dependency first and then import like you are doing with Counter.sol.

import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";

Be sure that you run yarn add @openzeppelin/contracts or npm install @openzeppelin/contracts