LlamaSwap / interface

Frontend for LlamaSwap
https://swap.defillama.com
85 stars 77 forks source link

balance above the input, show slippage after route is selected #72

Closed ai-slave closed 1 year ago

ai-slave commented 1 year ago

Before

image

After

image
vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
llamaswap ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Jan 23, 2023 at 11:19PM (UTC)
vrtnd commented 1 year ago

why should we hide slippage if u change it u can get different quote. so now to set 1% and select quote i need to get quotes with default slippage -> select quote -> increase slippage to 1% and wait for new quotes

ai-slave commented 1 year ago
vrtnd commented 1 year ago
  • Why user should care about slippage? Can we calculate or recommend slippage for them?
  • To me choosing slippage is one of the latest things I'd do in the process, not something I'd mingle at the price discovery step

there are tokens with swap fee, also there are tokens with smol liquidity and user should definitely care about slippage in these cases.

about slippage recommendation - this is already on our todo list and yes i agree that this is the best way to solve slippage problem

vrtnd commented 1 year ago

and if we hide slippage in some cases there will be one more ui item that hides and appears, i don't think it is a good practice in case when u can interact from the start without any additional data needed

ai-slave commented 1 year ago

Do we have the data on how many swaps were made with less of a slippage? @0xngmi I don't feel it's something you mingle when inputting coins, more if your swap isn't coming through or you have some personal reasoning for this. Most of aggregators hide slippage in settings.

Also, maybe I'm not understanding slippage well enough, but in the interim can we limit someone's losses by like ~50$, so it becomes 0.005% if you're swapping $1M of value for example. Or does it work differently? Sorry for stupid questions then :)

0xngmi commented 1 year ago

yeah we have data on slippage, just checked and all the trades with significant sums of money use changed slippage

imo better to leave as is for now just because slippage is something that can rekt ppl doing large txs and imo playing it safe for now is better + what mintdart mentioned, as slippage affects the quotes we get

agree that it would be great to be able to represent slippage in terms of total tokens as well instead of a simple percentage, that would be really great for large swaps (eg if you swap 100M, 0.01% is still a lot), this would require changing almost all adapters tho since almost all apis rely on percentage slippage (i guess we could also convert token amount to % slippage tho, that could work)

ai-slave commented 1 year ago

Ok, I'll just try to change slippage ui to be more descriptive. Thank you for the reviews guys!

ai-slave commented 1 year ago

If we do count slippage as 0.5% of input value with a cap of 50$ as default (Recalculate slippage % to lower whenever input is big enough). Which use cases would that break?

ai-slave commented 1 year ago

What do you think about changing it to this in the interim? At least we'll notify people that there's a risk of loss.

image
ai-slave commented 1 year ago

Also changed slippage to appear after we have both tokens and value. I don't think this changes current UX, but makes stuff lil less crumbersome on the first stage of interactions.

ai-slave commented 1 year ago

@0xngmi pls take a look, it's doesn't change the UX much, but adds the alert for high slippage