How to set deployer in deployProxy in hardhat?

Hello Guys,
I am deploying contracts on two different chains locally, created two provider and signers for respective chains. But when i am trying to deploy proxy contract using upgrades it's using default provider provided by hardhat.

const _dstGastLimit = 1000000;
    const NFT = await ethers.getContractFactory("NFT");
    localNFTProxy = await upgrades.deployProxy(NFT, [
    await localNFTProxy.connect(localSigner).deployed();

    remoteNFTProxy = await upgrades.deployProxy(NFT, [
    await remoteNFTProxy.connect(remoteSigner).deployed();

      con: localNFTProxy.provider.connection,
      add: localNFTProxy.address,
      t: "local",

      con: remoteNFTProxy.provider.connection,
      add: remoteNFTProxy.address,
      t: "remote",

Can you please help me? or I am doing something wrong?

in truffle there is option for deployer but not in hardhat?

In Truffle, you can pass an optional input parameter {from: someAccount} to the function which is executed in your transaction.

The equivalent in HardHat, is to "precede" the function call with connect(someAccount).


await contractInstance.functionName(param1, param2, {from: account});


await contractInstance.connect(account).functionName(param1, param2);

In Hardhat, you can connect a different signer to the ethers ContractFactory before using it to deploy a proxy. See for an example.

1 Like

I did that but getting Error: Timeout of 40000ms exceeded, when when I changed provider in proxy-deploy.js to custom provider by passing an extra parameter from my side then it deployed successfully but getting this "Error: Method hardhat_getStackTraceFailuresCount not supported."

 const signer=args.pop();
        if (!Array.isArray(args)) {
            opts = args;
            args = [];

        const { provider } =;