tendermint / liquidity

Cosmos SDK Liquidity module
Apache License 2.0
138 stars 56 forks source link

Changing swap order reduces base transaction value. #264

Closed cordnel closed 3 years ago

cordnel commented 3 years ago

Summary

Changing the order of swap (such as from atom->dvpn to dvpn-> atom) reduces the entered value slightly every time the arrow icon is clicked.

Brief Description

If we consider this screenshot, we are swapping 1 atom to dvpn. When the order is switched (dvpn to atom), 1 atom reduces to 0.99112 atom, as visible in figure 2. It further reduces if you keep clicking on the arrow icon to switch swap order, but this time with dvpn. It isn't a major issue, but marginal change between the original transaction and slightly reduced value can affect the UX for non-savvy users.

This issue appears to be caused because the value of primary token updates with reference to the value of the secondary token every time the swap order is changed, instead of the original value entered by the user.

Figure 1

1

Figure 2

2

Figure 3

3

Version

Unable to find version on the website https://gravity.bharvest.io

Steps to Reproduce

Choose any trading pair and enter a value for the first token. A corresponding swap value will appear in the second token's textview. Click on the arrow icon between the two tokens and change swap direction. Each time direction is changed, the base values reduce slightly.


For Admin Use

maydany commented 3 years ago

Summary

Changing the order of swap (such as from atom->dvpn to dvpn-> atom) reduces the entered value slightly every time the arrow icon is clicked.

Brief Description

If we consider this screenshot, we are swapping 1 atom to dvpn. When the order is switched (dvpn to atom), 1 atom reduces to 0.99112 atom, as visible in figure 2. It further reduces if you keep clicking on the arrow icon to switch swap order, but this time with dvpn. It isn't a major issue, but marginal change between the original transaction and slightly reduced value can affect the UX for non-savvy users.

This issue appears to be caused because the value of primary token updates with reference to the value of the secondary token every time the swap order is changed, instead of the original value entered by the user.

Figure 1

1

Figure 2

2

Figure 3

3

Version

Unable to find version on the website https://gravity.bharvest.io

Steps to Reproduce

Choose any trading pair and enter a value for the first token. A corresponding swap value will appear in the second token's textview. Click on the arrow icon between the two tokens and change swap direction. Each time direction is changed, the base values reduce slightly.

For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned

Thank you for the report👍 When it comes to mainnet, it will be fixed

maydany commented 3 years ago

Summary

Changing the order of swap (such as from atom->dvpn to dvpn-> atom) reduces the entered value slightly every time the arrow icon is clicked.

Brief Description

If we consider this screenshot, we are swapping 1 atom to dvpn. When the order is switched (dvpn to atom), 1 atom reduces to 0.99112 atom, as visible in figure 2. It further reduces if you keep clicking on the arrow icon to switch swap order, but this time with dvpn. It isn't a major issue, but marginal change between the original transaction and slightly reduced value can affect the UX for non-savvy users.

This issue appears to be caused because the value of primary token updates with reference to the value of the secondary token every time the swap order is changed, instead of the original value entered by the user.

Figure 1

1

Figure 2

2

Figure 3

3

Version

Unable to find version on the website https://gravity.bharvest.io

Steps to Reproduce

Choose any trading pair and enter a value for the first token. A corresponding swap value will appear in the second token's textview. Click on the arrow icon between the two tokens and change swap direction. Each time direction is changed, the base values reduce slightly.

For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned

Hi, thank you and congratulation for becoming the bug bounty prize winner for the Gravity DEX Competition! Please reply here with your Cosmos Hub mainnet address to receive the prize, by your github ID, until May 21, 23:59.