Core
Other
Utils
Catalog Utils

RMRKCatalogUtils

RMRK team

RMRKCatalogUtils

Smart contract of the RMRK Catalog utils module.

Extra utility functions for RMRK contracts.

Methods

getCatalogData

function getCatalogData(address catalog) external view returns (address owner, string type_, string metadataURI)

Used to get the catalog data of a specified catalog in a single call.

The owner might be address 0 if the catalog does not implement the Ownable interface.

Parameters

NameTypeDescription
catalogaddressAddress of the catalog to get the data from

Returns

NameTypeDescription
owneraddressThe address of the owner of the catalog
type_stringThe type of the catalog
metadataURIstringThe metadata URI of the catalog

getCatalogDataAndExtendedParts

function getCatalogDataAndExtendedParts(address catalog, uint64[] partIds) external view returns (address owner, string type_, string metadataURI, struct RMRKCatalogUtils.ExtendedPart[] parts)

Used to get the catalog data and the extended part data of many parts from the specified catalog in a single call.

Parameters

NameTypeDescription
catalogaddressAddress of the catalog to get the data from
partIdsuint64[]Array of part IDs to get the data from

Returns

NameTypeDescription
owneraddressThe address of the owner of the catalog
type_stringThe type of the catalog
metadataURIstringThe metadata URI of the catalog
partsRMRKCatalogUtils.ExtendedPart[]Array of extended part data structs containing the part data

getExtendedParts

function getExtendedParts(address catalog, uint64[] partIds) external view returns (struct RMRKCatalogUtils.ExtendedPart[] parts)

Used to get the extended part data of many parts from the specified catalog in a single call.

Parameters

NameTypeDescription
catalogaddressAddress of the catalog to get the data from
partIdsuint64[]Array of part IDs to get the data from

Returns

NameTypeDescription
partsRMRKCatalogUtils.ExtendedPart[]Array of extended part data structs containing the part data

getOrphanEquipmentsFromChildAsset

function getOrphanEquipmentsFromChildAsset(address parentAddress, uint256 parentId) external view returns (struct RMRKCatalogUtils.ExtendedEquipment[] equipments)

Used to get data about children equipped to a specified token, where the child asset has been replaced.

Parameters

NameTypeDescription
parentAddressaddressAddress of the collection smart contract of parent token
parentIduint256ID of the parent token

Returns

NameTypeDescription
equipmentsRMRKCatalogUtils.ExtendedEquipment[]Array of extended equipment data structs containing the equipment data, including the slot part ID

getOrphanEquipmentsFromParentAsset

function getOrphanEquipmentsFromParentAsset(address parentAddress, uint256 parentId, address catalogAddress, uint64[] slotPartIds) external view returns (struct RMRKCatalogUtils.ExtendedEquipment[] equipments)

Used to get data about children equipped to a specified token, where the parent asset has been replaced.

Parameters

NameTypeDescription
parentAddressaddressAddress of the collection smart contract of parent token
parentIduint256ID of the parent token
catalogAddressaddressAddress of the catalog the slot part Ids belong to
slotPartIdsuint64[]Array of slot part IDs of the parent token's assets to search for orphan equipments

Returns

NameTypeDescription
equipmentsRMRKCatalogUtils.ExtendedEquipment[]Array of extended equipment data structs containing the equipment data, including the slot part ID

getSlotPartsAndCatalog

function getSlotPartsAndCatalog(address tokenAddress, uint256 tokenId, uint64 assetId) external view returns (uint64[] parentSlotPartIds, address catalogAddress)

Used to retrieve the parent address and its slot part IDs for a given target child, and the catalog of the parent asset.

Parameters

NameTypeDescription
tokenAddressaddressAddress of the collection smart contract of parent token
tokenIduint256ID of the parent token
assetIduint64ID of the parent asset from which to get the slot parts

Returns

NameTypeDescription
parentSlotPartIdsuint64[]Array of slot part IDs of the parent token's asset
catalogAddressaddressAddress of the catalog the parent asset belongs to

splitSlotAndFixedParts

function splitSlotAndFixedParts(uint64[] allPartIds, address catalogAddress) external view returns (uint64[] slotPartIds, uint64[] fixedPartIds)

Used to split slot and fixed parts.

Parameters

NameTypeDescription
allPartIdsuint64[][] An array of Part IDs containing both, Slot and Fixed parts
catalogAddressaddressAn address of the catalog to which the given Parts belong to

Returns

NameTypeDescription
slotPartIdsuint64[]An array of IDs of the Slot parts included in the allPartIds
fixedPartIdsuint64[]An array of IDs of the Fixed parts included in the allPartIds

Errors

RMRKNotComposableAsset

error RMRKNotComposableAsset()

Attempting to compose an asset wihtout having an associated Catalog