> ## Documentation Index
> Fetch the complete documentation index at: https://docs.story.foundation/llms.txt
> Use this file to discover all available pages before exploring further.

# 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

```solidity theme={null}
string public constant override name = CORE_METADATA_VIEW_MODULE_KEY
```

Returns the name of the module.

### IP\_ASSET\_REGISTRY

```solidity theme={null}
address public immutable IP_ASSET_REGISTRY
```

The address of the IP Asset Registry contract.

### MODULE\_REGISTRY

```solidity theme={null}
address public immutable MODULE_REGISTRY
```

The address of the Module Registry contract.

### coreMetadataModule

```solidity theme={null}
address public coreMetadataModule
```

The address of the CoreMetadataModule contract.

## Functions

### constructor

```solidity theme={null}
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

```solidity theme={null}
function updateCoreMetadataModule() external
```

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

### getCoreMetadata

```solidity theme={null}
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

```solidity theme={null}
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

```solidity theme={null}
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

```solidity theme={null}
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

```solidity theme={null}
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

```solidity theme={null}
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

```solidity theme={null}
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

```solidity theme={null}
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

```solidity theme={null}
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

```solidity theme={null}
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.
