验证ETH智能合约

tips:
1. 合约的验证必须要求科学上网.
2. 如果合约的构造函数需要传入参数,则必须要求输入合约的ABI
3. 编辑器版本必须正确选择.
4. 验证的代码不支持import语句.

以下介绍2种将代码扁平化的工具,即去除import.

SolidityFlattery

由于我的是MAC OS系统,比较讨厌去更改自带Python的版本,所以我建议用这种方式.

Requirements
Golang的环境

Installation
go get gopkg.in/natefinch/lumberjack.v2
go get github.com/akombalabs/SolidityFlattery
then go to this path->github.com/akombalabs/SolidityFlattery
go install flat.go utils.go

Examples

Assuming that you have the executable on your path :

Assuming your contract is in mainfile.sol and you want to create consolidated.sol

flat -input mainfile.sol -output consolidated

This creates a flattened version of mainfile.sol with all includes in the file consolidated.sol and creates a log called consolidated.log

**NOTE the output file must not exist. This is to prevent you from overwriting that file that you forgot to check into git after a tough night's coding.

Blockcat solidity-flattener

Requirements

Python 3.5+, pip
solc, the Solidity compiler
Note: The NPM version of the compiler does not expose enough functionality to satisfy the requirements of this tool.

Installation
pip install solidity-flattener

Examples

To output to a file instead of standard out:
solidity_flattener --output StandardTokenFlattened.sol StandardToken.sol

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...
    网事_79a3阅读 12,303评论 3 20
  • 七绝~相见欢 程勇 几载相聚今思量, 奈何距离造离殇。 月照栏杆人独倚, 举杯邀月醉成双。
    梦轩居士阅读 333评论 0 4
  • 今天是这个班开课的第一讲,我们一起来探讨一个“振聋发聩”的问题,毕竟人的本性都是喜欢轻松舒服的事情、抗拒剧烈运动带...
    理想_2018阅读 713评论 1 2
  • 新的选择,新的人生!过去的没法重来,现在是新的开始,活出精彩的自己!
    罗十二_阅读 156评论 0 0
  • 最近发生了很多事, 猝不及防,接踵而至。 等待三天, 没什么解决不了的。 我好像丢了什么东西, 我应该不曾拥有。 ...
    不知名的胡萝卜阅读 325评论 0 0