ERC1155Supply
Inherits: ERC1155
Extension of ERC-1155 that adds tracking of total supply per id. Useful for scenarios where Fungible and Non-fungible tokens have to be clearly identified. Note: While a totalSupply of 1 might mean the corresponding is an NFT, there is no guarantees that no other token with the same id are not going to be minted. NOTE: This contract implies a global limit of 2**256 - 1 to the number of tokens that can be minted. CAUTION: This extension should not be added in an upgrade to an already deployed contract.
State Variables
_totalSupply
mapping(uint256 id => uint256) private _totalSupply;
_totalSupplyAll
uint256 private _totalSupplyAll;
Functions
totalSupply
Total value of tokens in with a given id.
function totalSupply(uint256 id) public view virtual returns (uint256);
totalSupply
Total value of tokens.
function totalSupply() public view virtual returns (uint256);
exists
Indicates whether any token exist with a given id, or not.
function exists(uint256 id) public view virtual returns (bool);
_update
*Transfers a value amount of tokens of type id from from to to. Will mint (or burn) if from
(or to) is the zero address.
Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise.
Requirements:
- If
torefers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. idsandvaluesmust have the same length. NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead.*
function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual override;