-
Inside the "fulfillRandomWords" test, there is this line of code: const tokenUri = await randomIpfsNft.tokenURI("0") For me, it returns this via console log: ipfs://QmZYmH5iDbD6v3U2ixoVAjioSzvWJszDzYdbeCLquGSpVm. |
Beta Was this translation helpful? Give feedback.
Answered by
krakxn
Jul 26, 2022
Replies: 1 comment 2 replies
-
Yes, we are calling via 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).
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
return super.tokenURI(tokenId);
} Hope this answers your query! |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: