A harhat plugin - hardhat-deploy provides very useful features that help developers working with hardhat.
You can configure external artifacts in order to retrieve a contract instance that might not be related to the current project.
As a user, I want to get the external contract instance by using getContractAt with the name (not ABI) which is configured in the external artifacts.
Description
For instance, let's assume you are building a very abstracted dex protocol that can interacts any kind of AMM such as uniswap.
You may need to load UniswapV3Factory factory for your tests, in that case, you don't need to bring uniswap's artifacts into your project manually, because uniswap exports their artifacts via npm.
Then, you will add a notation inside hardhat.config.js as following:
HardhatError: HH700: Artifact for contract "UniswapV3Factory" not found.
at Artifacts._getArtifactPathFromFiles (node_modules/hardhat/src/internal/artifacts.ts:394:13)
at Artifacts._getArtifactPath (node_modules/hardhat/src/internal/artifacts.ts:317:27)
at Artifacts.readArtifact (node_modules/hardhat/src/internal/artifacts.ts:51:9)
at Object.getContractAt (node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:401:22)
at Context.<anonymous> (scripts/integrated/stake.spec.ts:68:24)
User Story
A harhat plugin - hardhat-deploy provides very useful features that help developers working with hardhat. You can configure external artifacts in order to retrieve a contract instance that might not be related to the current project. As a user, I want to get the external contract instance by using
getContractAt
with the name (not ABI) which is configured in the external artifacts.Description
For instance, let's assume you are building a very abstracted dex protocol that can interacts any kind of AMM such as uniswap. You may need to load
UniswapV3Factory
factory for your tests, in that case, you don't need to bring uniswap's artifacts into your project manually, because uniswap exports their artifacts via npm.Then, you will add a notation inside
hardhat.config.js
as following:(See details here)
And then, you will try to get
UniswapV3Factory
contract as following:But it give you an error like: