The CoreMetadataViewModule is a view module that provides read-only access to core metadata of IP assets within Story. It retrieves metadata information such as metadataURI, metadataHash, NFT token URI, and registration date from the IP assets.

State Variables

name

string public constant override name = CORE_METADATA_VIEW_MODULE_KEY

Returns the name of the module.

IP_ASSET_REGISTRY

address public immutable IP_ASSET_REGISTRY

The address of the IP Asset Registry contract.

MODULE_REGISTRY

address public immutable MODULE_REGISTRY

The address of the Module Registry contract.

coreMetadataModule

address public coreMetadataModule

The address of the CoreMetadataModule contract.

Functions

constructor

constructor(address ipAssetRegistry, address moduleRegistry)

Initializes the CoreMetadataViewModule contract.

Parameters:

  • ipAssetRegistry: The address of the IP Asset Registry contract.
  • moduleRegistry: The address of the Module Registry contract.

updateCoreMetadataModule

function updateCoreMetadataModule() external

Updates the address of the CoreMetadataModule used by this view module by retrieving it from the ModuleRegistry.

getCoreMetadata

function getCoreMetadata(address ipId) external view returns (CoreMetadata memory)

Retrieves all core metadata of the IP asset.

Parameters:

  • ipId: The address of the IP asset.

Returns:

  • CoreMetadata: A struct containing all core metadata of the IP asset.

getMetadataURI

function getMetadataURI(address ipId) public view returns (string memory)

Retrieves the metadataURI of the IP asset set by CoreMetadataModule.

Parameters:

  • ipId: The address of the IP asset.

Returns:

  • string: The metadataURI of the IP asset.

getMetadataHash

function getMetadataHash(address ipId) public view returns (bytes32)

Retrieves the metadata hash of the IP asset set by CoreMetadataModule.

Parameters:

  • ipId: The address of the IP asset.

Returns:

  • bytes32: The metadata hash of the IP asset.

getRegistrationDate

function getRegistrationDate(address ipId) public view returns (uint256)

Retrieves the registration date of the IP asset from IPAssetRegistry.

Parameters:

  • ipId: The address of the IP asset.

Returns:

  • uint256: The registration date of the IP asset.

getNftTokenURI

function getNftTokenURI(address ipId) public view returns (string memory)

Retrieves the TokenURI of NFT to which the IP asset is bound, preferring the TokenURI from CoreMetadataModule if available.

Parameters:

  • ipId: The address of the IP asset.

Returns:

  • string: The NFT TokenURI bound to the IP asset.

getNftMetadataHash

function getNftMetadataHash(address ipId) public view returns (bytes32)

Retrieves the NFT metadata hash of the IP asset set by CoreMetadataModule.

Parameters:

  • ipId: The address of the IP asset.

Returns:

  • bytes32: The NFT metadata hash of the IP asset.

getOwner

function getOwner(address ipId) public view returns (address)

Retrieves the owner of the IP asset.

Parameters:

  • ipId: The address of the IP asset.

Returns:

  • address: The address of the owner of the IP asset.

getJsonString

function getJsonString(address ipId) external view returns (string memory)

Generates a JSON string formatted according to the standard NFT metadata schema for the IP asset, including all relevant metadata fields. This function consolidates metadata from both IPAssetRegistry and CoreMetadataModule, with “NFT TokenURI” from CoreMetadataModule taking precedence.

Parameters:

  • ipId: The address of the IP asset.

Returns:

  • string: A base64-encoded JSON string representing all metadata of the IP asset.

isSupported

function isSupported(address ipAccount) external view returns (bool)

Checks whether the view module is supported for the given IP account.

Parameters:

  • ipAccount: The address of the IP account.

Returns:

  • bool: True if the view module is supported, false otherwise.

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual override(BaseModule, IERC165) returns (bool)

Implements the IERC165 interface.

Parameters:

  • interfaceId: The interface identifier.

Returns:

  • bool: True if the contract supports the interface, false otherwise.