BirthdayResearch / defichain-wallet

DeFiChain Wallet. The DeFi Blockchain Light Wallet for iOS, Android & Web.
MIT License
125 stars 46 forks source link

Light Wallet: Slippage tolerance applied to "estimated to receive amount" instead of "Dex Price" #2055

Open CryptoCHBS opened 2 years ago

CryptoCHBS commented 2 years ago

Actual behavior:

When using the DEX in the DeFiChain light wallet app one can set a slippage tolerance. However, the defichain light wallet applies the slippage to the "estimated to receive" amount which means you can end up with a slippage of 15-20% compared to the shown DEX Price if your requested volume is quite high compared to the pool size.

This makes the idea of a slippage tolerance completely obsolete here. I checked some other DEXes like Uniswap, PancakeSwap, SundaeSwap, Quickswap etc. and every DEX applies the set slippage tolerance to the shown price. If the requiremants of the tolerance cannot be met, the transaction will not be executed.

Expected behavior:

The purpose of the slippage tolerance is to minimize the risk, that the price "slips" away too much. This is especially important when the volume one is requesting to trade is high compared to the liquidity in the DEX pool. By setting a slippage tolerance you can tell the DEX what you are willing to let the price slip away which also means that the transaction should not be executed, if the DEX is not able to fulfill my slippage requirements (i.e. the volume I am requesting from the DEX cannot be offered at the price incl. slippage I am requesting). In short: The set slippage tolerance should be applied to the shown DEX price (not the estimated to receive amount). The transaction should be rejected in case the requested volume cannot be provided by the dex for the shown price reduced by the set slippage tolerance.

How to reproduce it (as minimally and precisely as possible):

What are your environment parameters?

defichain-bot commented 2 years ago

@CryptoCHBS: Thanks for opening an issue, it is currently awaiting triage.

The triage/accepted label can be added by foundation members by writing /triage accepted in a comment.

In the meantime, you can:

  1. Checkout DeFiChain’s Github issue page to see if your issue has already been reported
  2. Submit any logs if you have them, this will greatly expedite the process for us.
  3. You can also join our Telegram or Reddit community channels.
Details I am a bot created to help the [DeFiCh](https://github.com/DeFiCh) developers manage community feedback and contributions. You can check out my [manifest file](https://github.com/DeFiCh/app/blob/main/.github/governance.yml) to understand my behavior and what I can do. If you want to use this for your project, you can check out the [DeFiCh/oss-governance-bot](https://github.com/DeFiCh/oss-governance-bot) repository.
CryptoCHBS commented 2 years ago

Happy to jump on a short call to explain and present the isue I am seeing. Its a bit hard to explain in written :-)

defichain-bot commented 2 years ago

@CryptoCHBS: Thanks for opening an issue, it is currently awaiting triage.

The triage/accepted label can be added by foundation members by writing /triage accepted in a comment.

Details I am a bot created to help the [DeFiCh](https://github.com/DeFiCh) developers manage community feedback and contributions. You can check out my [manifest file](https://github.com/DeFiCh/wallet/blob/main/.github/governance.yml) to understand my behavior and what I can do. If you want to use this for your project, you can check out the [DeFiCh/oss-governance-bot](https://github.com/DeFiCh/oss-governance-bot) repository.
defichain-bot commented 2 years ago

@CryptoCHBS: There are no 'area' labels on this issue. Adding an appropriate label will greatly expedite the process for us. You can add as many area as you see fit. If you are unsure what to do you can ignore this!

You can add area labels by leaving a /area comment.

Details I am a bot created to help the [DeFiCh](https://github.com/DeFiCh) developers manage community feedback and contributions. You can check out my [manifest file](https://github.com/DeFiCh/wallet/blob/main/.github/governance.yml) to understand my behavior and what I can do. If you want to use this for your project, you can check out the [DeFiCh/oss-governance-bot](https://github.com/DeFiCh/oss-governance-bot) repository.