Hardhat-deploy: Connect build artifacts from the external project

Created on 27 Nov 2020  ·  3Comments  ·  Source: wighawag/hardhat-deploy

I have an issue with connecting the external artifacts.
In Project A I have deploy and artifacts folders where I keep all the hardhat deployment files and artifacts generated after the first deployment.
In Project B I'm re-using those things by putting that into the hardhat config:

  external: {
    contracts: [
      {
        artifacts: '/contracts/artifacts',
        deploy: '/contracts/deploy',
      },
    ],
  },

Now I run npx hardhat deploy from Project B and see that all the contracts got successfully deployed.
But when I'm trying to interact with any of the deployed contracts I see in the console: Contract call: <UnrecognizedContract>.
Same goes if I separately run the hardhat node first and deploy contracts after. For every deployment, I see in logs <UnrecognizedContract>.

What is the correct way to connect the external hardhat project, so the hardhat node could understand what contracts were deployed?

enhancement

Most helpful comment

If that helps, I noticed the same issue when you simply start the hardhat node in one project and deploy contracts in another.
I'm not sure if it's possible to manually connect 'artifacts' or compilation results to hardhat, so the node could start recognizing contracts.

All 3 comments

This is not currently supported and this might depend of artifacts format too.
I'd like to make that possible in most cases through using https://github.com/nomiclabs/hardhat/blob/8118d0e3649ed87b247ef02830feb6aad5a78682/packages/hardhat-core/src/internal/hardhat-network/provider/modules/hardhat.ts#L37

If that helps, I noticed the same issue when you simply start the hardhat node in one project and deploy contracts in another.
I'm not sure if it's possible to manually connect 'artifacts' or compilation results to hardhat, so the node could start recognizing contracts.

There this is issue that could help : https://github.com/nomiclabs/hardhat/issues/1040

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lcswillems picture lcswillems  ·  14Comments

freebyte picture freebyte  ·  9Comments

jaypaik picture jaypaik  ·  13Comments

tennox picture tennox  ·  4Comments

lepidotteri picture lepidotteri  ·  5Comments