wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.2k stars 296 forks source link

Pass command line arguments to deploy task #255

Open omriperl opened 2 years ago

omriperl commented 2 years ago

Hi, Currently it is possible to define CLI arguments for a hardhat script. This feature doesn't seem to be supported in hardhat deploy and would be extremely useful. For example: different networks will require different parameters for the contract constructor (such as addresses) and I don't want these to be committed to my repo but to be dynamically taken when running the deploy script

Thanks :)

tuler commented 2 years ago

You can still write your own hardhat tasks that calls hre.run("deploy"), and define params in your task.

However, you should reconsider to commit configuration to git, because reproducible deploys are important. The deploy "script" should be idempotent.

CJ42 commented 2 years ago

I agree with @omriperl . It would be useful to be able to provide constructor arguments via the CLI. This would be useful especially for running the deploy scripts in the CI.

For instance, hardhat verify allows to pass constructor arguments directly in the same command, or via an external file using the constructor-args flag.

If both tasks hardhat deploy and hardhat verify could have this flag, it would help a lot indeed.