Closed prakashsanker closed 2 years ago
I've also ran into this bug but for the external.artifacts
use case. I similarly went down the rabbit hole and noticed that the issue is with getExtendedArtifactFromFolders
, specifically this line where an uncaught exception bubbles up before getting to the logic where the additional import paths are loaded https://github.com/wighawag/hardhat-deploy/blob/32a80276a9d473e43e38b3b07c300e35967b07e8/src/utils.ts#L71
this bug is not limited to the diamond functions and surfaces whenever getExtendedArtifacts is invoked (as is the case with deploy)
my workaround is :
const deployAlt: typeof deploy = async (name, options) =>{
const artifact = await deployments.getArtifact(name)
const deployOptions = Object.assign({}, options, {contract: {abi: artifact.abi, bytecode:artifact.bytecode}})
return await deploy(name, deployOptions)
}
Describe the bug I am trying to deploy a diamond with facets. This is the deployment code
The artifact is sitting in an
imports
folder and the contractContractName
is not found.I dug deep into this and realized it's happening because of this line https://github.com/wighawag/hardhat-deploy/blob/master/src/DeploymentsManager.ts#L215.
If you go deeper, the error is intentional - you hit https://github.com/wighawag/hardhat-deploy/blob/master/src/DeploymentsManager.ts#L215 and then ultimately hit
_getArtifactPathFromFiles
inhardhat
which throws the error. (Function pasted below)The error happens because files has only the artifacts path and the code path checks to see if the contract is sitting in that folder or not. It's not, so it throws an error.
This however means that the code path will never look at the imports folder (which is what is communicated in the documentation). The code works if I dive in and hardcode the imports folder as the artifacts folder.
To Reproduce Steps to reproduce the behavior:
imports
folder/deploy
and runnpx hardhat deploy
Expected behavior Everything should work as with the non extended artifacts case. The imports code path should be hit.
versions