Links
Comment on page

RMRKMultiAssetLazyMintNative

RMRK team
RMRKMultiAssetLazyMintNative
Implementation of RMRK multi asset module with native token-powered lazy minting.

Methods

RMRK_INTERFACE

function RMRK_INTERFACE() external view returns (bytes4)

Returns

Name
Type
Description
_0
bytes4
undefined

VERSION

function VERSION() external view returns (string)
Version of the @rmrk-team/evm-contracts package

Returns

Name
Type
Description
_0
string
undefined

acceptAsset

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.

Parameters

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

addAssetEntry

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.

Parameters

Name
Type
Description
metadataURI
string
Metadata URI of the asset

Returns

Name
Type
Description
_0
uint256
ID of the newly added asset

addAssetToToken

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.

Parameters

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

approve

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.

Parameters

Name
Type
Description
to
address
Address receiving the approval
tokenId
uint256
ID of the token for which the approval is being granted

approveForAssets

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.

Parameters

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

balanceOf

function balanceOf(address owner) external view returns (uint256)
Used to retrieve the number of tokens in owner's account.

Parameters

Name
Type
Description
owner
address
Address of the account being checked

Returns

Name
Type
Description
_0
uint256
The balance of the given account

burn

function burn(uint256 tokenId) external nonpayable
Used to destroy the specified token.
The approval is cleared when the token is burned.Requirements: - tokenId must exist.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token to burn

collectionMetadata

function collectionMetadata() external view returns (string)
Used to retrieve the metadata of the collection.

Returns

Name
Type
Description
_0
string
string The metadata URI of the collection

getActiveAssetPriorities

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.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token for which to retrieve the priorities of the active assets

Returns

Name
Type
Description
_0
uint64[]
An array of priorities of the active assets of the given token

getActiveAssets

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 10k

Parameters

Name
Type
Description
tokenId
uint256
ID of the token to retrieve the IDs of the active assets

Returns

Name
Type
Description
_0
uint64[]
An array of active asset IDs of the given token

getApproved

function getApproved(uint256 tokenId) external view returns (address)
Used to retrieve the account approved to manage given token.
Requirements: - tokenId must exist.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token to check for approval

Returns

Name
Type
Description
_0
address
Address of the account approved to manage the token

getApprovedForAssets

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.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token for which to retrieve the approved address

Returns

Name
Type
Description
_0
address
Address of the account that is approved to manage the specified token's assets

getAssetMetadata

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.

Parameters

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

Returns

Name
Type
Description
_0
string
The metadata of the asset belonging to the specified index in the token's active assets array

getAssetReplacements

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).

Parameters

Name
Type
Description
tokenId
uint256
ID of the token to check
newAssetId
uint64
ID of the pending asset which will be accepted

Returns

Name
Type
Description
_0
uint64
ID of the asset which will be replaced

getPendingAssets

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).

Parameters

Name
Type
Description
tokenId
uint256
ID of the token to retrieve the IDs of the pending assets

Returns

Name
Type
Description
_0
uint64[]
An array of pending asset IDs of the given token

getRoyaltyPercentage

function getRoyaltyPercentage() external view returns (uint256)
Used to retrieve the specified royalty percentage.

Returns

Name
Type
Description
_0
uint256
The royalty percentage expressed in the basis points

getRoyaltyRecipient

function getRoyaltyRecipient() external view returns (address)
Used to retrieve the recipient of royalties.

Returns

Name
Type
Description
_0
address
Address of the recipient of royalties

isApprovedForAll

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.

Parameters

Name
Type
Description
owner
address
Address of the owner of the tokens
operator
address
Address being checked for approval

Returns

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)

isApprovedForAllForAssets

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}.

Parameters

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

Returns

Name
Type
Description
_0
bool
A boolean value indicating wehter the account we are checking has been granted the operator role

isContributor

function isContributor(address contributor) external view returns (bool)
Used to check if the address is one of the contributors.

Parameters

Name
Type
Description
contributor
address
Address of the contributor whose status we are checking

Returns

Name
Type
Description
_0
bool
Boolean value indicating whether the address is a contributor or not

manageContributor

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.

Parameters

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)

maxSupply

function maxSupply() external view returns (uint256)
Used to retrieve the maximum supply of the collection.

Returns

Name
Type
Description
_0
uint256
The maximum supply of tokens in the collection

mint

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.

Parameters

Name
Type
Description
to
address
Address to which to mint the token
numToMint
uint256
Number of tokens to mint

Returns

Name
Type
Description
_0
uint256
The ID of the first token to be minted in the current minting cycle

name

function name() external view returns (string)
Used to retrieve the collection name.

Returns

Name
Type
Description
_0
string
Name of the collection

owner

function owner() external view returns (address)
Returns the address of the current owner.

Returns

Name
Type
Description
_0
address
Address of the current owner

ownerOf

function ownerOf(uint256 tokenId) external view returns (address)
Used to retrieve the owner of the given token.
Requirements: - tokenId must exist.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token for which to retrieve the token for

Returns

Name
Type
Description
_0
address
Address of the account owning the token

pricePerMint

function pricePerMint() external view returns (uint256)
Used to retrieve the price per mint.

Returns

Name
Type
Description
_0
uint256
The price per mint of a single token expressed in the lowest denomination of a native currency

rejectAllAssets

function rejectAllAssets(uint256 tokenId, uint256 maxRejections) external nonpayable
Rejects all assets from the pending array of a given token.
Effecitvely deletes the pending array.Requirements: - The caller must own the token or be approved to manage the token's assets - tokenId must exist.Emits a {AssetRejected} event with assetId = 0.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token of which to clear the pending array.
maxRejections
uint256
Maximum number of expected assets to reject, used to prevent from rejecting assets which arrive just before this operation.

rejectAsset

function rejectAsset(uint256 tokenId, uint256 index, uint64 assetId) external nonpayable
Rejects an asset from the pending array of given token.
Removes the asset from the token's pending asset array.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 a {AssetRejected} event.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token that the asset is being rejected from
index
uint256
Index of the asset in the pending array to be rejected
assetId
uint64
ID of the asset expected to be in the index

renounceOwnership

function renounceOwnership() external nonpayable
Leaves the contract without owner. Functions using the onlyOwner modifier will be disabled.
Can only be called by the current owner.Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

royaltyInfo

function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount)
Used to retrieve the information about who shall receive royalties of a sale of the specified token and how much they will be.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token for which the royalty info is being retrieved
salePrice
uint256
Price of the token sale

Returns

Name
Type
Description
receiver
address
The beneficiary receiving royalties of the sale
royaltyAmount
uint256
The value of the royalties recieved by the receiver from the sale

safeTransferFrom

function safeTransferFrom(address from, address to, uint256 tokenId) external nonpayable
Used to safely transfer a given token token from from to to.
Requirements: - from cannot be the zero address. - to cannot be the zero address. - tokenId token must exist and be owned by from. - If the caller is not from, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If to refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.Emits a {Transfer} event.

Parameters

Name
Type
Description
from
address
Address to transfer the tokens from
to
address