1

I am writing a staging test on goerli testnet for a multi-sig contract. I'm trying to test proposing a transaction, having all 3 owners confirm the transaction, and then any one of the owners execute it.

But I am confused about how to connect different accounts to the contract.

I added multiple private keys in my accounts section inside my hardhat.config.js and inside my staging tests I called getNamedAccounts() to use them, but multiSig.connect(owner2).confirmTransaction(0) returns me a voidSigner error.

Here is my staging test so far:

developmentChains.includes(network.name)
    ? describe.skip
    : describe("multi sig staging test", function () {
        let multiSig, chainId, user
          beforeEach(async function () {
              chainId = network.config.chainId              
              multiSig = await ethers.getContract("MultiSig")  
              //console.log(`multiSig address: ${multiSig.address}`)   
              user = "0xEC6Cb786Fd27BA1A79809A88A44d3b9A2b06992A"
          })
          it("allows owners to propose and execute transactions that have set number of confirmations", async function () {
            const {deployer, owner2, owner3} = await getNamedAccounts()
            // console.log(`deployer address: ${deployer}`)
            // console.log(`owner2 address: ${owner2}`)
            // console.log(`owner3 address: ${owner3}`)
            await multiSig.proposeTransaction(user, 7, "0x")
            await multiSig.connect(owner2).confirmTransaction(0)
          })
      }) 

And here is the error code:

Error: VoidSigner cannot sign transactions (operation="signTransaction", code=UNSUPPORTED_OPERATION, version=abstract-signer/5.7.0)

1 Answer 1

0

Instead of using getNamedAccounts() use the ethers.js method getSigners() This grabs the accounts from your hardhat.config.js on whatever network you are on.

const [deployer, owner2, owner3] = await ethers.getSigners()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.