I was able to use the EtherScan api to get an array with event logs. Now I need to read from the data stored inside.
The event data exists out of: uint256, uint256, uint256, address, address, string.
I can do the following web3 function:
web3.utils.hexToNumber(hex) for the uint's and hexToUtf8 for the strings.
However I have 2 problems:
- There's no web3 function
hexToAddress. How can I do this? - I'm not sure how to split the event data with a web3 function or other method.
This is an example of the event data:
"0x000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000078f1859239df5000000000000000000000000047f606fd5b2baa5f5c6c4ab8958e45cb6b054b70000000000000000000000001c7e7127a73162b134ab807c3e9f226cd5fd112800000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000084032326c6f6f7073000000000000000000000000000000000000000000000000"
throw new Error('Couldn\'t decode '+ name +' from ABI: 0x'+ param.rawValue);any idea? – mesqueeb May 25 '18 at 09:14