I would disagree on the making it easier to read, but that’s a preference thing.
However, splitting up files in smart contract development can be extremely dangerous. People just compiling things they didn’t read and go through is a very, very bad idea. This is probably the biggest security threat we face. Truffle is itself is potentially dangerous in the wrong hands. I know it doesn’t apply to you, but I see very smart people doing very dumb stuff with smart contracts.
Now to preach; smart contracts are about the end user being able to easily read so they can feel secure. That is the only design pattern that should be considered in smart contract development for the foreseeable future, maybe ever. I get that there are advantages in development to the predominant approach, but that’s just because most people come from a more recent development mindset of patterns existing for centralized realms, it doesn’t mean it is a good idea.
Using a single flat file means that licence and import information is removed and makes it harder to read.
Flattening a contract in Truffle or Remix doesn’t remove license details.
e.g. // File: https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC1155/IERC1155.sol
// SPDX-License-Identifier: MIT
When importing via GitHub, you should specify the release tag, otherwise you will get the latest code in the master branch. For OpenZeppelin Contracts you should only use code published in an official release. (see Importing from GitHub in the Remix documentation).
I think you just made the best argument in the world for pushing flattened contracts in the dist folder with versions so we all can live happy, healthy, long lives.
…And to finish with the solution…Remix and Truffle flatteners seem to all mix up the order of OpenZeppelin. It think it’s a simple bug from a library they both share. (Kids love to copy paste things they didn’t read.) I just had to manually reorder the contracts. It works now. I hope this thread saves many hours for anyone in the future trying to compile.