Skip to main content Link Menu Expand (external link) Document Search Copy Copied

ERC1155SupplyUpgradeable

Extension of ERC1155 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.

Methods

balanceOf

function balanceOf(address account, uint256 id) external view returns (uint256)

See {IERC1155-balanceOf}. Requirements: - account cannot be the zero address.

Parameters

NameTypeDescription
accountaddressundefined
iduint256undefined

Returns

NameTypeDescription
_0uint256undefined

balanceOfBatch

function balanceOfBatch(address[] accounts, uint256[] ids) external view returns (uint256[])

See {IERC1155-balanceOfBatch}. Requirements: - accounts and ids must have the same length.

Parameters

NameTypeDescription
accountsaddress[]undefined
idsuint256[]undefined

Returns

NameTypeDescription
_0uint256[]undefined

exists

function exists(uint256 id) external view returns (bool)

Indicates whether any token exist with a given id, or not.

Parameters

NameTypeDescription
iduint256undefined

Returns

NameTypeDescription
_0boolundefined

isApprovedForAll

function isApprovedForAll(address account, address operator) external view returns (bool)

See {IERC1155-isApprovedForAll}.

Parameters

NameTypeDescription
accountaddressundefined
operatoraddressundefined

Returns

NameTypeDescription
_0boolundefined

safeBatchTransferFrom

function safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] amounts, bytes data) external nonpayable

See {IERC1155-safeBatchTransferFrom}.

Parameters

NameTypeDescription
fromaddressundefined
toaddressundefined
idsuint256[]undefined
amountsuint256[]undefined
databytesundefined

safeTransferFrom

function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes data) external nonpayable

See {IERC1155-safeTransferFrom}.

Parameters

NameTypeDescription
fromaddressundefined
toaddressundefined
iduint256undefined
amountuint256undefined
databytesundefined

setApprovalForAll

function setApprovalForAll(address operator, bool approved) external nonpayable

See {IERC1155-setApprovalForAll}.

Parameters

NameTypeDescription
operatoraddressundefined
approvedboolundefined

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)

See {IERC165-supportsInterface}.

Parameters

NameTypeDescription
interfaceIdbytes4undefined

Returns

NameTypeDescription
_0boolundefined

totalSupply

function totalSupply(uint256 id) external view returns (uint256)

Total amount of tokens in with a given id.

Parameters

NameTypeDescription
iduint256undefined

Returns

NameTypeDescription
_0uint256undefined

uri

function uri(uint256) external view returns (string)

See {IERC1155MetadataURI-uri}. This implementation returns the same URI for *all token types. It relies on the token type ID substitution mechanism https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. Clients calling this function must replace the \{id\} substring with the actual token type ID.*

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
_0stringundefined

Events

ApprovalForAll

event ApprovalForAll(address indexed account, address indexed operator, bool approved)

Emitted when account grants or revokes permission to operator to transfer their tokens, according to approved.

Parameters

NameTypeDescription
account indexedaddressundefined
operator indexedaddressundefined
approvedboolundefined

Initialized

event Initialized(uint8 version)

Triggered when the contract has been initialized or reinitialized.

Parameters

NameTypeDescription
versionuint8undefined

TransferBatch

event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)

Equivalent to multiple {TransferSingle} events, where operator, from and to are the same for all transfers.

Parameters

NameTypeDescription
operator indexedaddressundefined
from indexedaddressundefined
to indexedaddressundefined
idsuint256[]undefined
valuesuint256[]undefined

TransferSingle

event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)

Emitted when value tokens of token type id are transferred from from to to by operator.

Parameters

NameTypeDescription
operator indexedaddressundefined
from indexedaddressundefined
to indexedaddressundefined
iduint256undefined
valueuint256undefined

URI

event URI(string value, uint256 indexed id)

Emitted when the URI for token type id changes to value, if it is a non-programmatic URI. If an {URI} event was emitted for id, the standard https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that value will equal the value returned by {IERC1155MetadataURI-uri}.

Parameters

NameTypeDescription
valuestringundefined
id indexeduint256undefined

Back to top

Copyright © Guardians Of The Ball. This site is powered by Gitlab Pages