Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update EIP-5615: Move to Review #5778

Merged
merged 6 commits into from
Nov 25, 2022
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,33 +13,34 @@ 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.

## 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