Is there a robust way to index historic total supply for all ERC20 tokens?
For tokens that update total supply through mint and burn (with proper events), this is easily done by tallying up mints and subtracting burns.
However, not all tokens, by a longshot, behave that way.
I figured a way was to tally up all balances of said token over all addresses (excluding the burn address), but this gets me the 'circulating supply' and not the 'total supply'.
In theory I would be able to get the historic 'total supply' by watching traces/state changes but that's a can of worms I don't want to open.
Any other ways?
Best Answer
Short answer: no.
ERC-20 does not specify events for
To add to the complexity rebase tokens do not emit any events when balances and supplies change, as they have dynamic balances and supplies.
Only way is to either
totalSupply
variable as it is a dynamic function.eth_call
JSON-RPC with a historical block identifier.