I have an event with the signature Event(address, uint256, string) which my smart contract emit from time to time. I am testing said contract on a ganache test net where when the Ganache picks up these events, it decodes them perfectly. Yet when I try to decode the abi encoding of said event using the rpc-json response there seems to be something wrong with the encoding even though everything else (tx-hash etc.) lines up:
I tested with address being 0xa96403a52c4b63fefda2f24734a7c1f69a36b24a, the uint256 being 1 and the string being hello and get this result:
0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000568656c6c6f000000000000000000000000000000000000000000000000000000
This is the uint256 which is 1:
0x0000000000000000000000000000000000000000000000000000000000000001
I don't know what this is:
0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000
This is the length of the string, followed by the utf8 encoding of "hello", correctly by 27 bytes of padding to make it 32 bytes in total:
568656c6c6f000000000000000000000000000000000000000000000000000000
Could anyone help me out in decoding the address here and correct me in case I did something wrong decoding the other stuff? Thank you so much in advance!
address
parameter in your event isindexed
? If yes, then it's not going to be provided in thedata
field, but in thetopics
array at the 2nd entry (i.e.,topics[1]
).