Skip to content
Lattice

ERC721Enumerable

Git Source

Inherits: IERC721Enumerable

Title: ERC721Enumerable

Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/ERC721Enumerable.sol)

Stateless Diamond facet for the EIP-721 enumeration extension. Pure delegator to ERC721EnumerableLib.

Under the 0.5.0 token hook model (D25, option (a)) the base ERC721Lib has no hook, so this facet ADDS the three enumeration views and REPLACES the base movement selectors (transferFrom and both safeTransferFrom overloads) with versions that keep the lists in step. DeployERC721Enumerable cuts it. MUTUAL EXCLUSIONS (one ERC-721 movement override per diamond):

Notes:

  • lattice-version: 0.5.0
  • lattice-source: OpenZeppelin v5.6.1

Functions

totalSupply

The number of tokens in existence.

function totalSupply() public view virtual returns (uint256);

Returns

NameTypeDescription
<none>uint256

tokenOfOwnerByIndex

The id of the token at index of owner's token list. Use with balanceOf to enumerate them.

function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256);

Parameters

NameTypeDescription
owneraddress
indexuint256

Returns

NameTypeDescription
<none>uint256

tokenByIndex

The id of the token at index of all tokens. Use with totalSupply to enumerate them.

function tokenByIndex(uint256 index) public view virtual returns (uint256);

Parameters

NameTypeDescription
indexuint256

Returns

NameTypeDescription
<none>uint256

transferFrom

Transfers tokenId from from to to, updating the enumeration (replaces the base transferFrom).

function transferFrom(address from, address to, uint256 tokenId) public virtual;

Parameters

NameTypeDescription
fromaddress
toaddress
tokenIduint256

safeTransferFrom

Safely transfers tokenId, updating the enumeration (replaces the base safeTransferFrom).

function safeTransferFrom(address from, address to, uint256 tokenId) public virtual;

Parameters

NameTypeDescription
fromaddress
toaddress
tokenIduint256

safeTransferFrom

Safely transfers tokenId with data, updating the enumeration (replaces the base safeTransferFrom).

function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) public virtual;

Parameters

NameTypeDescription
fromaddress
toaddress
tokenIduint256
databytes

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect ERC721Enumerable methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: safeTransferFrom(address,address,uint256) 0x42842e0e safeTransferFrom(address,address,uint256,bytes) 0xb88d4fde tokenByIndex(uint256) 0x4f6ccce7 tokenOfOwnerByIndex(address,uint256) 0x2f745c59 totalSupply() 0x18160ddd transferFrom(address,address,uint256) 0x23b872dd

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes