0

I have a solidity contract that contains a logic to approve and transfer balance, swap and flashloan. But when i use eth_call to call my function that perform swap, it reverts.

I tried by eth_sendRawTransaction, and it gives me the correct result. so My question is, Can eth_call simulate transaction that contain safeapprove and transfer or do I miss something?

1 Answer 1

1

You want to use eth_estimateGas. It will run your code without executing it and estimate the cost. It will also tell you if the call will fail.

2
  • 1
    ok wait pls let me test it... and thanks for ur fast response Oct 21 at 11:57
  • 1
    Hello bro thank very much for info eth_estimate. It is very time efficient to get gas estimation and to simulate transaction at same time. Also eth_call worked for me. The problem was, i made a mistake when i encode the ABI data. Oct 21 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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