Skip to content

Lesson 14: randomIpfsNft.test.js question #1339

Answered by krakxn
YuraH99 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, we are calling via @openzeppelin/contracts/token/erc721/extensions/erc721uristorage.sol. And inside that contract, specifically, the following code is what we are using here:

Context:

/**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = _baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).

Replies: 1 comment 2 replies

Comment options

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

@krakxn
Comment options

Answer selected by alymurtazamemon
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