I need to collect information about token holders.
Here is the token contract, it is proxy(bnb chain): 0x9356f6d95b8e109f4b7ce3e49d672967d3b48383
I see the use of the Mint
method in it, but I don't see such a function in the implementation.
I decided to just take it through bscscan, try to find it manually through balanceOf on the implementation contract, but everything that is written in holders - says 0. So where and how should I get the information, I don't quite understand?
I had a plan like this:
Where am I wrong here, and if I am right, then why doesn't it work?
So I'm trying to get list of holders and amount of holdings from token Contract.
Blockchain explorers (such as BSCScan) and other offchain apps often use indexers that work in this way:
Transfer
event logs emitted by the token contractad 2: Token mint and burn should emit the Transfer
event as well. For mint the sender is address 0; and for burn - the recipient is address 0.
Your approach is different by reading only the current balance at the time of the call to balanceOf()
, which doesn't enable retrieving transaction history nor balance changes per address. And it can produce slightly inaccurate results if some of the balances change during the time you execute the set of calls to balaceOf()
.
If you only want to retrieve current balances, your approach is valid.
If you also need historical balances or list of transfers per address, you can use the approach described above.