ERC-5615: ERC-1155 Supply Extension
ERC-1155 specifies fungible / multi-token semantics but omits a canonical supply query. Exchanges, indexers, and per-token analytics need to know "how many of tokenId N exist?" — without ERC-5615 every implementation rolled its own (totalSupply(uint256), tokenSupply(uint256), circulatingSupply(uint256), etc.). ERC-5615 picks one signature so off-chain tools can query supply uniformly.
Required Interface
interface IERC5615 {
function totalSupply() external view returns (uint256);
function totalSupply(uint256 id) external view returns (uint256);
function exists(uint256 id) external view returns (bool);
}The collection-wide totalSupply() returns the sum across all tokenIds; the per-id totalSupply(id) returns supply of a specific tokenId; exists(id) is a cheap boolean for whether the tokenId has ever been minted.
Neo Equivalent: NEP-11 Divisible + Per-tokenId Supply Tracking
NEP-11 divisible (the multi-token-per-contract NEP-11 variant) doesn't mandate per-tokenId supply either. The Neo port adds the supply-tracking storage during mint / burn:
public static BigInteger TotalSupplyOf(ByteString tokenId)
=> (BigInteger)(Storage.Get(Storage.CurrentContext, SupplyKey(tokenId)) ?? ByteString.Empty);
public static bool Exists(ByteString tokenId)
=> Storage.Get(Storage.CurrentContext, SupplyKey(tokenId)) is not null;
// Nep11Token<T> base has no virtual hooks; expose public Mint / Burn wrappers
// that update the per-tokenId supply alongside the base storage operations.
public static void Mint(UInt160 to, ByteString tokenId, BigInteger amount)
{
if (!Runtime.CheckWitness(GetAdmin())) throw new Exception("NEP11:NotAdmin");
Storage.Put(Storage.CurrentContext, SupplyKey(tokenId), TotalSupplyOf(tokenId) + amount);
Mint(tokenId, new TokenState { Owner = to }); // base NEP-11 mint
}
public static void Burn(UInt160 from, ByteString tokenId, BigInteger amount)
{
if (!Runtime.CheckWitness(from)) throw new Exception("NEP11:NoAuth");
var newSupply = TotalSupplyOf(tokenId) - amount;
if (newSupply == 0) Storage.Delete(Storage.CurrentContext, SupplyKey(tokenId));
else Storage.Put(Storage.CurrentContext, SupplyKey(tokenId), newSupply);
Burn(tokenId); // base NEP-11 burn
}| ERC-5615 (Ethereum) | Neo Equivalent | Notes |
|---|---|---|
totalSupply() (collection-wide) | TotalSupply() inherited from NEP-11 base | NEP-11 base already has this |
totalSupply(id) | TotalSupplyOf(tokenId) view | Added per-token field |
exists(id) | Exists(tokenId) view | Boolean shortcut |
Composition
- ERC-1155 — base. ERC-5615 closes the supply-query gap.
- ERC-6909 — minimal multi-token. Same supply-query gap exists in 6909; the same Neo pattern fits.
- ERC-7160 — multi-metadata. Per-tokenId supply pairs with per-tokenId metadata for indexer-friendly queries.
Migration Notes
Three line addition to any divisible NEP-11 contract: track supply per tokenId on every Mint / Burn and expose the view. Indexer tools can adopt the standard query immediately.
