token decimals on getAmountsOut #2291
Unanswered
IronSight87
asked this question in
Q&A
Replies: 1 comment 2 replies
-
You should be using BigNumber because for a larger difference in decimals would cause an error. let maxOutputAmount = amounts[1].mul(ethers.BigNumber.from(10).pow(precision0 - precision1)); Also the time is not what you is intending for, Math.floor(Date.now()/1000) + 1000 * 60 * 5, //5 minutes If it's still a problem, can you give a transaction hash, I can try to help |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hy there,
is there a more simple way to consider tokens with varying in decimals places when determining max output amount?
The funny part: When the decimals of token0 and token1 differ the transaction fails with "Fail with error 'ds-math-sub-underflow'" and
tx.await() times out.
Beta Was this translation helpful? Give feedback.
All reactions