---
eip: 5615
label: ERC-5615
title: ERC-1155 Supply Extension
status: Final
type: Standards Track
category: ERC
created: 2023-05-25
requires: 1155
official: https://eips.ethereum.org/EIPS/eip-5615
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5615.md
canonical: https://eips.huatuo.xyz/eip-5615/
lang: en
tldr: Adds totalSupply(id) and exists(id) to ERC-1155 multi-token contracts, standardising the supply-tracking helpers that OpenZeppelin already shipped.
tags: [token, multi-token, nft, supply, extension]
---

# ERC-5615: ERC-1155 Supply Extension

> A simple mechanism to fetch token supply data from ERC-1155 tokens

**TL;DR:** Adds totalSupply(id) and exists(id) to ERC-1155 multi-token contracts, standardising the supply-tracking helpers that OpenZeppelin already shipped.

## What problem does it solve?

[ERC-1155](/eip-1155/) lets one contract hold many token types, each identified by an `id`. The base standard tells you how much of an `id` a given account holds, but not how many tokens of that `id` exist in total, or whether the `id` is even a real token type.

Marketplaces, explorers and other contracts frequently need those answers: "is this an edition of 100 or of 1?", "has this item been minted yet?". Many implementations, most notably OpenZeppelin's `ERC1155Supply`, already exposed helper functions for this. ERC-5615 writes that existing practice down as a standard so callers can rely on the same two function signatures everywhere.

## How it works

The extension adds two view functions:

| Function | Returns |
| --- | --- |
| `totalSupply(uint256 id)` | Number of tokens of that `id` in circulation; `0` if the id does not exist |
| `exists(uint256 id)` | Whether the id exists, previously existed, or may exist |

`totalSupply` deliberately does not revert for unknown ids; it just returns zero. That leaves an ambiguity, since zero supply can mean "nothing minted yet" or "this id will never be used". `exists` is there to tell those two cases apart, which is why it is phrased loosely ("exists, previously existed, or may exist"): an implementation can return `true` for an id that is reserved but not yet minted, or one that has been fully burned.

The function names mirror `totalSupply` in [ERC-20](/eip-20/) and the existence checks common in [ERC-721](/eip-721/) contracts.

The ERC intentionally does not define an [ERC-165](/eip-165/) interface ID requirement. Implementations may advertise support, but callers must not depend on `supportsInterface` to detect it, because that would break compatibility with the many contracts deployed before the standard was written.

## Sample code

Interface plus a minimal tracking pattern inside mint/burn hooks:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IERC1155Supply {
    function exists(uint256 id) external view returns (bool);
    function totalSupply(uint256 id) external view returns (uint256);
}

abstract contract SupplyTracking is IERC1155Supply {
    mapping(uint256 => uint256) private _supply;

    function totalSupply(uint256 id) public view returns (uint256) {
        return _supply[id];          // 0 for unknown ids, never reverts
    }

    function exists(uint256 id) public view virtual returns (bool) {
        return _supply[id] > 0;      // simplest policy; may be widened
    }

    function _afterMint(uint256 id, uint256 amount) internal {
        _supply[id] += amount;
    }

    function _afterBurn(uint256 id, uint256 amount) internal {
        _supply[id] -= amount;
    }
}
```

Reading supply off-chain (ethers v6):

```ts
import { Contract, JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const multi = new Contract(contractAddress, [
  "function totalSupply(uint256) view returns (uint256)",
  "function exists(uint256) view returns (bool)",
], provider);

const id = 7n;
if (await multi.exists(id)) {
  console.log("edition size:", await multi.totalSupply(id));
}
```

## Things to know

- Status is **Final**. It is designed to be backward compatible with OpenZeppelin's `ERC1155Supply`, so many existing contracts already conform.
- Don't probe for this extension with `supportsInterface`; the spec says consumers must not rely on ERC-165 here. Call the functions directly and handle a revert if the contract lacks them.
- `exists` returning `false` while `totalSupply` is `0` is the clearest signal that an id is unused; `exists` returning `true` with zero supply is legal (reserved or fully burned ids).
- Supply tracking costs extra storage writes on every mint and burn.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-5615
