Should truePriceTokenA/truePriceTokenBpassed in values be in Wei or in Ether format?
I ask this because when passing in the argument values of these two trueprices in "wei" into the SwapToPrice function, it exponentiates the returned value of amountIn in comparison if I do not convert into wei and kept them in ether values.
Which is it the correct format for truePriceTokenA/truePriceTokenB, in wei or ether? I suspect it has to be ether not wei.
To explain what I mean, here´s an example pair
Passed in 1INCH input amount: 155509
1NCH/WETH price: 1630 (price to take out the flashloan from Sushiswap rather than 2257 offered in Uniswap)
WEI CONVERSATION
input truePriceTokenA value: 155509 1000000000000000000 1630
input truePriceTokenB value: 155509 * 1000000000000000000
to pass 1630 price ratio into SwapToPrice function
Resultant amountIn (amountRequired) and amountReceived values which I need in order to do amountIn < amountReceived to see if I make a profit in an arbitrage operation for a spotted price opportunity between uniswap/sushiswap exchanges:
As you can see from the above, when I perform the final amountIn < amountReceived validation check the amountReceived i.e. the returned amountIn value from computeProfitMaximizingTrade() function call is exponentiated if I do not convert the truePriceToken pair input values into Wei and kept them in original Ether format.
Hi,
Should
truePriceTokenA
/truePriceTokenB
passed in values be in Wei or in Ether format? I ask this because when passing in the argument values of these two trueprices in "wei" into the SwapToPrice function, it exponentiates the returned value of amountIn in comparison if I do not convert into wei and kept them in ether values. Which is it the correct format for truePriceTokenA/truePriceTokenB, in wei or ether? I suspect it has to be ether not wei.To explain what I mean, here´s an example pair
Passed in 1INCH input amount: 155509 1NCH/WETH price: 1630 (price to take out the flashloan from Sushiswap rather than 2257 offered in Uniswap)
WEI CONVERSATION input truePriceTokenA value: 155509 1000000000000000000 1630 input truePriceTokenB value: 155509 * 1000000000000000000 to pass 1630 price ratio into SwapToPrice function Resultant amountIn (amountRequired) and amountReceived values which I need in order to do
amountIn < amountReceived
to see if I make a profit in an arbitrage operation for a spotted price opportunity between uniswap/sushiswap exchanges:amountIn: 10786773752401800000000000000000000000000000000000,00 amountReceived: 77844506295847600000,00
ETHER (W/O WEI CONVERSATION) input truePriceTokenA value: 155509 * 1630 input truePriceTokenB value: 155509
amountIn: 459152578040111000,00 amountReceived: 199642495794552,00
As you can see from the above, when I perform the final
amountIn < amountReceived
validation check the amountReceived i.e. the returned amountIn value from computeProfitMaximizingTrade() function call is exponentiated if I do not convert the truePriceToken pair input values into Wei and kept them in original Ether format.Please kindly advise.
Thank you