MetadataProviderV1.sol

Storage provider for Story Protocol canonical IP metadata (v1).

constructor

constructor(address ipAssetRegistry) public

Initializes the metadata provider contract.

Parameters

NameTypeDescription
ipAssetRegistryaddressThe protocol-wide IP asset registry.

metadata

function metadata(address ipId) external view returns (struct IP.MetadataV1)

Fetches the metadata linked to an IP asset.

Parameters

NameTypeDescription
ipIdaddressThe address identifier of the IP asset.

Return Values

NameTypeDescription
[0]struct IP.MetadataV1metadata The metadata linked to the IP asset.

name

function name(address ipId) external view returns (string)

Gets the name associated with the IP asset.

Parameters

NameTypeDescription
ipIdaddressThe address identifier of the IP asset.

Return Values

NameTypeDescription
[0]stringname The name associated with the IP asset.

hash

function hash(address ipId) external view returns (bytes32)

Gets the hash associated with the IP asset.

Parameters

NameTypeDescription
ipIdaddressThe address identifier of the IP asset.

Return Values

NameTypeDescription
[0]bytes32hash The hash associated with the IP asset.

registrationDate

function registrationDate(address ipId) external view returns (uint64)

Gets the date in which the IP asset was registered.

Parameters

NameTypeDescription
ipIdaddressThe address identifier of the IP asset.

Return Values

NameTypeDescription
[0]uint64registrationDate The date in which the IP asset was registered.

registrant

function registrant(address ipId) external view returns (address)

Gets the initial registrant address of the IP asset.

Parameters

NameTypeDescription
ipIdaddressThe address identifier of the IP asset.

Return Values

NameTypeDescription
[0]addressregistrant The initial registrant address of the IP asset.

uri

function uri(address ipId) external view returns (string)

Gets the external URI associated with the IP asset.

Parameters

NameTypeDescription
ipIdaddressThe address identifier of the IP asset.

Return Values

NameTypeDescription
[0]stringuri The external URI associated with the IP asset.

_verifyMetadata

function _verifyMetadata(bytes data) internal virtual

Checks that the data conforms to the canonical metadata standards.

Parameters

NameTypeDescription
databytesThe canonical metadata in bytes to verify.

_compatible

function _compatible(bytes m1, bytes m2) internal pure virtual returns (bool)

Checks whether two sets of metadata are compatible with one another.
TODO: Add try-catch for ABI-decoding error handling.

_hash

function _hash(struct IP.MetadataV1 data) internal pure returns (bytes32)

Gets the bytes32 hash for a MetadataV1 data struct.

_metadataV1

function _metadataV1(address ipId) internal view returns (struct IP.MetadataV1)

Get the decoded canonical metadata belonging to an IP asset.