[Amm] "Swap" (exchange) from TL: different behaviour on AMM present
Closed this issue · 1 comments
WietseWind commented
Right now, if you tap Exchange on a TrustLine, we display slippage, check for books, slippage, etc.
If there's an AMM present for the given pair, when staying under the AMM depth, this is irrelevant: the AMM will be consumed.
So if on a network with AMM activated, when loading the slippage and books, we should check the entered From amount and check if there's an AMM for that pair, and respect that.
- Check if there's an AMM for the pair: https://xrpl.org/amm_info.html
- Gather the values in the response https://rqqjncs.dlvr.cloud/pasted_1.png
- Take the user entered amount, up to the AMM present amounts, ignore all book and slippage checks and warnings - show "Obtaining liquidity from AMM pool"
- If the user enters an amount ABOVE the AMM present amounts, enable book and slippage checks, but only for the amount that EXCEEDS the AMM present amount, show: "Obtaining liquidity up to XXXXX from AMM pool, using DEX: {existing slippage, etc. panel}"
WietseWind commented
Superseded by #493