CoreMetadataModule.sol
View the smart contract for the Core Metadata Module.
CoreMetadataViewModule.sol
View the smart contract for the Core Metadata View Module.
Metadata Structure
The metadata for an IP Asset includes:- metadataURI: A URI pointing to the detailed metadata of the IP Asset
- metadataHash: A hash of the metadata for verification purposes
- nftTokenURI: A URI pointing to the metadata of the NFT associated with the IP Asset
- nftMetadataHash: A hash of the NFT metadata for verification
- registrationDate: When the IP Asset was registered
- owner: The current owner of the IP Asset
CoreMetadataModule (Write Operations)
CoreMetadataModule.sol
is responsible for writing and updating metadata for IP Assets. It is stateful and provides the following key functionalities:
- Setting and updating metadata URIs for IP Assets
- Setting and updating NFT token URIs
- Freezing metadata to make it immutable
- Managing metadata hashes for verification
Setting Metadata
To set metadata for an IP Asset, the caller must have appropriate permissions. The CoreMetadataModule provides several functions for setting metadata:setMetadataURI
: Sets just the IP metadataURI and its hashupdateNftTokenURI
: Updates the NFT token URI and its hashsetAll
: Sets all metadata attributes at once
solidity
Freezing Metadata
The CoreMetadataModule allows IP Asset owners to freeze metadata, making it immutable. Once frozen, the metadata cannot be changed, ensuring the permanence of the IP Asset’s information. To freeze metadata:solidity
solidity
CoreMetadataViewModule (Read Operations)
CoreMetadataViewModule.sol
is a read-only module that provides access to the metadata stored by the CoreMetadataModule. It follows the View Module pattern and offers these key functionalities:
- Retrieving metadata URIs and hashes
- Retrieving NFT token URIs and metadata hashes
- Generating formatted JSON strings with all metadata attributes
- Checking registration dates and ownership information
Retrieving Metadata
The CoreMetadataViewModule provides various functions to retrieve metadata:getCoreMetadata
: Returns all metadata in a single structgetMetadataURI
: Returns just the metadata URIgetNftTokenURI
: Returns the NFT token URIgetJsonString
: Returns a formatted JSON string with all metadata
solidity