Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PFP18 关于墨客的abi decode/encode #19

Closed
AnFengDe opened this issue Aug 15, 2019 · 2 comments
Closed

PFP18 关于墨客的abi decode/encode #19

AnFengDe opened this issue Aug 15, 2019 · 2 comments
Labels
help wanted/需要关注 Extra attention is needed Paid/已付 Good for newcomers

Comments

@AnFengDe
Copy link
Collaborator

先看下这个网站 : https://abi.hashex.org/# 这是一个俄罗斯码农搞的,不过没有github库,也没有找到原始代码

简单说这个网站可以接收合约的abi定义,然后让用户选中具体方法后,填写参数,形成签名需要的数据载荷 payload

和abi解析相关的有 https://github.com/ethereumjs/ethereumjs-abihttps://github.com/ConsenSys/abi-decoder

ethereumjs-abi : 根据abi定义,decode 和 encode函数方法以及其参数

abi-decoder : 除了上述功能,还能解析Transaction receipt的事件日志


我想要的是

  • 能解析abi
  • 能根据方法名字自动找出需要的参数,并且按照规定的格式encode
  • 解析日志

和上面介绍的开源代码区别在哪呢,他们的方法都是用户作为参数放进去的,而我想用abi定义,自动放进去,还有就是用typescript来写

@AnFengDe AnFengDe added help wanted/需要关注 Extra attention is needed question/讨论中 Further information is requested labels Aug 15, 2019
@AnFengDe
Copy link
Collaborator Author

AnFengDe commented Aug 18, 2019

在Java里面,这个就是Call by name或者反射机制就可以,我们在ts的上下文里面,来推导一下业务流程

  • 解析abi,形成自己的数据结构 工数 0
  • 可以列出和查询函数名 工数 1
  • 可以罗列和查询函数的参数和类型 工数 2
  • 根据函数名、参数组合,encode和decode,形成data。工数 3 (此处需要考虑参数类型的转换)
  • 解析Transaction event 2

如果细节清楚,考虑到单元测试和构建开发环境,工数不会超过10个工作日

jcc-moac-abi 版本库

@AnFengDe AnFengDe added Waiting for review/等待投票 Something isn't working in progress/进行中 in progress Paid/已付 Good for newcomers and removed Waiting for review/等待投票 Something isn't working labels Aug 18, 2019
@AnFengDe
Copy link
Collaborator Author

AnFengDe commented Aug 23, 2019

@AnFengDe AnFengDe removed the question/讨论中 Further information is requested label Aug 24, 2019
@AnFengDe AnFengDe removed the in progress/进行中 in progress label Sep 1, 2019
@AnFengDe AnFengDe closed this as completed Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted/需要关注 Extra attention is needed Paid/已付 Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant