Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

InternalTrait

Fully qualified path: openzeppelin_token::erc721::extensions::erc721_enumerable::erc721_enumerable::ERC721EnumerableComponent::InternalTrait

pub trait InternalTrait<TContractState, +HasComponent<TContractState>, impl ERC721: HasComponent<TContractState>, impl ERC721HooksTrait<TContractState>: ERC721HooksTrait<TContractState>, impl SRC5: HasComponent<TContractState>, +Drop<TContractState>>

Trait functions

initializer

Initializes the contract by declaring support for the IERC721Enumerable interface id.

Fully qualified path: openzeppelin_token::erc721::extensions::erc721_enumerable::erc721_enumerable::ERC721EnumerableComponent::InternalTrait::initializer

fn initializer(ref self: ComponentState<TContractState>)

before_update

Updates the ownership and token-tracking data structures.

When a token is minted (or burned), token_id is added to (or removed from) the token-tracking structures.

When a token is transferred, minted, or burned, the ownership-tracking data structures reflect the change in ownership of token_id.

This must be added to the implementing contract’s ERC721HooksTrait::before_update hook.

Fully qualified path: openzeppelin_token::erc721::extensions::erc721_enumerable::erc721_enumerable::ERC721EnumerableComponent::InternalTrait::before_update

fn before_update(ref self: ComponentState<TContractState>, to: ContractAddress, token_id: u256)

all_tokens_of_owner

Returns a list of all token ids owned by the specified owner. This function provides a more efficient alternative to calling ERC721::balance_of and iterating through tokens with ERC721Enumerable::token_of_owner_by_index.

Requirements:

  • owner is not the zero address.

Fully qualified path: openzeppelin_token::erc721::extensions::erc721_enumerable::erc721_enumerable::ERC721EnumerableComponent::InternalTrait::all_tokens_of_owner

fn all_tokens_of_owner(self: @ComponentState<TContractState>, owner: ContractAddress) -> Span<u256>

_add_token_to_owner_enumeration

Adds token to this extension’s ownership-tracking data structures.

Fully qualified path: openzeppelin_token::erc721::extensions::erc721_enumerable::erc721_enumerable::ERC721EnumerableComponent::InternalTrait::_add_token_to_owner_enumeration

fn _add_token_to_owner_enumeration(
    ref self: ComponentState<TContractState>, to: ContractAddress, token_id: u256,
)

_add_token_to_all_tokens_enumeration

Adds token to this extension’s token-tracking data structures.

Fully qualified path: openzeppelin_token::erc721::extensions::erc721_enumerable::erc721_enumerable::ERC721EnumerableComponent::InternalTrait::_add_token_to_all_tokens_enumeration

fn _add_token_to_all_tokens_enumeration(ref self: ComponentState<TContractState>, token_id: u256)

_remove_token_from_owner_enumeration

Removes a token from this extension’s ownership-tracking data structures.

This has O(1) time complexity but alters the indexed order of owned-tokens by swapping token_id and the index thereof with the last token id and the index thereof.

Fully qualified path: openzeppelin_token::erc721::extensions::erc721_enumerable::erc721_enumerable::ERC721EnumerableComponent::InternalTrait::_remove_token_from_owner_enumeration

fn _remove_token_from_owner_enumeration(
    ref self: ComponentState<TContractState>, from: ContractAddress, token_id: u256,
)

_remove_token_from_all_tokens_enumeration

Removes token_id from this extension’s token-tracking data structures.

This has O(1) time complexity but alters the indexed order by swapping token_id and the index thereof with the last token id and the index thereof.

Fully qualified path: openzeppelin_token::erc721::extensions::erc721_enumerable::erc721_enumerable::ERC721EnumerableComponent::InternalTrait::_remove_token_from_all_tokens_enumeration

fn _remove_token_from_all_tokens_enumeration(
    ref self: ComponentState<TContractState>, token_id: u256,
)