Skip to content

Commit

Permalink
Update EIP-5615: Move to Review (#5778)
Browse files Browse the repository at this point in the history
* Update EIP-5615: Move to Review

* Fix a few inconsistencies

* Update eip-5615.md

* Revert backwards compatibility change

Co-authored-by: xinbenlv <[email protected]>

* Remove implementation detail

Co-authored-by: xinbenlv <[email protected]>
  • Loading branch information
Pandapip1 and xinbenlv authored Nov 25, 2022
1 parent a3bcb50 commit b0fb1ef
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions EIPS/eip-5615.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: EIP-1155 Supply Extension
description: A simple mechanism to fetch token supply data from EIP-1155 tokens
author: Pandapip1 (@Pandapip1)
discussions-to: https://ethereum-magicians.org/t/eip-5615-eip-1155-supply-extension/10732
status: Draft
status: Review
type: Standards Track
category: ERC
created: 2022-09-07
Expand All @@ -13,35 +13,36 @@ requires: 1155

## Abstract

This EIP introduces a simple mechanism to fetch token supply data from [EIP-1155](./eip-1155.md) tokens that is backward compatible with most existing solutions. It adds a `totalSupply` function, which fetches the total supply of a given token `ID`, and an `exists` function, which checks for the existence of a given token `ID`.
This EIP standardizes an existing mechanism to fetch token supply data from [EIP-1155](./eip-1155.md) tokens. It adds a `totalSupply` function, which fetches the number of tokens with a given `id`, and an `exists` function, which checks for the existence of a given `id`.

## Specification

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

```solidity
interface ERC1155Supply /* is ERC1155 */ {
// @notice This function MUST returns the total supply (number of tokens in circulation) with a given ID if it exists, otherwise it MUST revert
// @param id The ID of which fetch the total supply
// @return The total supply of the given token ID
function totalSupply(uint256 id) external view returns (uint256);
// @notice This function MUST return true if the given token ID exists, otherwise it MUST return false
// @param id The ID of which to check the existence
// @return Whether the given token ID exists or not
interface ERC1155Supply is ERC1155 {
// @notice This function MUST return whether the given token id exists, previously existed, or may exist
// @param id The token id of which to check the existence
// @return Whether the given token id exists, previously existed, or may exist
function exists(uint256 id) external view returns (bool);
// @notice If the given id exists, previously existed, or may exist, this function MUST return the number of tokens with a given id. Otherwise, this function MUST revert.
// @dev This MUST revert if exists(id) returns false
// @param id The token id of which fetch the total supply
// @return The total supply of the given token id
function totalSupply(uint256 id) external view returns (uint256);
}
```

## Rationale

This EIP does not extend [EIP-165](./eip-165.md) as this interface was deemed simple enough that the extra complexity was unnecessary. It would also break backward compatibility with potential existing implementations.
This EIP does not implement [EIP-165](./eip-165.md), as this interface is simple enough that the extra complexity is unnecessary and would cause incompatibilities with pre-existing implementations.

The `totalSupply` and `exists` functions were modeled after [EIP-721](./eip-721.md) and [EIP-20](./eip-20.md).

## Backwards Compatibility

This EIP is backward compatible with the OpenZeppelin `ERC1155Supply`.
This EIP is designed to be backward compatible with the OpenZeppelin `ERC1155Supply`.

## Security Considerations

Expand Down

0 comments on commit b0fb1ef

Please sign in to comment.