Deploy upgradable contract from artifact

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(
          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(
    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!

The plugin requires the source code locally, so an artifact will not do. Is there a particular reason why you need to use an artifact?

Hi frangio, thanks for your quick answer
What "plugin" are you referring to ?
So, to conclude it is not possible to deploy an upgradable contract from the artifacts like a non-upgradable contract which can be deployed using only that.

I do no need that for a particular reason. I did that because my new contract will interact with an already deployed contract and instead of bringing the SOL file to my repo to include that contract in the test suite, I tried with the json file of the artifact first. I couldn't make that work so at the end I brought the sol file to my repo and so I can deploy it in hardhat network with no issues

Sorry, I meant the OpenZeppelin Upgrades Plugin for Hardhat. It's what you're using when you invoke upgrades.deployProxy.