0

We made a smart contract where you send it ETH, it checks the current price of ETH/USD using a chainlink oracle and then sends back our token at 12 cents a token until March 1, then 15 cents etc.

All people do is send ETH to the contract, and then the payable function gets triggered and executes all this other stuff. Somehow, the main wallets all consistently UNDERESTIMATE how much gas is supposed to be used. Does this have something to do with the fact that the person is sending ETH so they think there should be a ceiling to how expensive that transaction can be, versus a call to some method directly, even though the payable hook consumes quite a bit?

The largest gas cost honestly is checking the chainlink oracle. I am not sure why! Isn’t it just looking up a value?

Here is my main question ... can’t wallets see the whole blockchain and simulate the execution of the ENTIRE CALL, and sum up the current gas price it would take? Where are the unpredictable spots for them to underestimate the cost so wildly?

What can we do to fix it?

1
  • 1
    Which wallets? Which contract? Wallets always calculate an approximation, until a transaction mined the contract state can change an alter the final calculation. Some wallets try to calculate it in a precise by simulate its execution, other will take shorcuts when evaluating calls to other contracts. – Ismael Feb 26 at 3:05

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.