Skip to content

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.

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.

…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.

@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

4 participants