When I try to import a contract from other artifacts folders or node modules into the dapp test using

this.LinkToken = await ethers.getContractFactory('@chainlink/contracts/src/v0.4/LinkToken.sol')

it generates an error saying that it could not be found, I've gessed that it just looks in the artifacts/contracts folder.

I've also tried getContractAt and it generates the same result

Is it possible to import a contract outside of it?, thanks

The specific error is HardhatError: HH700: Artifact for contract "@chainlink/contracts/src/v0.4/LinkToken.sol" not found.


In you hardhat.config.js add this:

paths: {
   sources: "./<YOUR_CONTRACT_FOLDER>",

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.