I'm wondering when you should consider that a transfer of ERC-20 tokens is confirmed. At the beginning I thought that just making sure the transaction calling
transfer is confirmed successfully was enough, but then I started to think that maybe I should wait for the
Transfer event instead.
I've seen that most tokens out there just emit the
Transfer event right there inside of the
transfer function. However let's suppose the following contract:
- User A calls the
transferfunction to transfer tokens to address B
transferfunction sends an event to ask for validation of user B
transferfunction will be completed at this point, but tokens haven't been transferred yet and the
Transferevent is not triggered either
- Someone validates user B and calls another function in the contract that completes the initial transaction (tokens are moved)
Transferevent is triggered now, indicating that the transfer has been completed
In this case, the correct thing to do would be to wait for the
Transfer event to confirm a transaction of tokens, because just waiting for the confirmation of the transaction calling the
transfer function is not enough.
However I'm not sure if that's what ERC-20 specification says and what most tools that work with ERC-20 tokens expect. So my questions is if it is fine to create a token where the confirmation of the transfer is done when the
Transfer event is triggered instead of when the transaction to call
transfer is confirmed.