Links
Comment on page

RMRKNestablePreMint

RMRK team
RMRKNestablePreMint
Implementation of RMRK nestable module with pre-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

acceptChild

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.

Parameters

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

addChild

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.

Parameters

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

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

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 burn a given token.
In case the token has any child tokens, the execution will be reverted.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token to burn

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.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token to burn
maxChildrenBurns
uint256
undefined

Returns

Name
Type
Description
_0
uint256
Number of recursively burned children

childOf

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 ]

Parameters

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

Returns

Name
Type
Description
_0
IERC6059.Child
A Child struct containing data about the specified child

childrenOf

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 ]

Parameters

Name
Type
Description
parentId
uint256
ID of the parent token for which to retrieve the active child tokens

Returns

Name
Type
Description
_0
IERC6059.Child[]
An array of Child structs containing the parent token's active child tokens

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

directOwnerOf

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.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token for which the RMRK owner is being retrieved

Returns

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

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

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)

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

Parameters

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

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

nestMint

function nestMint(address to, uint256 numToMint, uint256 destinationId, string tokenURI) external nonpayable returns (uint256)
Used to mint a desired number of child tokens to a given parent token.
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 of the collection smart contract of the token into which to mint the child token
numToMint
uint256
Number of tokens to mint
destinationId
uint256
ID of the token into which to mint the new child token
tokenURI
string
URI assigned to all the minted tokens

Returns

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

nestTransferFrom

function nestTransferFrom(address from, address to, uint256 tokenId, uint256 destinationId, bytes data) external nonpayable
Used to transfer the token into another token.

Parameters

Name
Type
Description
from
address
Address of the direct owner of the token to be transferred
to
address
Address of the receiving token's collection smart contract
tokenId
uint256
ID of the token being transferred
destinationId
uint256
ID of the token to receive the token being transferred
data
bytes
Additional data with no specified format, sent in the addChild call

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 root owner of a given token.
The root owner of the token is an externally owned account (EOA). If the given token is child of another NFT, this will return an EOA address. Otherwise, if the token is owned by an EOA, this EOA wil be returned.

Parameters

Name
Type
Description
tokenId
uint256
ID of the token for which the root owner has been retrieved

Returns

Name
Type
Description
_0
address
The root owner of the token

pendingChildOf

function pendingChildOf(uint256 parentId, uint256 index) external view returns (struct IERC6059.Child)
Used to retrieve a specific pending child token from 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 ]

Parameters

Name
Type
Description
parentId
uint256
ID of the parent token for which the pending child token is being retrieved
index
uint256
Index of the child token in the parent token's pending child tokens array

Returns

Name
Type
Description
_0
IERC6059.Child
A Child struct containting data about the specified child

pendingChildrenOf

function pendingChildrenOf(uint256 parentId) external view returns (struct IERC6059.Child[])
Used to retrieve the pending child tokens of a given parent token.
Returns array of pending Child structs existing for given parent.The Child struct consists of the following values: [ tokenId, contractAddress ]

Parameters

Name
Type
Description
parentId
uint256
ID of the parent token for which to retrieve the pending child tokens

Returns

Name
Type
Description
_0
IERC6059.Child[]
An array of Child structs containing the parent token's pending child tokens

rejectAllChildren

function rejectAllChildren(uint256 tokenId, uint256 maxRejections) external nonpayable
Used to reject all pending children of a given parent token.
Removes the children from the pending array mapping.This does not update the ownership storage data on children. If necessary, ownership can be reclaimed by the rootOwner of the previous parent.Requirements: Requirements: - parentId must exist

Parameters

Name
Type
Description
tokenId
uint256
undefined
maxRejections
uint256
Maximum number of expected children to reject, used to prevent from rejecting children which arrive just before this operation.

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
Address to transfer the tokens to
tokenId
uint256
ID of the token to transfer

safeTransferFrom

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: - 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
Address to transfer the tokens to
tokenId
uint256
ID of the token to transfer