I am creating an app that has various imports that require two different versions of solidity. AragonOS(0.4.x) and openzeppelin(0.5.x)
Of course, there are breaking changes in 0.5.x so my question is this. Is it possible to tell truffle to compile some contracts with a different compiler than others within the same project? If not how could I get around this problem
Best Answer
EDIT: I recommend using Buidler! The key feature their software provides is modularity, where compilation and testing of contracts can be done separately. Migration from Truffle is also seamless, as specified in their guide.
What you can do is to specify 2 separate configuration files for compilation of your v4 and v5 contracts, then use the
--config
flag.For testing, use the
--no-compile
flag to skip contract compilation.Example:
./contracts/v4
folder./contracts/v5
folder./test
folder1) Specify a
configV4.js
file with the following code:2) Specify a
configV5.js
file with the following code:3) Compile your v4 contracts:
npx buidler compile --config configV4.js
4) Compile your v5 contracts:
npx buidler compile --config configV5.js
5) For testing, you can specify yet another file
configTest.js
, or combine the settings in either config file mentioned above.6) Test your contracts:
npx buidler test --no-compile --config configTest.js