3

Metamask is giving me that error. I am on ropsten network, I never had this issue before and I have enough funds:

enter image description here

I have tried multiple times still getting same error. While it says "I will try anyway", confirm button was disabled

2 Answers 2

2

What probably happens is that Metamask runs a static call to the contract with the same parameters, to simulate what would happen if the transaction took place. If it notices that the static call reverts, it gives you this error - because most likely the real transaction would revert as well.

So most likely there is something in the code which causes a revert with the given parameters.

3
  • I run too many transactions, they all went through. But first time, today I face this isse
    – Yilmaz
    Jan 20 at 19:04
  • I've seen this error a few times yesterday and today. At some apparently random time, I tried again and the call went through. Perhaps the Ropsten network is overloaded so the gas fees are too high?
    – Biosopher
    Jan 23 at 2:28
  • You were right. something was wrong with json data.
    – Yilmaz
    Feb 12 at 21:11
0

the problem was with my json data. I have this code in purchaseBook function in javascript:

 const hexBookId = web3.utils.utf8ToHex(book.id);

in json.data for first three items I had correct id type: "id": "2". I could successfully purchase first 3 books. After the third one, I had this

  "id": 4 

So when I click on the purchase button, I was getting errors. I corrected the json data

 "id": "4"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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