From f2b4d63aa14f05efab0bb72efa36e574e7b75166 Mon Sep 17 00:00:00 2001 From: Witek Date: Thu, 8 Nov 2018 20:59:03 -0800 Subject: [PATCH] Automatically merged updates to draft EIP(s) 1155 Hi, I'm a bot! This change was automatically merged because: - It only modifies existing Draft or Last Call EIP(s) - The PR was approved or written by at least one author of each modified EIP - The build is passing --- EIPS/eip-1155.md | 64 ++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 37 deletions(-) diff --git a/EIPS/eip-1155.md b/EIPS/eip-1155.md index 5b26eac8..691d0e8f 100644 --- a/EIPS/eip-1155.md +++ b/EIPS/eip-1155.md @@ -68,22 +68,12 @@ interface ERC1155 /* is ERC165 */ { /** @dev MUST emit when adding an approval scope */ - event AddIdToScope(bytes32 indexed _scope, uint256 indexed _id); + event AddToScope(bytes32 indexed _scope, uint256 indexed _startId, uint256 indexed _endId); /** @dev MUST emit when removing an existing approval scope */ - event RemoveIdFromScope(bytes32 indexed _scope, uint256 indexed _id); - - /** - @dev MUST emit when adding a range approval scope - */ - event AddRangeToScope(bytes32 indexed _scope, uint256 indexed _startId, uint256 indexed _endId); - - /** - @dev MUST emit when removing an existing range approval scope - */ - event RemoveRangeFromScope(bytes32 indexed _scope, uint256 indexed _startId, uint256 indexed _endId); + event RemoveFromScope(bytes32 indexed _scope, uint256 indexed _startId, uint256 indexed _endId); /** @dev Emits when the URI is updated for a token ID. @@ -174,6 +164,31 @@ ERC-1155 contracts must therefore carefully emit Transfer events in any instance The URI value allows for ID substitution by clients. If the string {id} exists in any URI, clients MUST replace this with the actual token ID. This allows for large number of tokens to use the same on-chain string by defining a URI once, for a large collection of tokens. Example of such a URI: `https://token-cdn-domain/{id}.json` +### Metadata Extensions + +The following optional extensions can be identified with the (ERC-165 Standard Interface Detection)[https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md]. + +Changes to the URI or Name MUST emit their corresponding events if the change can be expressed with an event. If the optional ERC1155Metadata_URI or ERC1155Metadata_Name extensions are included, the values returned by these functions SHOULD be used to retrieve values for which no event was emitted. The functions MUST return the same value as the event if it was emitted. + +```solidity +interface ERC1155Metadata_URI { + /** + @notice A distinct Uniform Resource Identifier (URI) for a given token + @dev URIs are defined in RFC 3986 + @return URI string + */ + function uri(uint256 _id) external view returns (string); +} + +interface ERC1155Metadata_Name { + /** + @notice A human-readable name for a given token + @return Name string + */ + function name(uint256 _id) external view returns (string); +} +``` + ### ERC-1155 Metadata URI JSON Schema This JSON schema is loosely based on the "ERC721 Metadata JSON Schema", but includes optional formatting to allow for ID substitution by clients. If the string {id} exists in any JSON value, it MUST be replaced with the actual token ID, by all client software that follows this standard. @@ -232,31 +247,6 @@ An example of an ERC-1155 Metadata JSON file follows. The properties array propo } ``` -### Metadata Extensions - -The following optional extensions can be identified with the (ERC-165 Standard Interface Detection)[https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md]. - -Changes to the URI or Name MUST emit their corresponding events if the change can be expressed with an event. If the optional ERC1155Metadata_URI or ERC1155Metadata_Name extensions are included, the values returned by these functions SHOULD be used to retrieve values for which no event was emitted. The functions MUST return the same value as the event if it was emitted. - -```solidity -interface ERC1155Metadata_URI { - /** - @notice A distinct Uniform Resource Identifier (URI) for a given token - @dev URIs are defined in RFC 3986 - @return URI string - */ - function uri(uint256 _id) external view returns (string); -} - -interface ERC1155Metadata_Name { - /** - @notice A human-readable name for a given token - @return Name string - */ - function name(uint256 _id) external view returns (string); -} -``` - ## ERC-1155 Token Receiver Smart contracts **MUST** implement this interface to accept safe transfers.