Skip to content
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

feat: mixed route support native currency routing based on whether v4 pool is involved #716

Conversation

jsy1218
Copy link
Member

@jsy1218 jsy1218 commented Sep 23, 2024

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    feature

  • What is the current behavior? (You can also link to an open issue here)
    mixed route cannot support non-native currency routing for v2 and v3 only.

  • What is the new behavior (if this is a feature change)?
    we will be able to support non-native currency routing for v2 and v3 only.

  • Other information:
    this is for backward compatibility with existing mixed routing against v2 and v3

Copy link
Member Author

jsy1218 commented Sep 23, 2024

Copy link
Contributor

@xrsv xrsv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - left a couple of comments

(
token: Currency,
tokenValidation: TokenValidationResult | undefined
): boolean => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems identical with inline method at line 187. Maybe create a common function?

metric.putMetric(
'MixedGetRoutesLoad',
Date.now() - beforeGetRoutes,
MetricLoggerUnit.Milliseconds
);

return {
routes: routes,
routes: routes.concat(v2V3OnlyRoutes),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could those contain dups? if so, is that a problem later on?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meanwhile dup is not a problem, because best-swap-route will select a single best route, it's better if we do dedup here. I will think about how to do it here.

@jsy1218 jsy1218 force-pushed the siyujiang/route-290-top-level-alpha-router-native-currencyin-currencyin branch from c745fdc to f9f1901 Compare September 23, 2024 22:42
@jsy1218 jsy1218 force-pushed the siyujiang/route-291-special-treat-mixed-route-native-currency-routing-only-when branch 3 times, most recently from 5a3f322 to 235e884 Compare September 23, 2024 23:24
@jsy1218 jsy1218 changed the base branch from siyujiang/route-290-top-level-alpha-router-native-currencyin-currencyin to graphite-base/716 September 24, 2024 16:18
@jsy1218 jsy1218 force-pushed the siyujiang/route-291-special-treat-mixed-route-native-currency-routing-only-when branch from 235e884 to 46e4a3e Compare September 24, 2024 16:18
@jsy1218 jsy1218 changed the base branch from graphite-base/716 to main September 24, 2024 16:19
@jsy1218 jsy1218 force-pushed the siyujiang/route-291-special-treat-mixed-route-native-currency-routing-only-when branch from 46e4a3e to 35d8213 Compare September 24, 2024 16:19
@graphite-app graphite-app bot requested a review from a team September 24, 2024 16:23
@graphite-app graphite-app bot requested review from xrsv and cgkol September 24, 2024 16:23
Copy link

graphite-app bot commented Sep 24, 2024

Graphite Automations

"Request reviewers once CI passes on smart-order-router repo" took an action on this PR • (09/24/24)

4 reviewers were added and 1 assignee was added to this PR based on 's automation.

@jsy1218
Copy link
Member Author

jsy1218 commented Sep 27, 2024

After spoke to Alice, I realized this PR is not desirable. Mixed route can have a situation, where some are v2/v3 route with WETH input, meanwhile some are v4 route with ETH input. This is extremely difficult for universal-router-sdk to handle well. I'm not going to optimize for the case, where ETH -> X best quote is a mixed route, where v4 is ETH -> X, meanwhile v2/v3 is WETH -> X. But rather, I will keep the existing mixed routing logic, which is v4 returns WETH -> X, and v2/v3 returns WETH -> X. universal-router-sdk will understand to always wrap input, given mixed routing.

This means close this PR, and meanwhile the existing logic as well.

@jsy1218 jsy1218 closed this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants