wighawag / hardhat-deploy

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

hardhat export exports undefined addresses, though they are deployed #311

Open dalechyn opened 2 years ago

dalechyn commented 2 years ago

Describe the bug I need to use truffle deployments. My config is next:

external: {
    deployments: {
      testnet: ['./truffle/artifacts'],
      live: ['./truffle/artifacts']
    }
  }

There I have truffle artifacts with deployment info. My defaultNetwork is set as testnet.

After running hardhat export --export-all what I get in the end are valid deployments for live network, and empty deployments for testnet network (no addresses).

Then I found this code: https://github.com/wighawag/hardhat-deploy/blob/283ec68d4a2f420a8b23785f9efc58fd62451240/src/DeploymentsManager.ts#L1315-L1325

Putting console.log(all) before this code and after proves you the bug.

So I used the hardhat export --export-all with --network hardhat.

Now the contract deployments file is valid.

To Reproduce Steps to reproduce the behavior:

  1. Have two chains and deployed truffle artifacts
  2. Set a defaultNetwork as one of the networks you have deployed.3.
  3. Try to export all and see that addresses for deployments of defaultNetwork are empty. Expected behavior Exporting all contracts without setting a defaultNetwork: 'hardhat' as I mentioned above. versions
    • hardhat-deploy "0.11.4"

Additional context I suppose it may fail not only with truffle deployments

wighawag commented 2 years ago

Putting console.log(all) before this code and after proves you the bug.

What happens ?

DOes it not get filled again via the push on line 1321 ?

dalechyn commented 2 years ago

Putting console.log(all) before this code and after proves you the bug.

What happens ?

DOes it not get filled again via the push on line 1321 ?

It pushes it back without deployed addresses