Smart Contracts
Contracts
Metadata
GenericMetadataService

GenericMetadataService

Git Source (opens in a new tab)

Inherits: IMetadataService

This contract is used to manage and provide generic metadata url for Handshake domains.

State Variables

sld

HandshakeSld public immutable sld;

tld

HandshakeTld public immutable tld;

BASE_URI

string public BASE_URI;

Functions

constructor

Constructs a new instance of the contract.

constructor(HandshakeSld _sld, HandshakeTld _tld, string memory _baseUri);

Parameters

NameTypeDescription
_sldHandshakeSldThe address of the Handshake Second-Level Domain (SLD) contract.
_tldHandshakeTldThe address of the Handshake Top-Level Domain (TLD) contract.
_baseUristringThe base URI for token metadata.

tokenURI

Returns the token URI for a given namehash.

If the namehash exists in the SLD or TLD contracts, it returns the concatenation of the base URI and the string representation of the namehash. Otherwise, it returns an empty string.

function tokenURI(bytes32 _namehash) external view returns (string memory);

Parameters

NameTypeDescription
_namehashbytes32The namehash of the domain.

Returns

NameTypeDescription
<none>stringThe URI of the token.

supportsInterface

Checks whether the contract supports a given interface, based on the interface ID.

It supports the ERC165 interface (for checking interface support) and the tokenURI function of this contract.

function supportsInterface(bytes4 interfaceID) public pure override returns (bool);

Parameters

NameTypeDescription
interfaceIDbytes4The ID of the interface to check for support.

Returns

NameTypeDescription
<none>boolTrue if the interface is supported, False otherwise.