I'd like to have a better understanding of events and logs data, more specifically when it comes to interacting with ERC20 tokens smart contracts and their Transfer events.
I'm looking for a way to extract the transfer value/amount from the returned (transaction) Log struct as described in the rust-web3 documentation.
I understand that from the event log, the topics field has 3 values:
topics[0]is the keccak-256 of theTransfer(address,address,uint256)canonical signature.topics[1]is the value of the _from address.topics[2]is the value of the _to address.
However, I cannot seem to find the ERC20 token transaction value in the returned Log struct or the log or input field as described in this thread and this one.
I suspect I can extract the transfer amount in an ERC20 token transaction from the data field in the events log but I haven’t figured how to do that yet. data is of type Bytes, i.e. a Vec<u8>, a vector of 32 u8.
Thanks.