tips:
1. 合約的驗證必須要求科學上網(wǎng).
2. 如果合約的構(gòu)造函數(shù)需要傳入?yún)?shù),則必須要求輸入合約的ABI
3. 編輯器版本必須正確選擇.
4. 驗證的代碼不支持import語句.
以下介紹2種將代碼扁平化的工具,即去除import.
SolidityFlattery
由于我的是MAC OS系統(tǒng),比較討厭去更改自帶Python的版本,所以我建議用這種方式.
Requirements
Golang的環(huán)境
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