Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1 - Mismatch between minimum received in webapp and SDK #46

Open
BrelKsiba opened this issue Nov 19, 2022 · 2 comments
Open

V1 - Mismatch between minimum received in webapp and SDK #46

BrelKsiba opened this issue Nov 19, 2022 · 2 comments
Labels
wontfix This will not be worked on

Comments

@BrelKsiba
Copy link

BrelKsiba commented Nov 19, 2022

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

@gokselcoban
Copy link
Contributor

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

I think it is the same issue with #36.

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

@gokselcoban gokselcoban added the wontfix This will not be worked on label Dec 16, 2022
@gokselcoban gokselcoban changed the title Mismatch between minimum received in webapp and SDK V1 - Mismatch between minimum received in webapp and SDK Dec 16, 2022
@gokselcoban
Copy link
Contributor

Update: This issue is fixed for Tinyman V2 calculations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants
@gokselcoban @BrelKsiba and others