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

asset conversion runtime quote api generalised #1442

Closed
wants to merge 17 commits into from

Conversation

gilescope
Copy link
Contributor

To get a quote from XYZ token to ABC token currently requires two runtime calls that then need to be combined (one call of XYZ to DOT and another DOT to ABC). This PR allows this to be done in one call and makes the quote api look more like the swap api.

It's a breaking api change, but the API has not been released on kusama yet. Devs in the field integrating this API have suggested they would like this change.

@gilescope gilescope added the T4-runtime_API This PR/Issue is related to runtime APIs. label Sep 7, 2023
@paritytech-ci paritytech-ci requested review from a team September 7, 2023 09:23
@paritytech-ci paritytech-ci requested a review from a team September 7, 2023 10:16
Copy link
Contributor

@jsidorenko jsidorenko left a comment

Choose a reason for hiding this comment

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

LGTM

substrate/frame/asset-conversion/src/tests.rs Outdated Show resolved Hide resolved
substrate/frame/asset-conversion/src/tests.rs Outdated Show resolved Hide resolved
substrate/frame/asset-conversion/src/tests.rs Outdated Show resolved Hide resolved
substrate/frame/asset-conversion/src/tests.rs Outdated Show resolved Hide resolved
@gilescope gilescope enabled auto-merge (squash) September 8, 2023 12:27
substrate/frame/asset-conversion/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

These changes should be made to the Fellowship repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Waiting on the fellowship runtimes to be updated such that kusama asset hub has the asset-conversion pallet in it. Then can address this.

@paritytech-ci paritytech-ci requested a review from a team September 15, 2023 05:55
@gilescope gilescope requested a review from a team September 18, 2023 06:22
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: cargo-clippy
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3982933

> for Runtime
{
fn quote_price_exact_tokens_for_tokens(asset1: NativeOrAssetId<u32>, asset2: NativeOrAssetId<u32>, amount: u128, include_fee: bool) -> Option<Balance> {
AssetConversion::quote_price_exact_tokens_for_tokens(asset1, asset2, amount, include_fee)
fn quote_price_exact_tokens_for_tokens(path: BoundedVec<NativeOrAssetId<u32>, MaxSwapLength>, amount: u128, include_fee: bool) -> Option<Balance> {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any reason to have this Vec bounded?
in this PR I actually simplifying the API, migrating from BoundedVec to Vec. the pallet still ensures it's not lager then max.
#1677

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We started with Vec originally and it got switched to BoundedVec.

Copy link
Member

Choose a reason for hiding this comment

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

Using BoundedVec in a runtime api makes no real sense?

@gilescope
Copy link
Contributor Author

Closing this as stale.

@gilescope gilescope closed this Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T4-runtime_API This PR/Issue is related to runtime APIs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants