I have a contract A that deploys another contract (B).
const A = await deployer.loadArtifact("A");
const a = await deployer.deploy(A) as A;
I can get address of contract B via function and create a reference to contract b:
let bAddress = await a.getBAddres();
let b = await hre.ethers.getContractAt("contracts/B.sol:B", bAddress, ???);
If I will call a function from contract b - I will receive an error: sending a transaction requires a signer
So I need a signer to properly call functions from contract B.
What exactly should I pass getContractAt
?
I tried to pass
- the deployer, which is (
const deployer = new Deployer(hre, wallet);
) - owner from
const [owner, addr1, addr2] = await hre.ethers.getSigners();
- tried to get signer from address:
let signer = await hre.ethers.getSigner(bAddress);