-
Notifications
You must be signed in to change notification settings - Fork 191
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: li.fi unstable quotes use original rate #8350
Conversation
additional discriminator
packages/swapper/src/swappers/CowSwapper/getCowSwapTradeQuote/getCowSwapTradeQuote.test.ts
Show resolved
Hide resolved
ada0243
to
3f98082
Compare
3f98082
to
91b6873
Compare
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.
https://jam.dev/c/1bd57a91-3a1f-49eb-9735-007c8d263cc3
By having the monkey patch set up, I'm constantly having the blank screen even with your changes, I couldn't make it work with the monkey patch applied
@NeOMakinG this is a bridge and is expected to be borked for the time being until release is merged back into develop - as mentioned in the description, this is only one out of two fixes, #8348 (merged) fixes bridges at quote time, but is not in develop, yet, since 8348 was targeted to release. Can you retest with regular Li.Fi swaps? 🙏🏽 just retested now with the monkey patch applied FYI https://jam.dev/c/da942d46-6958-4f7d-ab6c-121a20a59f2a |
Ah damn, I was sure this branch was aiming the bridge fix, will give it another try asap |
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.
Li.FI
https://jam.dev/c/edeaa67f-e022-451d-9d66-8784723fb63c
Other swappers quotes
https://jam.dev/c/4dc76ac5-8b3e-48ff-bd79-0882a16a17cd
Thorchain routes are not testable right now because of the upgrade, but looks good overall!
71b7188
to
3ac3a4e
Compare
Description
#8326 introduced support for final trade quotes. This brought in two issues, one which was a blatant bug for Li.Fi bridge swaps introduced by 8326 (fixed in #8348), the second one which is inherent to how Li.Fi works:
It is not unusual (though, relatively rare all things considered) to yield what we call an unstable route as part of their quotes list. This is a route which is almost guaranteed to never be gotten the second time around when firing a
/routes
call. I've seen this happen very rarely for main Li.Fi tools (1inch, ZRX...), but if you're unlucky to select one whichis an almost guaranteed fail (e.g Enso), then you're out of luck and the swapper will blank out, since we are unable to fetch the same route the second time around.
This is fixed by returning the original rate as originalRate as part of TradeRate, and passing it as TradeQuoteInput at quote time, so we can fallback to it in case we hit this unlucky scenario.
Since I was having some lil' issues with types while working on that, did a little cleanup of types whilst in the house to better reflect the new TradeQuote/TradeRate flow following #8309
Issue (if applicable)
closes #8347
Risk
Low - do a little sanity check of Li.Fi, and other swappers while at it. This change should be constrained to Li.Fi, though there are some small notable runtime changes to accommodate for the improved types, which will be commented out inline in this PR.
Testing
Engineering
Operations
🏁 My feature is behind a flag and doesn't require operations testing (yet)
☝️
Screenshots (if applicable)
https://jam.dev/c/77584de8-9c5e-4153-9965-91a385d33577
https://jam.dev/c/84d024e5-d439-4803-8021-7fe38ad642de