Core
Other
Extension
Token Holder
Token Holder

RMRKTokenHolder

Methods

balanceOfERC20

function balanceOfERC20(address erc20Contract, uint256 tokenId) external view returns (uint256)

Used to retrieve the given token's specific ERC-20 balance

Parameters

NameTypeDescription
erc20ContractaddressThe address of the ERC-20 smart contract
tokenIduint256The ID of the token being checked for ERC-20 balance

Returns

NameTypeDescription
_0uint256The amount of the specified ERC-20 tokens owned by a given token

erc20TransferOutNonce

function erc20TransferOutNonce(uint256 tokenId) external view returns (uint256)

Nonce increased every time an ERC20 token is transferred out of a token

Parameters

NameTypeDescription
tokenIduint256The ID of the token to check the nonce for

Returns

NameTypeDescription
_0uint256The nonce of the token

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

transferERC20ToToken

function transferERC20ToToken(address erc20Contract, uint256 tokenId, uint256 amount, bytes data) external nonpayable

Transfer ERC-20 tokens to a specific token.

The ERC-20 smart contract must have approval for this contract to transfer the ERC-20 tokens.The balance MUST be transferred from the msg.sender.

Parameters

NameTypeDescription
erc20ContractaddressThe address of the ERC-20 smart contract
tokenIduint256The ID of the token to transfer ERC-20 tokens to
amountuint256The number of ERC-20 tokens to transfer
databytesAdditional data with no specified format, to allow for custom logic

transferHeldERC20FromToken

function transferHeldERC20FromToken(address erc20Contract, uint256 tokenId, address to, uint256 amount, bytes data) external nonpayable

Transfer ERC-20 tokens from a specific token.

The balance MUST be transferred from this smart contract.MUST increase the transfer-out-nonce for the tokenIdMUST revert if the msg.sender is not the owner of the NFT or approved to manage it.

Parameters

NameTypeDescription
erc20ContractaddressThe address of the ERC-20 smart contract
tokenIduint256The ID of the token to transfer the ERC-20 tokens from
toaddressundefined
amountuint256The number of ERC-20 tokens to transfer
databytesAdditional data with no specified format, to allow for custom logic

Events

ReceivedERC20

event ReceivedERC20(address indexed erc20Contract, uint256 indexed toTokenId, address indexed from, uint256 amount)

Used to notify listeners that the token received ERC-20 tokens.

Parameters

NameTypeDescription
erc20Contract indexedaddressThe address of the ERC-20 smart contract
toTokenId indexeduint256The ID of the token receiving the ERC-20 tokens
from indexedaddressThe address of the account from which the tokens are being transferred
amountuint256The number of ERC-20 tokens received

TransferredERC20

event TransferredERC20(address indexed erc20Contract, uint256 indexed fromTokenId, address indexed to, uint256 amount)

Used to notify the listeners that the ERC-20 tokens have been transferred.

Parameters

NameTypeDescription
erc20Contract indexedaddressThe address of the ERC-20 smart contract
fromTokenId indexeduint256The ID of the token from which the ERC-20 tokens have been transferred
to indexedaddressThe address receiving the ERC-20 tokens
amountuint256The number of ERC-20 tokens transferred

Errors

InvalidAddress

error InvalidAddress()

InvalidAmountTransferred

error InvalidAmountTransferred()

InvalidValue

error InvalidValue()