From 26ea0d7d22e35b1fe495ca245296fa781981650c Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Thu, 19 Oct 2023 12:42:03 -0700 Subject: [PATCH] add "UniformValue" events --- EIPS/eip-7496.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/EIPS/eip-7496.md b/EIPS/eip-7496.md index 68ecf1b050cb39..32611f4a4d5821 100644 --- a/EIPS/eip-7496.md +++ b/EIPS/eip-7496.md @@ -23,14 +23,16 @@ Trait values for non-fungible tokens are often stored offchain. This makes it di The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174. -Contracts implementing this EIP MUST include the events, getters, and setters as defined below, and MUST return `true` for [ERC-165](./eip-165.md) `supportsInterface` for `0x12345678(placeholder, to be set when finalized)`, the 4 byte `interfaceId` for this ERC. +Contracts implementing this EIP MUST include the events, getters, and setters as defined below, and MUST return `true` for [ERC-165](./eip-165.md) `supportsInterface` for `0xaf332f3e`, the 4 byte `interfaceId` for this ERC. ```solidity -interface IERC7496 { +interface IERC7496 is IERC165 { /* Events */ event TraitUpdated(bytes32 indexed traitKey, uint256 tokenId, bytes32 traitValue); - event TraitUpdatedBulkRange(bytes32 indexed traitKey, uint256 fromTokenId, uint256 toTokenId, bytes32 traitValue); - event TraitUpdatedBulkList(bytes32 indexed traitKey, uint256[] tokenIds, bytes32 traitValue); + event TraitUpdatedRange(bytes32 indexed traitKey, uint256 fromTokenId, uint256 toTokenId); + event TraitUpdatedRangeUniformValue(bytes32 indexed traitKey, uint256 fromTokenId, uint256 toTokenId, bytes32 traitValue); + event TraitUpdatedList(bytes32 indexed traitKey, uint256[] tokenIds); + event TraitUpdatedListUniformValue(bytes32 indexed traitKey, uint256[] tokenIds, bytes32 traitValue); event TraitMetadataURIUpdated(); /* Getters */ @@ -163,13 +165,19 @@ The `dataType` object MAY have a `valueMappings` object defined. If the `valueMa ### Events -Updating traits MUST either emit the `TraitUpdated`, `TraitUpdatedBulkRange` or `TraitUpdatedBulkList` event. +Updating traits MUST emit one of: -For the event `TraitUpdatedBulkRange`, the `fromTokenId` and `toTokenId` MUST be a consecutive range of tokens IDs and MUST be treated as an inclusive range. +- `TraitUpdated` +- `TraitUpdatedRange` +- `TraitUpdatedRangeUniformValue` +- `TraitUpdatedList` +- `TraitUpdatedListUniformValue` -For the event `TraitUpdatedBulkList`, the `tokenIds` MAY be in any order. +For the `Range` events, the `fromTokenId` and `toTokenId` MUST be a consecutive range of tokens IDs and MUST be treated as an inclusive range. -For `TraitUpdatedBulkRange` and `TraitUpdatedBulkList`, if the `traitValue` is the same for all updated tokens, it is RECOMMENDED to provide the `traitValue` so offchain indexers don't have to fetch each token ID and can more quickly process bulk updates. If the magic value `keccak256("FETCH_EACH_TRAIT_VALUE")` is provided then the indexers will fetch each token's value individually. +For the `List` events, the `tokenIds` MAY be in any order. + +It is RECOMMENDED to use the `UniformValue` events when the trait value is uniform across all token ids, so offchain indexers can more quickly process bulk updates rather than fetching each trait value individually. Updating the trait metadata URI MUST emit the event `TraitMetadataURIUpdated` so offchain indexers can be notified to query the contract for the latest changes via `getTraitMetadataURI()`.