solidity-flattener
solidity-flattener copied to clipboard
contracts under openzeppelin are not included
used poa-solidity-flattener
to flatten my contract to upload to etherscan. xxx_flat.sol
was generated successfully but we have some @openzeppelin dependencies, like IERC20
, Context
... were not be included in the final xxx_falt.sol
. Not sure what happened. Here are some messages saying those files are not found in the beginning, but found later. But they are not included in the output file.
{"name":"solidity-flattener","hostname":"kimiwude-mbp.lan","pid":96101,"level":40,"msg":"!!! @openzeppelin/contracts-ethereum-package/contracts/math/SignedSafeMath.sol SOURCE FILE WAS NOT FOUND. I'M TRYING TO FIND IT RECURSIVELY !!!","time":"2020-10-26T07:47:54.428Z","v":0}
{"name":"solidity-flattener","hostname":"kimiwude-mbp.lan","pid":96101,"level":30,"msg":"@openzeppelin/contracts-ethereum-package/contracts/math/SignedSafeMath.sol SOURCE FILE WAS FOUND","time":"2020-10-26T07:47:54.439Z","v":0}
...
{"name":"solidity-flattener","hostname":"kimiwude-mbp.lan","pid":95092,"level":40,"msg":"!!! @openzeppelin/contracts/token/ERC20/IERC20.sol SOURCE FILE WAS NOT FOUND. I'M TRYING TO FIND IT RECURSIVELY !!!","time":"2020-10-26T07:32:36.865Z","v":0}
{"name":"solidity-flattener","hostname":"kimiwude-mbp.lan","pid":95092,"level":30,"msg":"@openzeppelin/contracts/token/ERC20/IERC20.sol SOURCE FILE WAS FOUND","time":"2020-10-26T07:32:36.875Z","v":0}
poa-solidity-flattener version: 3.0.6
build environment: buidler
I @KimiWu123 I have the same issue. Have you already found a solution?
@arnoudcommandeur , no idea how to fix it, we use truffle-flattener
now.
Ok, thanks. @KimiWu123
Hi @KimiWu123, I had some issues using truffle-flattener because my directoryname contained soms special characters. Now I have changed the name to c:\Temp and the truffle-flattener is working. Thanks!
I tried truffle-flattener but it failed.
For this issue, copy the openzepplin's "contracts" directory to ./node_modules/.bin/poa-solidity-flattener then it should work. your contract should look use import with relative path like this: import "./contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol"; It works in this https://github.com/ngduc/flatten-sol
sol-merger
works fine, contrary to this script.
npm install sol-merger -g
sol-merger ./contracts/my.sol ./merged
Thanks @ozh. You solved my problem!
Haha, thanks @ozh! Now, it's too simple.