For example, the contract saves the address when token created but after that token holder could send token or all tokens to another wallet.
Is it possible to find all wallet addresses of token holders which were created by my contract?
All token transfers are performed by calling methods on your contract - so your contract can track balances and accounts in any way it wishes. If you're using the default arrangement of using a Solidity
mapping, you will also need to keep a separate list of known account IDs in an array, so you can iterate over them.
I have created a standalone open source tool which does the same.
Take a token contract address
Iterate over all ERC-20
Transfer events for token using
eth_getLogs JSON-RPC API
Build a local database of these events
Allow you to use SQL to query any account balance on any point of time (block num) - note that some balances may have become zero
There are some quirks here and there: for example detecting mint / creation event for some tokens is not straightforward. Thus, you will may negative balance on the account receiving initial total supply if you rely on
Transfer event only.
You can watch the event as it happens within an app or within the token contract itself use:
mapping (uint => mapping (address => uint)) mappedAccounts;