Comment on page
RMRKNestableMultiAssetLazyMintErc20
RMRK team
RMRKNestableMultiAssetLazyMintErc20
Implementation of joined RMRK nestable and multi asset module with ERC20-powered lazy minting.
function RMRK_INTERFACE() external view returns (bytes4)
Name | Type | Description |
---|---|---|
_0 | bytes4 | undefined |
function VERSION() external view returns (string)
Version of the @rmrk-team/evm-contracts package
Name | Type | Description |
---|---|---|
_0 | string | undefined |
function acceptAsset(uint256 tokenId, uint256 index, uint64 assetId) external nonpayable
Accepts an asset at from the pending array of given token.
Migrates the asset from the token's pending asset array to the token's active asset array.Active assets cannot be removed by anyone, but can be replaced by a new asset.Requirements: - The caller must own the token or be approved to manage the token's assets -
tokenId
must exist. - index
must be in range of the length of the pending asset array.Emits an {AssetAccepted} event.Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token for which to accept the pending asset |
index | uint256 | Index of the asset in the pending array to accept |
assetId | uint64 | ID of the asset expected to be in the index |
function acceptChild(uint256 parentId, uint256 childIndex, address childAddress, uint256 childId) external nonpayable
Used to accept a pending child token for a given parent token.
This moves the child token from parent token's pending child tokens array into the active child tokens array.
Name | Type | Description |
---|---|---|
parentId | uint256 | ID of the parent token for which the child token is being accepted |
childIndex | uint256 | Index of a child tokem in the given parent's pending children array |
childAddress | address | Address of the collection smart contract of the child token expected to be located at the specified index of the given parent token's pending children array |
childId | uint256 | ID of the child token expected to be located at the specified index of the given parent token's pending children array |
function addAssetEntry(string metadataURI) external nonpayable returns (uint256)
Used to add a asset entry.
The ID of the asset is automatically assigned to be the next available asset ID.
Name | Type | Description |
---|---|---|
metadataURI | string | Metadata URI of the asset |
Name | Type | Description |
---|---|---|
_0 | uint256 | ID of the newly added asset |
function addAssetToToken(uint256 tokenId, uint64 assetId, uint64 replacesAssetWithId) external nonpayable
Used to add an asset to a token.
If the given asset is already added to the token, the execution will be reverted.If the asset ID is invalid, the execution will be reverted.If the token already has the maximum amount of pending assets (128), the execution will be reverted.
Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token to add the asset to |
assetId | uint64 | ID of the asset to add to the token |
replacesAssetWithId | uint64 | ID of the asset to replace from the token's list of active assets |
function addChild(uint256 parentId, uint256 childId, bytes data) external nonpayable
Used to add a child token to a given parent token.
This adds the child token into the given parent token's pending child tokens array.Requirements: -
directOwnerOf
on the child contract must resolve to the called contract. - the pending array of the parent contract must not be full.Name | Type | Description |
---|---|---|
parentId | uint256 | ID of the parent token to receive the new child token |
childId | uint256 | ID of the new proposed child token |
data | bytes | Additional data with no specified format |
function approve(address to, uint256 tokenId) external nonpayable
Used to grant a one-time approval to manage one's token.
Gives permission to
to
to transfer tokenId
token to another account.The approval is cleared when the token is transferred.Only a single account can be approved at a time, so approving the zero address clears previous approvals.Requirements: - The caller must own the token or be an approved operator. - tokenId
must exist.Emits an {Approval} event.Name | Type | Description |
---|---|---|
to | address | Address receiving the approval |
tokenId | uint256 | ID of the token for which the approval is being granted |
function approveForAssets(address to, uint256 tokenId) external nonpayable
Used to grant permission to the user to manage token's assets.
This differs from transfer approvals, as approvals are not cleared when the approved party accepts or rejects an asset, or sets asset priorities. This approval is cleared on token transfer.Only a single account can be approved at a time, so approving the
0x0
address clears previous approvals.Requirements: - The caller must own the token or be an approved operator. - tokenId
must exist.Emits an {ApprovalForAssets} event.Name | Type | Description |
---|---|---|
to | address | Address of the account to grant the approval to |
tokenId | uint256 | ID of the token for which the approval to manage the assets is granted |
function balanceOf(address owner) external view returns (uint256)
Used to retrieve the number of tokens in
owner
's account.Name | Type | Description |
---|---|---|
owner | address | Address of the account being checked |
Name | Type | Description |
---|---|---|
_0 | uint256 | The balance of the given account |
function burn(uint256 tokenId) external nonpayable
Used to burn a given token.
In case the token has any child tokens, the execution will be reverted.
Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token to burn |
function burn(uint256 tokenId, uint256 maxChildrenBurns) external nonpayable returns (uint256)
Used to burn a given token.
When a token is burned, all of its child tokens are recursively burned as well.When specifying the maximum recursive burns, the execution will be reverted if there are more children to be burned.Setting the
maxRecursiveBurn
value to 0 will only attempt to burn the specified token and revert if there are any child tokens present.The approvals are cleared when the token is burned.Requirements: - tokenId
must exist.Emits a {Transfer} event.Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token to burn |
maxChildrenBurns | uint256 | undefined |
Name | Type | Description |
---|---|---|
_0 | uint256 | Number of recursively burned children |
function childOf(uint256 parentId, uint256 index) external view returns (struct IERC6059.Child)
Used to retrieve a specific active child token for a given parent token.
Returns a single Child struct locating at
index
of parent token's active child tokens array.The Child struct consists of the following values: [ tokenId, contractAddress ]Name | Type | Description |
---|---|---|
parentId | uint256 | ID of the parent token for which the child is being retrieved |
index | uint256 | Index of the child token in the parent token's active child tokens array |
Name | Type | Description |
---|---|---|
_0 | IERC6059.Child | A Child struct containing data about the specified child |
function childrenOf(uint256 parentId) external view returns (struct IERC6059.Child[])
Used to retrieve the active child tokens of a given parent token.
Returns array of Child structs existing for parent token.The Child struct consists of the following values: [ tokenId, contractAddress ]
Name | Type | Description |
---|---|---|
parentId | uint256 | ID of the parent token for which to retrieve the active child tokens |
Name | Type | Description |
---|---|---|
_0 | IERC6059.Child[] | An array of Child structs containing the parent token's active child tokens |
function collectionMetadata() external view returns (string)
Used to retrieve the metadata of the collection.
Name | Type | Description |
---|---|---|
_0 | string | string The metadata URI of the collection |
function directOwnerOf(uint256 tokenId) external view returns (address, uint256, bool)
Used to retrieve the immediate owner of the given token.
If the immediate owner is another token, the address returned, should be the one of the parent token's collection smart contract.
Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token for which the RMRK owner is being retrieved |
Name | Type | Description |
---|---|---|
_0 | address | Address of the given token's owner |
_1 | uint256 | The ID of the parent token. Should be 0 if the owner is an externally owned account |
_2 | bool | The boolean value signifying whether the owner is an NFT or not |
function erc20TokenAddress() external view returns (address)
Used to retrieve the address of the ERC20 token this smart contract supports.
Name | Type | Description |
---|---|---|
_0 | address | Address of the ERC20 token's smart contract |
function getActiveAssetPriorities(uint256 tokenId) external view returns (uint64[])
Used to retrieve the priorities of the active resoources of a given token.
Asset priorities are a non-sequential array of uint64 values with an array size equal to active asset priorites.
Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token for which to retrieve the priorities of the active assets |
Name | Type | Description |
---|---|---|
_0 | uint64[] | An array of priorities of the active assets of the given token |
function getActiveAssets(uint256 tokenId) external view returns (uint64[])
Used to retrieve IDs of the active assets of given token.
Asset data is stored by reference, in order to access the data corresponding to the ID, call
getAssetMetadata(tokenId, assetId)
.You can safely get 10kName | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token to retrieve the IDs of the active assets |
Name | Type | Description |
---|---|---|
_0 | uint64[] | An array of active asset IDs of the given token |
function getApproved(uint256 tokenId) external view returns (address)
Used to retrieve the account approved to manage given token.
Requirements: -
tokenId
must exist.Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token to check for approval |
Name | Type | Description |
---|---|---|
_0 | address | Address of the account approved to manage the token |
function getApprovedForAssets(uint256 tokenId) external view returns (address)
Used to retrieve the address of the account approved to manage assets of a given token.
Requirements: -
tokenId
must exist.Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token for which to retrieve the approved address |
Name | Type | Description |
---|---|---|
_0 | address | Address of the account that is approved to manage the specified token's assets |
function getAssetMetadata(uint256 tokenId, uint64 assetId) external view returns (string)
Used to fetch the asset metadata of the specified token's active asset with the given index.
Assets are stored by reference mapping
_assets[assetId]
.Can be overriden to implement enumerate, fallback or other custom logic.Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token from which to retrieve the asset metadata |
assetId | uint64 | Asset Id, must be in the active assets array |
Name | Type | Description |
---|---|---|
_0 | string | The metadata of the asset belonging to the specified index in the token's active assets array |
function getAssetReplacements(uint256 tokenId, uint64 newAssetId) external view returns (uint64)
Used to retrieve the asset that will be replaced if a given asset from the token's pending array is accepted.
Asset data is stored by reference, in order to access the data corresponding to the ID, call
getAssetMetadata(tokenId, assetId)
.Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token to check |
newAssetId | uint64 | ID of the pending asset which will be accepted |
Name | Type | Description |
---|---|---|
_0 | uint64 | ID of the asset which will be replaced |
function getPendingAssets(uint256 tokenId) external view returns (uint64[])
Used to retrieve IDs of the pending assets of given token.
Asset data is stored by reference, in order to access the data corresponding to the ID, call
getAssetMetadata(tokenId, assetId)
.Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token to retrieve the IDs of the pending assets |
Name | Type | Description |
---|---|---|
_0 | uint64[] | An array of pending asset IDs of the given token |
function getRoyaltyPercentage() external view returns (uint256)
Used to retrieve the specified royalty percentage.
Name | Type | Description |
---|---|---|
_0 | uint256 | The royalty percentage expressed in the basis points |
function getRoyaltyRecipient() external view returns (address)
Used to retrieve the recipient of royalties.
Name | Type | Description |
---|---|---|
_0 | address | Address of the recipient of royalties |
function isApprovedForAll(address owner, address operator) external view returns (bool)
Used to check if the given address is allowed to manage the tokens of the specified address.
Name | Type | Description |
---|---|---|
owner | address | Address of the owner of the tokens |
operator | address | Address being checked for approval |
Name | Type | Description |
---|---|---|
_0 | bool | A boolean value signifying whether the operator is allowed to manage the tokens of the owner ( true ) or not (false ) |
function isApprovedForAllForAssets(address owner, address operator) external view returns (bool)
Used to check whether the address has been granted the operator role by a given address or not.
See {setApprovalForAllForAssets}.
Name | Type | Description |
---|---|---|
owner | address | Address of the account that we are checking for whether it has granted the operator role |
operator | address | Address of the account that we are checking whether it has the operator role or not |
Name | Type | Description |
---|---|---|
_0 | bool | A boolean value indicating wehter the account we are checking has been granted the operator role |
function isContributor(address contributor) external view returns (bool)
Used to check if the address is one of the contributors.
Name | Type | Description |
---|---|---|
contributor | address | Address of the contributor whose status we are checking |
Name | Type | Description |
---|---|---|
_0 | bool | Boolean value indicating whether the address is a contributor or not |
function manageContributor(address contributor, bool grantRole) external nonpayable
Adds or removes a contributor to the smart contract.
Can only be called by the owner.Emits ContributorUpdate event.
Name | Type | Description |
---|---|---|
contributor | address | Address of the contributor's account |
grantRole | bool | A boolean value signifying whether the contributor role is being granted ( true ) or revoked (false ) |
function maxSupply() external view returns (uint256)
Used to retrieve the maximum supply of the collection.
Name | Type | Description |
---|---|---|
_0 | uint256 | The maximum supply of tokens in the collection |
function mint(address to, uint256 numToMint) external payable returns (uint256)
Used to mint the desired number of tokens to the specified address.
The
data
value of the _safeMint
method is set to an empty value.Can only be called while the open sale is open.Name | Type | Description |
---|---|---|
to | address | Address to which to mint the token |
numToMint | uint256 | Number of tokens to mint |