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

Add split route support in all adapters #103

Merged
merged 4 commits into from
Apr 30, 2024
Merged

Conversation

thal0x
Copy link
Member

@thal0x thal0x commented Apr 25, 2024

Updates adapter contracts to support multiple routes. Excluding:

Updates osmosis-std to access split route types

Note: I checked the Dexter router code and they properly track balances between swaps so the edge case found in #99 won't be an issue.

@thal0x thal0x self-assigned this Apr 25, 2024
@NotJeremyLiu
Copy link
Member

NotJeremyLiu commented Apr 29, 2024

Lido Satellite, doesn't seem relevant

@thal0x Don't we have to change interfaces for all swap adapters no matter what? How would this be called by the entrypoint without a change in interface?

minimum_receive: None,
};

// let denom_in = route.operations.first().unwrap().denom_in.clone();
Copy link
Member

Choose a reason for hiding this comment

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

remove comment

@thal0x
Copy link
Member Author

thal0x commented Apr 29, 2024

Lido Satellite, doesn't seem relevant

@thal0x Don't we have to change interfaces for all swap adapters no matter what? How would this be called by the entrypoint without a change in interface?

The interface was already updated this PR just changes the logic to not error on multiple routes


// validate that the one coin is the same as the first swap operation's denom in
if coin.denom != operations.first().unwrap().denom_in {
Copy link
Member

Choose a reason for hiding this comment

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

Do we do validation elsewhere that makes the validations you deleted no longer be relevant? I don't seem to see any validation but may be missing it

Copy link
Member

Choose a reason for hiding this comment

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

Oh we do validation in entrypoint so we shouldn't need this... I see

@@ -159,22 +145,40 @@ fn execute_swap(
return Err(ContractError::Unauthorized);
}

// reset the pre swap out asset amount
PRE_SWAP_OUT_ASSET_AMOUNT.save(deps.storage, &Uint128::new(0))?;
Copy link
Member

Choose a reason for hiding this comment

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

Same comment I had on the astroport version

Copy link
Member

@NotJeremyLiu NotJeremyLiu left a comment

Choose a reason for hiding this comment

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

left some comments

@thal0x thal0x merged commit 1fa4f21 into main Apr 30, 2024
5 checks passed
@thal0x thal0x deleted the jw/split-router-adapters branch April 30, 2024 11:04
thal0x added a commit that referenced this pull request May 7, 2024
thal0x added a commit that referenced this pull request May 7, 2024
* 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.
thal0x added a commit that referenced this pull request May 8, 2024
* 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 <31809888+NotJeremyLiu@users.noreply.github.com>
thal0x added a commit that referenced this pull request May 8, 2024
* 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 <thal0x.eth@gmail.com>

---------

Co-authored-by: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com>
Co-authored-by: Yonggiee <58546952+Yonggiee@users.noreply.github.com>
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.

None yet

2 participants