1

I would like to be able to call all the addresses for a specific tokenId in an ERC1155 contract in order to airdrop those with a specific token. I know ERC721 has the function ownerof to allow for this, is there an equivalent for ERC1155?

1 Answer 1

2

There is no function for this on ERC1155.

Because a token is not necessarily unique, it can have multiple owners.

Same as ERC20 there is no function to list all the holders.

On ERC1155 _balances mapping is like this:

mapping(uint256 => mapping(address => uint256)) private _balances;

Simple representation:

TokenID => holder => amountOfTokenID

For one TokenID you can have multiple holders

To answer your question: It is not possible to retrieve this information from the smart contract.

However, it is possible to get this information off-chain using events with the right logic / filters

Or via TheGraph.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.