I am new to Ethereum and Solidity and have recently faced the following issue which I cannot understand.
I am trying to use the UniswapV2 router in order to calculate the exchange rates between tokens. I am using the method getAmountsIn and notice the following behavior:
I use USDT and SHIB in the UniswapRouterV2 as follows
As you see I am trying to convert 10000 TETH to SHIB. The router shows a ds-math-sub-underflow error which I cannot tell why is happening. On uniswap, this calculation can be done without a problem (never executed though).
This problem also happens in the PancakeSwapRouterV2.
Questions:
- TETH has 6 decimals, so If I want to trade 10000TETH the value I insert in the amountOut field should be 10000 * 10^6, right?
- Does this error have to do with the amount of SHIB available in the network?
- Any way to tackle this problem?
If you could provide any useful source to read more about this issue, I would be more than grateful.