-
I am having an embarrassing CALL_EXCEPTION with ERC20 contract balanceOf after re-deploying the contract. Here is the code in nodejs retrieving balance of an ERC20 contact with ethersjs 5.7 (just upgraded from 5.5) after re-deploying the contract:
Here is error thrown.
However transfer works (no error):
Here is a portion of output of
the following provider.getBlockNumber returns current number of blocks:
Didn't find anything suspicious in node log file. And output is
Shall getCode output the contract functions' code? What is the cause of this CALL_EXCEPTION for balanceOf? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
If the code is I’ve also seen similar situation where the artifact files were not updated correctly. |
Beta Was this translation helpful? Give feedback.
-
Hi ricmoo, the contract was deployed a few days ago. I was puzzled since transferTo seems working. Shall I try to redeploy the contract? |
Beta Was this translation helpful? Give feedback.
-
Re-deploy worked. |
Beta Was this translation helpful? Give feedback.
If the code is
0x
, it means your code isn’t deployed. If you are deploying it just before calling your function, you need to wait for the deployment to complete, for example in a test case.I’ve also seen similar situation where the artifact files were not updated correctly.