I have some solidity methods in my contract, and when i make a send in web3.js i would like to know if there is a way to know if the functions are going to revert by using call.

Per-example , in Solidity i have a function that returns true, and i thought that if i used "call" in web3, i would get true if no revert and false or null if revert. But this is not the case, as when reverts, returns true anyway

Is there a way to know if it will revert?

  • It returns true because of a combined issue (still opened AFAIK) in both web3.js and Geth (which I assume you're using). Get rid of the revert-message inside the contract function, and it should work fine. – goodvibration Jun 14 '20 at 10:09
  • oh okay! I will remove the revert messages. Thank you! – jnuno98 Jun 14 '20 at 10:33
  • NP, let me know if it works out for you. – goodvibration Jun 14 '20 at 10:59

Your Answer

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

Browse other questions tagged or ask your own question.