To deploy a contract from an artifact on hardhat (for testing purposes) I can get the contract artifact json file and put it in the repo and then do it like this:
import XTokenWrapperArtifact from './helpers/artifactsForTesting/XTokenWrapper.json'; const XTokenWrapperFactory = new ethers.ContractFactory( XTokenWrapperArtifact.abi, XTokenWrapperArtifact.bytecode, deployer, ); xTokenWrapperContract = await XTokenWrapperFactory.deploy(); await xTokenWrapperContract.deployed();
So I can call the contract using await xTokenWrapperContract.method()
When I have an upgradable contract I try to do the same thing but it is not working:
import PermissionManagerArtifact from './helpers/artifactsForTesting/PermissionManager.json'; const PermissionManagerFactory = new ethers.ContractFactory( PermissionManagerArtifact.abi, PermissionManagerArtifact.bytecode, deployer, ); permissionManagerContract = await upgrades.deployProxy(PermissionManagerFactory, ); await permissionManagerContract.deployed();
I get on the tests this error:
Error: The requested contract was not found. Make sure the source code is available for compilation
Does anybody know how to deploy an upgradable contract from an artifact ?
Thanks a lot!