0

I have two seemingly identical transactions in terms of input data, yet one continues to fail with ‘ds-math-sub-underflow‘. The transaction that works was done through the Uniswap v2 add liquidity UI interface. The failing one is sent programmatically.

  1. Failing transaction
  2. Succeeding transaction

When looking into the input data both are identical apart from the deadline which of course is fine. The only other difference I was able to conclude on Etherscan is the 'Txn type' field which is using EIP-1559 rather than 'Legacy' on the passing transaction.

Is there any advice to remedy the failing transaction? The error log also shows:

  • reason: 'transaction failed'
  • code: 'CALL_EXCEPTION'

along with the generated tx object itself. If the full error log from the failed tx object is required, let me know.

send uniswap add liquidity transaction

Attached is the current code snippet of above image.

Cheers.

4
  • Your error is actually "ds-math-sub-underflow". Now this is a pretty vague error message, but with UniswapV2 I sometimes get it when my amounts are too small. So make sure your numbers are correct Aug 1 at 12:36
  • Right, I should make that clear in the post. It’s weird seeing the input data being essentially the same yet one has an underflow error.
    – jamesmart
    Aug 1 at 13:05
  • Remember that any UI representation of numbers takes the decimals into account. So 1 in website UI is actually 1e18 in the background code (if the token has 18 decimals) Aug 1 at 13:07
  • Thanks for the tip! Part of trying to get to the bottom of this if I still can’t figure what exactly it is, I’ll download the Uniswap UI and debug the tx object for the differences I guess. What else could be responsible for throwing an underflow error if the input data is basically the same? Any advice as to where else I could look at?
    – jamesmart
    Aug 1 at 13:13
0

Credit to Lauri. Problem was just overlooked, no value of eth was supplied in the transaction, gasLimit was described only.

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.