I am reading the transfer events that occur on the blockchain and have posted the result I get back. My question is how to read the to and from addresses from this data?
This is the event abi:
Transfer(address,address,uint256)
Is that info in the topics field?
AttributeDict({'address': '0x2B9a49417F9c9c8Dd18EF5bb37c20637441Ad67a', 'topics': [HexBytes('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'), HexBytes('0x000000000000000000000000dca0a91797bf8a291aa2b02d8d9ce581d90db2bf'), HexBytes('0x000000000000000000000000d563ace91e2748338fed2e170f588c0aed6d087b')], 'data': HexBytes('0x00000000000000000000000000000000000000000002801cad436a90586c431e'), 'blockNumber': 17266903, 'transactionHash': HexBytes('0x16c1191e97b3944b72104db5d3455632a899861c6e121bd59dd33e90b6e35a66'), 'transactionIndex': 0, 'blockHash': HexBytes('0x826d97e893316fc0bf6458521a3c75bf08d8e94a4c7f0e6c0f1c4c7eff2f2792'), 'logIndex': 0, 'removed': False})
You can decode events from receipt logs using the method:
# Construct your Contract proxy instance from ABI
myContract = ...
# Decode all Transfer events in a transaction receipt
myContract.events.Transfer.process_log(tx_receipt)
This allows you to read the log fields in ABI-decoded form.
Some examples of using process_log here (for a different event).