ERC721Enumerable
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):
- ERC721Pausable and ERC721Votes replace the same selectors (pinned by SelectorCompatibilityTest).
- ERC721Burnable and ERC721Wrapper mint and burn through ERC721Lib, which skips the lists, so neither may share a diamond with this facet (pinned by CompositionHazardsTest). A mint, burn or authorization-free transfer facet for an enumerable diamond calls ERC721EnumerableLib instead, never ERC721Lib.
- Batch mints (ERC721ConsecutiveInit) skip the lists; either init order reverts
ERC721EnumerableForbiddenBatchMint, as OpenZeppelin forbids the pair.
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
| Name | Type | Description |
|---|---|---|
| <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
| Name | Type | Description |
|---|---|---|
| owner | address | |
| index | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <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
| Name | Type | Description |
|---|---|---|
| index | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <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
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address | |
| tokenId | uint256 |
safeTransferFrom
Safely transfers tokenId, updating the enumeration (replaces the base safeTransferFrom).
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual;Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address | |
| tokenId | uint256 |
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
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address | |
| tokenId | uint256 | |
| data | bytes |
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
| Name | Type | Description |
|---|---|---|
| selectors | bytes |