CoreMetadataViewModule
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
Returns the name of the module.
IP_ASSET_REGISTRY
The address of the IP Asset Registry contract.
MODULE_REGISTRY
The address of the Module Registry contract.
coreMetadataModule
The address of the CoreMetadataModule contract.
Functions
constructor
Initializes the CoreMetadataViewModule contract.
Parameters:
ipAssetRegistry
: The address of the IP Asset Registry contract.moduleRegistry
: The address of the Module Registry contract.
updateCoreMetadataModule
Updates the address of the CoreMetadataModule used by this view module by retrieving it from the ModuleRegistry.
getCoreMetadata
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
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
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
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
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
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
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
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
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
Implements the IERC165 interface.
Parameters:
interfaceId
: The interface identifier.
Returns:
bool
: True if the contract supports the interface, false otherwise.