-
Notifications
You must be signed in to change notification settings - Fork 32
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
Support split routes in entry point contract #101
Conversation
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.
approving to unblock but left comments/considerations to address
contracts/entry-point/src/execute.rs
Outdated
.enumerate() | ||
.max_by_key(|(_, route)| route.offer_asset.amount()) | ||
.map(|(idx, _)| idx) | ||
.unwrap() |
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.
How does the handle routes with the same amount in? Is it first route or does it error be if there's a tie?
Also using unwrap in general is a practice that should be avoided / used in tests but not prod code if can be caught and given a useful error instead
contracts/entry-point/src/execute.rs
Outdated
@@ -646,3 +686,26 @@ fn query_swap_asset_in( | |||
|
|||
Ok(fee_swap_asset_in) | |||
} | |||
|
|||
// fn get_largest_route_idx(routes: Vec<Route>) -> usize { |
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.
Delete commented out fn
&deps, | ||
fee_swap, | ||
&mut remaining_asset, | ||
&ibc_fee_coin, | ||
)?; | ||
|
||
// Update the user swap to deduct the ibc fee amount from the route | ||
// with the largest input amount | ||
user_swap = match user_swap.clone() { |
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.
This logic makes sense to me, it just has to match with what the server does
* Revert "Add split route support in all adapters (#103)" This reverts commit 1fa4f21. * Revert "Support multiple routes in astroport adapter (#99)" This reverts commit a95f17d. * Revert "Support split routes in entry point contract (#101)" This reverts commit 94c3bbf. * Revert "Update contract types to support route splitting (#98)" This reverts commit ec1fd57. * Revert "add interface field to SwapOperation (#96)" This reverts commit eb37618.
* add SmartSwapExactAssetIn swap type * Revert "Add split route support in all adapters (#103)" This reverts commit 1fa4f21. * Revert "Support multiple routes in astroport adapter (#99)" This reverts commit a95f17d. * Revert "Support split routes in entry point contract (#101)" This reverts commit 94c3bbf. * Revert "Update contract types to support route splitting (#98)" This reverts commit ec1fd57. * Revert "add interface field to SwapOperation (#96)" This reverts commit eb37618. * remove deployed test contracts * fix fmt issue * update schema * since user_swap is mutatable, we can mutate in place * swap excess funds * update schema * lint change * fix test * add optional interface field to SwapOperation (#108) * return error for largest_route_index --------- Co-authored-by: Jeremy Liu <[email protected]>
* add SmartSwapExactAssetIn swap type * Revert "Add split route support in all adapters (#103)" This reverts commit 1fa4f21. * Revert "Support multiple routes in astroport adapter (#99)" This reverts commit a95f17d. * Revert "Support split routes in entry point contract (#101)" This reverts commit 94c3bbf. * Revert "Update contract types to support route splitting (#98)" This reverts commit ec1fd57. * Revert "add interface field to SwapOperation (#96)" This reverts commit eb37618. * remove deployed test contracts * fix fmt issue * update schema * since user_swap is mutatable, we can mutate in place * swap excess funds * update schema * lint change * fix test * add optional interface field to SwapOperation (#108) * return error for largest_route_index * [API-2792] Add hallswap adapter (#102) * feat: add hallswap adapter * chore: add readme * pr fixes * add optional interface field to SwapOperation * update hallswap adapter to implement updated interface * remove get_hallswap_routes_from_skip_routes --------- Co-authored-by: thal0x <[email protected]> --------- Co-authored-by: Jeremy Liu <[email protected]> Co-authored-by: Yonggiee <[email protected]>
Updates the Entry Point contract to support multiple routes when calling
SwapExactAssetIn
.SwapExactAssetOut
will continue to be unsupported for the time being due to added complexity and no current integrators supporting this anyways.