HumbleOSS / humble-interface

MIT License
0 stars 2 forks source link

Price impact display in swap page jumps and may not be correct #2

Open temptemp3 opened 1 month ago

temptemp3 commented 1 month ago
Screenshot 2024-10-04 at 17 23 39
Jbekker commented 1 week ago

This issue resides in the ulujs lib, when swapping 'b for a' the decimal setting of the other token is used. This fixes it but is there a nicer way? image The price impact would still jump of course but at least the final output is correct with this.

temptemp3 commented 1 week ago

I think this makes sense especially since since the final value is correct. I'm thinking there seams like a nicer way especially one where we don't have to call decA the B.decimals. Let me see ; )

temptemp3 commented 1 week ago

It seams like we would be able to achieve the same results here https://github.com/HumbleOSS/humble-interface/blob/beta/src/components/Swap/index.tsx#L721

temptemp3 commented 1 week ago

However I am leaning towards you being right about updating the library function because we set decA and decB before we know the direction. Perhaps A and B should be mA and mB (maybeA lol)

temptemp3 commented 1 week ago

https://github.com/temptemp3/ulujs/blob/main/utils/swap.js#L879

temptemp3 commented 1 week ago

If ulujs.swap::rate is just wrong we would fix it first to resolve the issue ; )

temptemp3 commented 1 week ago

You are right on the money ; )

temptemp3 commented 1 week ago

https://github.com/temptemp3/ulujs/releases/tag/v0.11.16

temptemp3 commented 1 week ago

You should be able to bump ulujs up to latest version. The rest of the price impact jumping is something that you could handle in the ui.

temptemp3 commented 1 week ago

Bumped ulujs in beta branch

2024年10月27日(日) 6:57 Jelle Bekker @.***>:

This issue resides in the ulujs lib, when swapping 'b for a' the decimal setting of the other token is used. This fixes it but is there a nicer way? image.png (view on web) https://github.com/user-attachments/assets/c276fdbc-f14b-4b67-a98e-c7deba4c8122

— Reply to this email directly, view it on GitHub https://github.com/HumbleOSS/humble-interface/issues/2#issuecomment-2440005509, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQ4AW653X5VYKVQBXVT7P3Z5TIJXAVCNFSM6AAAAABPMYB2RKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBQGAYDKNJQHE . You are receiving this because you authored the thread.Message ID: @.***>