验证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

你可能感兴趣的:(验证ETH智能合约)