Docs

ERC1155Supply

import "@thirdweb-dev/contracts/eip/interface/IERC721Supply.sol"

View all of the NFTs on the contract by implementing the totalSupply function in your ERC1155 contract.


View on GitHub

Usage

This is an example smart contract demonstrating how to inherit from this extension and override the functions to add (optional) custom functionality.

The ERC1155Drop contract comes with a totalSupply function that returns the total number of NFTs that have been minted in the collection (including tokens that have been burned).

This means you can already view the total supply of NFTs in the collection by implementing the ERC1155Base contract.

You can optionally override the functionality of this function as outlined below:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@thirdweb-dev/contracts/base-contracts/ERC71155Base.sol";

contract Contract is ERC1155Base {
    constructor(
        string memory _name,
        string memory _symbol
    )
        ERC1155Base(
            _name,
            _symbol
        )
    {}

    function totalSupply() public view override returns (uint256) {
        // Your custom implementation here (overriding this function is optional)
    }

}

Base Contracts Implementing This Extension