-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add amountOutMin to longtail #6052
Conversation
src/lib/swapper/swappers/ThorchainSwapper/getThorTradeQuote/getTradeQuote.ts
Outdated
Show resolved
Hide resolved
src/lib/swapper/swappers/ThorchainSwapper/getThorTradeQuote/getTradeQuote.ts
Show resolved
Hide resolved
src/lib/swapper/swappers/ThorchainSwapper/utils/getLongtailQuote.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stamping as this does what it says from a functional perspective, a few comments that are not related to the functionality of this.
Tested locally:
Quote
Debugged expectedAmountOut
and amountOutMin
looks sane
On-chain amountOutMin
is present and sane
Tx Success detection
@0xApotheosis while this was (most likely not?) introduced by this PR, I noticed a discrepancy in the final amount received that's shown here - a discrepancy from the quote, which itself is very close (although not 100% accurate) to the actual on-chain received amount
i.e:
- ~0.527 ATOM on our success status step vs. ~0.422 on quote 🚫
- ~0.422 ATOM on our quote step vs. ~0.421 ATOM on-chain ✅
Thank @gomesalexandre. I think something related to the multi-hop UI is broken here, as that success status step is off (it seems to show the amount before fees). I'm not sure if it only affects longtail swaps, or all swaps, but I'll update this PR to not turn on the longtail feature flag in production until I work out what's up and PR a fix. |
feat: add longtail source ui
Description
Adds a
amountOutMin
value to the first "step" of a longtail to L1 swap (the call to theswapIn
function of the UniswapV3 contract on Ethererum).This PR also re-enables longtail to L1 swaps.- keeping this off for now. There is an unrelated issue that seems to be showing an incorrect value in the trade confirm step. I'm not yet sure if this is a longtail thing, or a multi-hop wiring thing. I'll investigate and fix in a follow-up PR.Note, as a follow-up we'll need to align with @shapeshift/product on how to handle slippage on trades with multiple steps.
A longtail to L1 swap has two steps, each with the slippage value encoded. This means that if a user has selected 1% slippage, it's possible both steps could incur that entire slippage amount, resulting in a total slippage of 1.98% for the trade.
An example TX performed on this branch:
Pull Request Type
Issue (if applicable)
Contributes to #6017
Risk
High - an incorrect implementation could leave users open to sandwich attacks.
Testing
Perform a longtail to L1 swap (e.g. CRV on Ethereum to DOGE). Ensure that the specified slippage value is correctly encoded in both the
amountOutMin
of the Ethereum TX:and on the associated THORChain TX (in the memo):
Engineering
☝️
Operations
☝️
Screenshots (if applicable)