wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.19k stars 292 forks source link

deploy pre-compiled contracts from other npm pakcages #361

Closed noyyyy closed 2 years ago

noyyyy commented 2 years ago

Is your feature request related to a problem? Please describe. I'm new to this npm package and deployed some contracts written by myself successfully. However, when I want to deploy some pre-compiled contracts on a private testnet, I don't know what to do. Pre-compiled contract includes pre-compiled uniswap v2 contract and weth contract. npm packages: @uniswap/v2-core, @uniswap/v2-periphery, canonical-weth

I deploy the contract with ethers.js and save deployment manually but there are many attributes that I need fill in even it's not necessary.

I also try to use paths.imports but it's a string rather than string[]

Describe the solution you'd like allow paths.imports to import multiple folders

Describe alternatives you've considered

  1. For developer, just copy pre-compiled contract source code and compile it before deploying. Or copy pre-compiled contracts JSON files in a new folder. Both of them are not graceful enough
  2. Read pre-compiled contacts JSON file from other npm packages in script, use deploy in hardhat-deploy to deploy it.

Additional context

noyyyy commented 2 years ago

Update: I resolved it by reading source code and setting external.contracts.artifacts in hardhat.config.ts.

Could I add some documentation and make a pr?