驗證ETH智能合約

tips:
1. 合約的驗證必須要求科學上網.
2. 如果合約的構造函數需要傳入參數,則必須要求輸入合約的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

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

  • The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...
    網事_79a3閱讀 12,881評論 3 20
  • 七絕~相見歡 程勇 幾載相聚今思量, 奈何距離造離殤。 月照欄桿人獨倚, 舉杯邀月醉成雙。
    夢軒居士閱讀 374評論 0 4
  • 今天是這個班開課的第一講,我們一起來探討一個“振聾發(fā)聵”的問題,畢竟人的本性都是喜歡輕松舒服的事情、抗拒劇烈運動帶...
    理想_2018閱讀 862評論 1 2
  • 新的選擇,新的人生!過去的沒法重來,現(xiàn)在是新的開始,活出精彩的自己!
    羅十二_閱讀 169評論 0 0
  • 最近發(fā)生了很多事, 猝不及防,接踵而至。 等待三天, 沒什么解決不了的。 我好像丟了什么東西, 我應該不曾擁有。 ...
    不知名的胡蘿卜閱讀 354評論 0 0

友情鏈接更多精彩內容