Are you tired of having to manually combine all of your files when verifying your contract source on Etherscan? This script automatically traverses the dependency graph and outputs all of your imports in the correct order, ready to be pasted into the contract verifier.
This is also useful for quickly throwing your source into Remix without having to fumble with local filesystem connections.
- Python 3.5+
usage: python solidityflattener source_solidity_file.sol target_solidity_file.sol
Flattens a target Solidity source file by resolving all of its imports and
dependencies. NOTE: This does not work with imports that are aliased (i.e.
import './A.sol' as B; )
To flatten a Solidity file:
python solidityflattener StandardToken.sol StandardTokenFlattened.sol
Pull requests are welcome, or feel free to open an issue to discuss.