OpenZeppelin / openzeppelin-sdk

OpenZeppelin SDK repository for CLI and upgrades.js. No longer actively developed.
MIT License
431 stars 200 forks source link

Set compiler options not working with OpenZeppelin/cli init() script #1565

Open maxweng opened 4 years ago

maxweng commented 4 years ago

For version 2.8.2, I created a ProjectFile() object, and was able to successfully set the compiler options with ProjectFile.setCompilerOptions().

But it doesn't actually get written to the project.json file when passing that ProjectFile object to the OpenZeppelin/cli init() script.

abcoathup commented 4 years ago

Hi @maxweng,

Can you provide more information on why you are trying to do?

You can specify the compiler version with the CLI and it will be saved in project.json

$ npx oz compile --solc-version v0.6.8
maxweng commented 4 years ago

That's part of my deployment script, because I need to write project settings based on different testnet. So what I have been doing is in my deploy script, to create a ProjectFile object so I can pass it to the init() function from OpenZeppelin/cli to write to the project.json file.

It worked like a charm for previous CLI versions, but stopped working after upgraded to v2.8.2. I know that I can specify those options as command arguments, but that's outside of my deploy script. The fix I have now is, in my deploy script, I call init() to create the project settings file, then set the ProjectFile object, and call ProjectFile.write(). It works for me. But I think there're still logic issues in your init() script.

Hope that helps to troubleshoot.

abcoathup commented 4 years ago

Hi @maxweng ! I’m sorry that you had this issue.

Thanks so much for reporting it! The project owner will review and triage this issue as soon as they can.

I'm glad that you have a workaround. Alternatively you could try using an earlier version of the CLI, such as v2.7.2 which was prior to the inclusion of regular deploys