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, [
localGateway.address,
_dstGastLimit,
]);
await localNFTProxy.connect(localSigner).deployed();
remoteNFTProxy = await upgrades.deployProxy(NFT, [
remoteGateway.address,
_dstGastLimit,
]);
await remoteNFTProxy.connect(remoteSigner).deployed();
console.log({
con: localNFTProxy.provider.connection,
add: localNFTProxy.address,
t: "local",
});
console.log({
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)
.
Truffle:
await contractInstance.functionName(param1, param2, {from: account});
HardHat:
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 https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/85#issuecomment-1028435049 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 = [];
}
hre.network.provider=signer.provider;
const { provider } = hre.network;