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

241 update spacewalk dependencies and configure the lp token for use with the zenlink pallet #246

Conversation

adelarja
Copy link
Contributor

This PR is related to these issues: Add ZenlinkLPToken to CurrencyId enum and Add the conversion functions between Zenlink Assets and Spacewalk Assets.

For more details about how the conversion functions work, read this and this comment.

At the beginning, the conversion functions were developed using the TryFrom trait. For that, a wrapper struct was needed because neither the TryFrom trait nor the CurrencyId enum was defined in our crate. In the end, we also needed to create a function to handle the wrapper type, so I decided to use functions to convert between Spacewalk assets and Zenlink assets.

To enhance code organization and cleanliness, the conversion functions were divided into zenlink_id_to_currency_id and currency_id_to_zenlink_id.

To ensure the code can be used across all our runtimes, it was placed in a separate file within the common directory of the runtime. The currency_id_to_zenlink_id function may not be utilized at the moment, but we can retain it in case it is needed in the future.

Additionally, some unit tests were added to verify the functionality of these functions.

If I'm not mistaken, we'll need this pull request (PR) to be merged before we can merge the current one. I made a local test by merging it into my branch, and it successfully resolved several dependency issues between Spacewalk and Pendulum.

@adelarja adelarja requested a review from a team June 20, 2023 14:24
adelarja added 2 commits June 20, 2023 12:25
deleted unnecessary dependencies.
Updated spacewalk dependencies.
Copy link
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

I love it. Thanks for the time and writing the proper tests @adelarja. The tests show quite well how the conversion works.

I left some comments.

runtime/common/src/zenlink.rs Show resolved Hide resolved
runtime/common/src/zenlink.rs Show resolved Hide resolved
runtime/common/src/zenlink.rs Outdated Show resolved Hide resolved
runtime/common/src/zenlink.rs Outdated Show resolved Hide resolved
runtime/common/src/zenlink.rs Outdated Show resolved Hide resolved
adelarja added 5 commits June 21, 2023 08:06
…token-for-use-with-the-zenlink-pallet' of github.com:pendulum-chain/pendulum into 241-update-spacewalk-dependencies-and-configure-the-lp-token-for-use-with-the-zenlink-pallet
… asset chain_id and the parachain_id are the same.
@adelarja adelarja marked this pull request as ready for review June 23, 2023 13:05
@adelarja adelarja changed the title [WIP] 241 update spacewalk dependencies and configure the lp token for use with the zenlink pallet 241 update spacewalk dependencies and configure the lp token for use with the zenlink pallet Jun 23, 2023
Copy link
Contributor

@TorstenStueber TorstenStueber left a comment

Choose a reason for hiding this comment

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

As a general comment: it is super minor but I think we should have standard policy about naming variables. I don't see a need to have some variable names start with an underscore and I don't think that this style is used by the rest of the team.

runtime/common/src/zenlink.rs Outdated Show resolved Hide resolved
runtime/common/src/zenlink.rs Outdated Show resolved Hide resolved
runtime/common/src/zenlink.rs Outdated Show resolved Hide resolved
…tion, allowing us to use a discriminant of 3 for the Zenlink LP token.
@ebma
Copy link
Member

ebma commented Jul 10, 2023

LGTM overall.
But one last thing that now came to my mind is that the changes you added are only targeting the Foucoco Zenlink configuration. @adelarja let's also change the Zenlink configuration for Amplitude and Pendulum as part of this PR. I checked and the related issue ticket does not mention any network explicitly so I think we should assume that the changes are supposed to happen for all of our chains at the same time.

Copy link
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

Everything looks good to me. I just suggested some changes so that we have it a little easier to see what the raw byte keys of the Stellar assets represent.
I'd say this PR is now ready for merge.

runtime/common/src/stellar.rs Show resolved Hide resolved
runtime/common/src/stellar.rs Show resolved Hide resolved
runtime/common/src/stellar.rs Show resolved Hide resolved
@ebma ebma merged commit f0ee380 into main Jul 17, 2023
@ebma ebma deleted the 241-update-spacewalk-dependencies-and-configure-the-lp-token-for-use-with-the-zenlink-pallet branch July 17, 2023 13:53
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.

Update spacewalk dependencies and configure the LP token for use with the Zenlink pallet
3 participants