MetadataProviderBase.sol

Metadata provider base contract for storing canonical IP metadata.

IP_ASSET_REGISTRY

contract IIPAssetRegistry IP_ASSET_REGISTRY

Returns the protocol-wide IP Asset registry.

upgradeProvider

contract IMetadataProvider upgradeProvider

Returns the new metadata provider IP Assets may migrate to.

_ipMetadata

mapping(address => bytes) _ipMetadata

Maps IP Assets (via their IP ID) to their canonical metadata.

onlyIPAssetRegistry

modifier onlyIPAssetRegistry()

Restricts calls to only originate from a protocol-authorized caller.

constructor

constructor(address ipAssetRegistry) internal

getMetadata

function getMetadata(address ipId) external view virtual returns (bytes)

Gets the metadata associated with an IP Asset.

Parameters

NameTypeDescription
ipIdaddressThe address identifier of the IP Asset.

Return Values

NameTypeDescription
[0]bytesmetadata The encoded metadata associated with the IP Asset.

setUpgradeProvider

function setUpgradeProvider(address provider) external

Sets a upgrade provider for users to migrate their metadata to.

Parameters

NameTypeDescription
provideraddressThe address of the new metadata provider to migrate to.

upgrade

function upgrade(address payable ipId, bytes metadata) external

Updates the provider used by the IP Asset, migrating existing metadata to the new provider, and adding
new metadata.

Parameters

NameTypeDescription
ipIdaddress payableThe address identifier of the IP Asset.
metadatabytesAdditional metadata in bytes used by the new metadata provider.

setMetadata

function setMetadata(address ipId, bytes metadata) external virtual

Sets the metadata associated with an IP Asset.

Enforced to be only callable by the IP Asset registry.

Parameters

NameTypeDescription
ipIdaddressThe address identifier of the IP Asset.
metadatabytesThe metadata in bytes to associate with the IP Asset.

_verifyMetadata

function _verifyMetadata(bytes metadata) internal virtual

Checks that the data conforms to the canonical metadata standards.

Parameters

NameTypeDescription
metadatabytesThe 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.

Parameters

NameTypeDescription
m1bytesThe first set of bytes metadata being compared.
m2bytesThe second set of bytes metadata being compared.