如何在C#中解码ETH原始日志数据
我有一个从共价获取的原始日志数据列表()。我知道该日志与之对应的事件,但是如何将其解码到此事件中?
看起来像“ 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000097922D241BD41BD41BD4BD4BBBB0E13693284H8EA”
那
[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; }
}
。谁能帮助我做正确的事?
谢谢!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
令牌ID似乎是带有256位的UINT。这是32个字节,在十六进制字符串中构成64个字符。如果修剪起始
0x
,然后将其余部分拆分,则剩下两个64个字符字符串。第一个(以
“ 2D”
结尾)应解析为biginteger
(在那之前再次准备0x
),第二个似乎是成为买方地址(也许剥夺领先的零)。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).