ERC-721 Enumerable Burn Module
Destroys ERC-721 tokens and removes them from enumeration
- Exposes an
internalfunction for burning tokens. - Integrates with diamond storage to remove tokens from enumeration.
- Emits a
Transferevent upon successful burning. - Does not perform approval checks; relies on the calling facet for this.
This module provides internal functions for use in your custom facets. Import it to access shared logic and storage.
Overview
This module provides an internal function to burn ERC-721 tokens, removing them from enumeration tracking. Facets can integrate this module to handle token destruction directly within the diamond's shared storage. This ensures that token removal is consistent across all facets interacting with the ERC-721 state.
Storage
ERC721EnumerableStorage
storage-location: erc8042:erc721.enumerable
ERC721Storage
storage-location: erc8042:erc721
State Variables
| Property | Type | Description |
|---|---|---|
STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("erc721.enumerable")) |
ERC721_STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("erc721")) |
Functions
burn
Burns (destroys) a token, removing it from enumeration tracking. This module does not check for approval. Use the facet for approval-checked burns.
Parameters:
| Property | Type | Description |
|---|---|---|
_tokenId | uint256 | The ID of the token to burn. |
getERC721Storage
Returns a pointer to the ERC-721 storage struct. Uses inline assembly to access the storage slot defined by STORAGE_POSITION.
Returns:
| Property | Type | Description |
|---|---|---|
s | ERC721Storage | The ERC721Storage struct in storage. |
getStorage
Returns the storage struct used by this facet.
Returns:
| Property | Type | Description |
|---|---|---|
s | ERC721EnumerableStorage | The ERC721Enumerable storage struct. |
Events
Errors
Best Practices
- Call
burnonly after verifying token ownership and necessary approvals within the calling facet. - Ensure the calling facet correctly handles the
Transferevent emitted by this module. - Verify that the diamond's storage layout is compatible when upgrading facets that interact with this module.
Integration Notes
This module interacts with diamond storage at the STORAGE_POSITION defined by keccak256("erc721.enumerable"). The burn function modifies the ERC721EnumerableStorage struct, ensuring that burned tokens are no longer tracked in enumeration. Changes to this shared storage are immediately visible to all facets operating within the same diamond.