I have a list of raw log data retrieved from Covalent (https://api.covalenthq.com/v1/137/events/topics/). I know what the event this log corresponds to, but how do I decode it into this event?
It looks like "0x000000000000000000000000000000000000000000000000000000000000002d00000000000000000000000097922d241bd4e4ef4bb0e13693284H8ea75a6c52"
The event is something like
[Event("TokenFound")]
public class TokenFoundEventDTO : IEventDTO
{
[Parameter("uint256", "tokenId", 1, false )]
public BigInteger TokenId { get; set; }
[Parameter("address", "buyer", 2, false )]
public string? Buyer { get; set; }
}
I expected Nethereum to provide something where I can translate that raw log data into an event like this but I cannot find anything like that. Could anyone help guide me to the right thing?
Thanks!
The token id seems to be a uint with 256 bits. That's 32 bytes which make up 64 characters in the hex string. If you trim the starting
0x
and split the remainder in the middle you are left with two 64 character strings.The first one (ending with
"2d"
) should be parsed as aBigInteger
(prepend the0x
again before that) and the second one seems to be the buyer address (maybe strip the leading zeros).