0

enter image description here

I sent this transaction with 74 GWEI and 185421 gas limit. So far my calculations: 74 * 185421 -> about 6.6 USD, at the time of writing.

The screenshot above shows 1.04 USD. Below it says gas used ~15%.

What's going on? Why does the transaction stop at 15% of the limit (if I understand this correctly)?

2

The error-message INSUFFICIENT_OUTPUT_AMOUNT is thrown from the contract function, not from the transaction.

It therefore has nothing to do with your gas-limit and gas-price configuration, and it most certainly has nothing to do with ETH/USD price.

This error-message tells you that the output amount is smaller than the minimum that you've requested for (in the amountOutMin input parameter which you have passed to this function).

You can observe all of this in the contract source code on GitHub.

  • Ah okay, lol, I was very mistaken. So I've to increase the slippage. – Ixx Nov 18 '20 at 19:48
  • My problem was actually that I wasn't using JSBI.toNumber on the amount returned by uniswap to convert it to an actual number, so it was sending a ridiculously high amount. It makes sense to switch to Typescript. JS is too dangerous for this. – Ixx Nov 18 '20 at 20:25
  • @Ixx: Never use toNumber on anything returned from a web3 call without asserting first that it is not larger than Number.MAX_SAFE_INTEGER. – goodvibration Nov 19 '20 at 6:45
  • For example, if (retVal.lte(new BN(Number.MAX_SAFE_INTEGER))) .... – goodvibration Nov 19 '20 at 6:47
  • More generally, I would recommend to avoid even that suggestion, and use only BN objects throughout your code. That is, unless it is designated for display purpose, in which case, you can and should use toString(). – goodvibration Nov 19 '20 at 6:47

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.