tinyman-py-sdk icon indicating copy to clipboard operation
tinyman-py-sdk copied to clipboard

V1 - Mismatch between minimum received in webapp and SDK

Open BrelKsiba opened this issue 3 years ago • 2 comments

I noticed a mismatch of minimum price between the webapp and the SDK.

Here the results of the quote from SDK:

Here a print of the quote: SwapQuote(swap_type='fixed-input', amount_in=ALGO('700'), amount_out=Planets('30848.706199'), swap_fees=ALGO('2.1'), slippage=0.005, price_impact=0.00644)

Here the print of amount expected with slippage: print(quote2.amount_out_with_slippage); Planets('30694.462669')

This is different from what I see in the webapp (since many days) image

As you can see the amount_out is correct. However, the amount_out_with_slippage seems to be not correct.

I noticed also that sometimes, even the amount_out does not match. Here I changed th amount_in to 500 ALGO. I am getting the following: SDK: SwapQuote(swap_type='fixed-input', amount_in=ALGO('500'), amount_out=Planets('23341.505158'), swap_fees=ALGO('1.5'), slippage=0.005, price_impact=0.00553)

webapp: image

The amount_out in this case is not the same.

This code was working months agso and I was getting exact results between the webapp and the SDK.

Best regards, HHA

BrelKsiba avatar Nov 19 '22 07:11 BrelKsiba

Hi, @BrelKsiba thank you for the reporting and explanations.

I think it is the same issue with https://github.com/tinymanorg/tinyman-py-sdk/issues/36.

We have addressed this issue while implementing the calculations for V2. It follows the integer arithmetic as the Tinyman protocol (smart contact).

gokselcoban avatar Dec 16 '22 11:12 gokselcoban

Update: This issue is fixed for Tinyman V2 calculations.

gokselcoban avatar Dec 30 '22 11:12 gokselcoban