Input $ amount in Swaps

Hi everyone,

Trying to contribute with a small feature that I think is missing : the possibility to input the “dollar-equivalent” of a token to be swaped into another token.

When you want to swap token A for token B, you’re currently only allowed to input the amount of token A you want to swap and not the $-equivalent value. If I want to swap EXACTLY $100 worth of HTM token for EGLD, doing the maths to come up to the right amount of HTM to be sold is not always quick and very precise.

swap example

Never came across that feature in any of the other DEXes but I think it would greatly improve the ease of use. Please let me know your thoughts on this

Best

2 Likes

Hi @prettyflacko ! That’s a very interesting suggestion! Never seen it in other exchanges but it would make a lot of sense I think. I guess there are probably edge cases to carefully think about. But great suggestion and we will discuss it internally :pray:

2 Likes

Out of curiosity, how would you imagine the interface in order to input the dollar value directly?

1 Like

Hi @lcswillems, thank you for your reply!
I don’t think it requires much thanges on an UI standpoint. Currently, before inputing an amount (either in the “swap from” or “swap to”) box, no “$-equivalent” appaears. It only appears once we start typing an amount.

These input boxes should just be divided into two (invisible) sub-boxes:

  • left hand side : token amount
  • right hand side : $-equivalent value

Overall, there would therefore be 4 possible input zones (considering you could also input the amount of token you want to received (doable now) as well as the expected value amount you want to receive). The values in the other 3 boxes would be backcalculated automatically

Hope this is clear!

Grossly illustrated, it would look like this:

The warning message (minimum token amount, minimum $-value, etc.) would automatically adjust depending on which box is being input

One caveat is that if someone inputs the expected $-equivalent value of token B he wants to receive, he should be ready not to receive EXACTLY that $-value, considering slippage, etc. But at least it would help on a UX perspective.