Using the connected contract instance to call the method failed #1946
Replies: 3 comments
-
This sounds like the contracts were not compiled. Though you changed the solidity code, but do not recompile the contracts, your tests would be using the bytecode from old JSON output files. |
Beta Was this translation helpful? Give feedback.
-
Yes, I also suspected this problem. But if I just change the method visible modifier from external to private, I can get the And I am sure that every time I re-run the test, the artifact folder and abi files are deleted and regenerated. |
Beta Was this translation helpful? Give feedback.
-
This line is specific to hardhat-ethers While So as far I am understanding, if you use a mix of hardhat network ( Examples that you can look at:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to call a contract method in my unit test:
and run:
hardhat test
then it ran without any error, and I checked the std output and it was all correct.
but the state in Contract has not changed.
Then I tried to throw the revert error in contract method like this:
the test still runs correctly without any revert error.
Until I changed the
wallet1
from theWallet
to typeSigner
;Then it worked.
I'm not sure if this is a bug in etherjs or waffle, so I post it here.
Beta Was this translation helpful? Give feedback.
All reactions