{
    "Function": "tokenURI",
    "File": "contracts/discovery/SubgraphNFT.sol",
    "Parent Contracts": [
        "contracts/discovery/ISubgraphNFT.sol",
        "node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol",
        "node_modules/@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol",
        "node_modules/@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol",
        "node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol",
        "node_modules/@openzeppelin/contracts/introspection/ERC165.sol",
        "node_modules/@openzeppelin/contracts/introspection/IERC165.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol",
        "contracts/governance/Governed.sol"
    ],
    "High-Level Calls": [
        "HexStrings",
        "HexStrings",
        "ISubgraphNFTDescriptor"
    ],
    "Internal Calls": [
        "abi.encodePacked()",
        "abi.encodePacked()",
        "baseURI",
        "_exists",
        "baseURI",
        "require(bool,string)"
    ],
    "Library Calls": [
        "toString",
        "toString"
    ],
    "Low-Level Calls": [],
    "Code": "function tokenURI(uint256 _tokenId)\n        public\n        view\n        override(ERC721, ISubgraphNFT)\n        returns (string memory)\n    {\n        require(_exists(_tokenId), \"ERC721Metadata: URI query for nonexistent token\");\n\n        // Delegates rendering of the metadata to the token descriptor if existing\n        // This allows for some flexibility in adapting the token URI\n        if (address(tokenDescriptor) != address(0)) {\n            return\n                tokenDescriptor.tokenURI(\n                    minter,\n                    _tokenId,\n                    baseURI(),\n                    _subgraphMetadataHashes[_tokenId]\n                );\n        }\n\n        // Default token URI\n        uint256 metadata = uint256(_subgraphMetadataHashes[_tokenId]);\n\n        string memory _subgraphURI = metadata > 0 ? HexStrings.toString(metadata) : \"\";\n        string memory base = baseURI();\n\n        // If there is no base URI, return the token URI.\n        if (bytes(base).length == 0) {\n            return _subgraphURI;\n        }\n        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).\n        if (bytes(_subgraphURI).length > 0) {\n            return string(abi.encodePacked(base, _subgraphURI));\n        }\n        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.\n        return string(abi.encodePacked(base, HexStrings.toString(_tokenId)));\n    }"
}