Skip to content

How to generate a flattened contract

Akira Taniguchi edited this page May 25, 2021 · 8 revisions

ツール

結合ファイルはtruffle-flattenerを使って作成する。

準備

npm install truffle-flattener -g

実行手順

必要に応じて下記コマンドを実行してください。

cd protocol
truffle-flattener contracts/src/allocator/Allocator.sol > build/Allocator.flattened.sol
truffle-flattener contracts/src/common/config/AddressConfig.sol > build/AddressConfig.flattened.sol
truffle-flattener contracts/src/dev/Dev.sol > build/Dev.flattened.sol
truffle-flattener contracts/src/dev/DevMinter.sol > build/DevMinter.flattened.sol
truffle-flattener contracts/src/dev/DevMigration.sol > build/DevMigration.flattened.sol
truffle-flattener contracts/src/lockup/Lockup.sol > build/Lockup.flattened.sol
truffle-flattener contracts/src/market/Market.sol > build/Market.flattened.sol
truffle-flattener contracts/src/market/MarketFactory.sol > build/MarketFactory.flattened.sol
truffle-flattener contracts/src/market/MarketGroup.sol > build/MarketGroup.flattened.sol
truffle-flattener contracts/src/metrics/MetricsFactory.sol > build/MetricsFactory.flattened.sol
truffle-flattener contracts/src/metrics/MetricsGroup.sol > build/MetricsGroup.flattened.sol
truffle-flattener contracts/src/policy/PolicyFactory.sol > build/PolicyFactory.flattened.sol
truffle-flattener contracts/src/policy/PolicyGroup.sol > build/PolicyGroup.flattened.sol
truffle-flattener contracts/src/policy/PolicySet.sol > build/PolicySet.flattened.sol
truffle-flattener contracts/src/property/PropertyFactory.sol > build/PropertyFactory.flattened.sol
truffle-flattener contracts/src/property/PropertyGroup.sol > build/PropertyGroup.flattened.sol
truffle-flattener contracts/src/vote/VoteCounter.sol > build/VoteCounter.flattened.sol
truffle-flattener contracts/src/withdraw/Withdraw.sol > build/Withdraw.flattened.sol

Etherscan 登録

(注:画面 UI、Version 番号、アドレス等は予告なく変更される場合があります)

コントラクトアドレスの設定画面で、

Compiler Type->Solidity(Single File)
Compiler Version->0.5.17
License Type->MPL-2.0

を選択する。

登録画面で、

Optimization->yes
Enter the Solidity Contract Code below->作成した結合ファイルの中身を貼り付け
Constructor Arguments-> コンストラクタ引数作成サイト(https://abi.hashex.org/#)等を利用して作成、貼り付け
0000000000000000000000001d415aa39d647834786eb9b5a333a50e9935b796 とか
0000000000000000000000001d415aa39d647834786eb9b5a333a50e9935b7960000000000000000000000004596dae6955693c50522f1b06bdbf7b93ceb5479 とか
000000000000000000000000d6d07f1c048bdf2b3d5d9b6c25ed1fc5348d0a70 みたいに
上は本番環境、下はropsten