Comment on page
RMRKMultiAssetPreMint
RMRK team
RMRKMultiAssetPreMint
Implementation of RMRK multi asset module with pre-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 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 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 destroy the specified token.
The approval is cleared when the token is burned.Requirements: -
tokenId
must exist.Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token to burn |
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 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, string tokenURI) external nonpayable 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 |
tokenURI | string | URI assigned to all the minted tokens |
Name | Type | Description |
---|---|---|
_0 | uint256 | The ID of the first token to be minted in the current minting cycle |
function name() external view returns (string)
Used to retrieve the collection name.
Name | Type | Description |
---|---|---|
_0 | string | Name of the collection |
function owner() external view returns (address)
Returns the address of the current owner.
Name | Type | Description |
---|---|---|
_0 | address | Address of the current owner |
function ownerOf(uint256 tokenId) external view returns (address)
Used to retrieve the owner of the given token.
Requirements: -
tokenId
must exist.Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token for which to retrieve the token for |
Name | Type | Description |
---|---|---|
_0 | address | Address of the account owning the token |
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.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. |
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.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 |
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.
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.
Name | Type | Description |
---|---|---|
tokenId | uint256 | ID of the token for which the royalty info is being retrieved |
salePrice | uint256 | Price of the token sale |
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 |
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.Name | Type | Description |
---|---|---|
from | address | Address to transfer the tokens from |
to | address | Address to transfer the tokens to |
tokenId | uint256 | ID of the token to transfer |
function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) external nonpayable
Used to safely transfer a given token token from
from
to to
.Requirements: -