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

Yilmaz
  • 1,580
  • 10
  • 24

2 Answers2

3

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.

Lauri Peltonen
  • 29,391
  • 3
  • 20
  • 57
  • I run too many transactions, they all went through. But first time, today I face this isse – Yilmaz Jan 20 '22 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 '22 at 02:28
  • You were right. something was wrong with json data. – Yilmaz Feb 12 '22 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"
Yilmaz
  • 1,580
  • 10
  • 24