Core
Other
Extension
Nestable Auto Index
Nestable Auto Index

IRMRKNestableAutoIndex

RMRK team

RMRKNestableAutoIndex

Interface smart contract of the RMRK Nestable AutoIndex module.

Methods

acceptChild

function acceptChild(uint256 parentId, 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

NameTypeDescription
parentIduint256ID of the parent token for which the child token is being accepted
childAddressaddressAddress of the collection smart contract of the child
childIduint256ID of the child token

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

NameTypeDescription
parentIduint256ID of the parent token for which the child token is being accepted
childIndexuint256Index of a child tokem in the given parent's pending children array
childAddressaddressAddress 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
childIduint256ID 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

NameTypeDescription
parentIduint256ID of the parent token to receive the new child token
childIduint256ID of the new proposed child token
databytesAdditional data with no specified format

burn

function burn(uint256 tokenId, uint256 maxRecursiveBurns) external nonpayable returns (uint256 burnedChildren)

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

NameTypeDescription
tokenIduint256ID of the token to burn
maxRecursiveBurnsuint256Maximum number of tokens to recursively burn

Returns

NameTypeDescription
burnedChildrenuint256Number of recursively burned children

childOf

function childOf(uint256 parentId, uint256 index) external view returns (struct IERC7401.Child 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

NameTypeDescription
parentIduint256ID of the parent token for which the child is being retrieved
indexuint256Index of the child token in the parent token's active child tokens array

Returns

NameTypeDescription
childIERC7401.ChildA Child struct containing data about the specified child

childrenOf

function childrenOf(uint256 parentId) external view returns (struct IERC7401.Child[] children)

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

NameTypeDescription
parentIduint256ID of the parent token for which to retrieve the active child tokens

Returns

NameTypeDescription
childrenIERC7401.Child[]An array of Child structs containing the parent token's active child tokens

directOwnerOf

function directOwnerOf(uint256 tokenId) external view returns (address owner, uint256 parentId, bool isNFT)

Used to retrieve the immediate owner of the given token.

If the immediate owner is another token, the address returned will be the parent token's collection address.

Parameters

NameTypeDescription
tokenIduint256ID of the token for which the RMRK owner is being retrieved

Returns

NameTypeDescription
owneraddressAddress of the given token's owner
parentIduint256The ID of the parent token. Should be 0 if the owner is an externally owned account
isNFTboolThe boolean value signifying whether the owner is an NFT or not

nestTransferFrom

function nestTransferFrom(address from, address to, uint256 tokenId, uint256 destinationId, bytes data) external nonpayable

Used to transfer the token into another token.

Parameters

NameTypeDescription
fromaddressAddress of the direct owner of the token to be transferred
toaddressAddress of the receiving token's collection smart contract
tokenIduint256ID of the token being transferred
destinationIduint256ID of the token to receive the token being transferred
databytesAdditional data with no specified format, sent in the addChild call

ownerOf

function ownerOf(uint256 tokenId) external view returns (address owner_)

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 will be returned.

Parameters

NameTypeDescription
tokenIduint256ID of the token for which the root owner has been retrieved

Returns

NameTypeDescription
owner_addressThe root owner of the token

pendingChildOf

function pendingChildOf(uint256 parentId, uint256 index) external view returns (struct IERC7401.Child 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

NameTypeDescription
parentIduint256ID of the parent token for which the pending child token is being retrieved
indexuint256Index of the child token in the parent token's pending child tokens array

Returns

NameTypeDescription
childIERC7401.ChildA Child struct containting data about the specified child

pendingChildrenOf

function pendingChildrenOf(uint256 parentId) external view returns (struct IERC7401.Child[] children)

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

NameTypeDescription
parentIduint256ID of the parent token for which to retrieve the pending child tokens

Returns

NameTypeDescription
childrenIERC7401.Child[]An array of Child structs containing the parent token's pending child tokens

rejectAllChildren

function rejectAllChildren(uint256 parentId, 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

NameTypeDescription
parentIduint256ID of the parent token for which to reject all of the pending tokens.
maxRejectionsuint256Maximum number of expected children to reject, used to prevent from rejecting children which arrive just before this operation.

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)

Returns true if this contract implements the interface defined by interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP (opens in a new tab) section] to learn more about how these ids are created. This function call must use less than 30 000 gas.

Parameters

NameTypeDescription
interfaceIdbytes4undefined

Returns

NameTypeDescription
_0boolundefined

transferChild

function transferChild(uint256 tokenId, address to, uint256 destinationId, address childAddress, uint256 childId, bool isPending, bytes data) external nonpayable

Used to transfer a child token from a given parent token.

When transferring a child token, the owner of the token is set to to, or is not updated in the event of to being the 0x0 address.

Parameters

NameTypeDescription
tokenIduint256ID of the parent token from which the child token is being transferred
toaddressAddress to which to transfer the token to
destinationIduint256ID of the token to receive this child token (MUST be 0 if the destination is not a token)
childAddressaddressAddress of the collection smart contract of the child
childIduint256ID of the child token
isPendingboolA boolean value indicating whether the child token being transferred is in the pending array of the parent token (true) or in the active array (false)
databytesAdditional data with no specified format, sent in call to _to

transferChild

function transferChild(uint256 tokenId, address to, uint256 destinationId, uint256 childIndex, address childAddress, uint256 childId, bool isPending, bytes data) external nonpayable

Used to transfer a child token from a given parent token.

When transferring a child token, the owner of the token is set to to, or is not updated in the event of to being the 0x0 address.

Parameters

NameTypeDescription
tokenIduint256ID of the parent token from which the child token is being transferred
toaddressAddress to which to transfer the token to
destinationIduint256ID of the token to receive this child token (MUST be 0 if the destination is not a token)
childIndexuint256Index of a token we are transferring, in the array it belongs to (can be either active array or pending array)
childAddressaddressAddress of the child token's collection smart contract.
childIduint256ID of the child token in its own collection smart contract.
isPendingboolA boolean value indicating whether the child token being transferred is in the pending array of the parent token (true) or in the active array (false)
databytesAdditional data with no specified format, sent in call to _to

Events

AllChildrenRejected

event AllChildrenRejected(uint256 indexed tokenId)

Used to notify listeners that all pending child tokens of a given token have been rejected.

Emitted when a token removes all a child tokens from its pending array.

Parameters

NameTypeDescription
tokenId indexeduint256ID of the token that rejected all of the pending children

ChildAccepted

event ChildAccepted(uint256 indexed tokenId, uint256 childIndex, address indexed childAddress, uint256 indexed childId)

Used to notify listeners that a new child token was accepted by the parent token.

Emitted when a parent token accepts a token from its pending array, migrating it to the active array.

Parameters

NameTypeDescription
tokenId indexeduint256ID of the token that accepted a new child token
childIndexuint256Index of the newly accepted child token in the parent token's active children array
childAddress indexedaddressAddress of the child token's collection smart contract
childId indexeduint256ID of the child token in the child token's collection smart contract

ChildProposed

event ChildProposed(uint256 indexed tokenId, uint256 childIndex, address indexed childAddress, uint256 indexed childId)

Used to notify listeners that a new token has been added to a given token's pending children array.

Emitted when a child NFT is added to a token's pending array.

Parameters

NameTypeDescription
tokenId indexeduint256ID of the token that received a new pending child token
childIndexuint256Index of the proposed child token in the parent token's pending children array
childAddress indexedaddressAddress of the proposed child token's collection smart contract
childId indexeduint256ID of the child token in the child token's collection smart contract

ChildTransferred

event ChildTransferred(uint256 indexed tokenId, uint256 childIndex, address indexed childAddress, uint256 indexed childId, bool fromPending, bool toZero)

Used to notify listeners a child token has been transferred from parent token.

Emitted when a token transfers a child from itself, transferring ownership to the root owner.

Parameters

NameTypeDescription
tokenId indexeduint256ID of the token that transferred a child token
childIndexuint256Index of a child in the array from which it is being transferred
childAddress indexedaddressAddress of the child token's collection smart contract
childId indexeduint256ID of the child token in the child token's collection smart contract
fromPendingboolA boolean value signifying whether the token was in the pending child tokens array (true) or in the active child tokens array (false)
toZeroboolA boolean value signifying whether the token is being transferred to the 0x0 address (true) or not (false)

NestTransfer

event NestTransfer(address indexed from, address indexed to, uint256 fromTokenId, uint256 toTokenId, uint256 indexed tokenId)

Used to notify listeners that the token is being transferred.

Emitted when tokenId token is transferred from from to to.

Parameters

NameTypeDescription
from indexedaddressAddress of the previous immediate owner, which is a smart contract if the token was nested.
to indexedaddressAddress of the new immediate owner, which is a smart contract if the token is being nested.
fromTokenIduint256ID of the previous parent token. If the token was not nested before, the value should be 0
toTokenIduint256ID of the new parent token. If the token is not being nested, the value should be 0
tokenId indexeduint256ID of the token being transferred