2021年11月

npm install -g truffle-flattener

because some new features in solidity 0.8.x might go wrong by truffle-flattener@1.5.0, so after installed, run code below again:

inpm nstall -g https://github.com/jplew/truffle-flattener

usage:

truffle-flattener ./contracts/MyContract.sol > ./flatten/MyContractFlatten.sol

and then put faltten code as single solidity file to bscscan