2

When applying Waffle mock to simulate a contract method that must be explicity signed an error is thrown:

Error: Contract with a Signer cannot override from (operation="overrides.from", code=UNSUPPORTED_OPERATION, version=contracts/5.1.1)

This is the test code:

  const provider = waffle.provider;
  [senderMock] = provider.getWallets();
  lockedToken = await deployMockContract(senderMock, LockedToken.abi);
  await lockedToken.mock.addAdmin.returns();
  ...
  await lockedToken.addAdmin(escrow.address, { from: multisig });

Same code but default signing it works Ok:

  ...
  await lockedToken.addAdmin(escrow.address);

So, is not Waffle mock working w/ explicity signed calls? Or is there any workaround? Thx!

1 Answer 1

1
+100

Per https://github.com/ethers-io/ethers.js/issues/2000, you can do:

await lockedToken.connect(multisig).addAdmin(escrow.address);

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.