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

Routed Pablo LP Token Creation Through Assets Registry [No-CU] #2606

Closed

Conversation

PoisonPhang
Copy link
Contributor

Issue

LP Tokens were getting created without a ratio, leading to an ED of Balance::MAX

@itsbobbyzz
Copy link

@vercel
Copy link

vercel bot commented Dec 7, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated
pablo-nightly ⬜️ Ignored (Inspect) Dec 7, 2022 at 9:03PM (UTC)
picasso-nightly ⬜️ Ignored (Inspect) Dec 7, 2022 at 9:03PM (UTC)

Copy link
Contributor

@vimukthi-git vimukthi-git left a comment

Choose a reason for hiding this comment

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

LGTM, looks pretty minimal


let lp_token = T::CurrencyFactory::create(RangeId::LP_TOKENS)?;
let lp_token = T::AssetsRegistry::register_asset(
XcmAssetLocation::LOCAL_NATIVE,
Copy link
Contributor

Choose a reason for hiding this comment

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

This would not work AFAIK as we need to use a unique ID here

Copy link
Contributor

Choose a reason for hiding this comment

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

Tracking an ever incrementing next LP token ID in Pablo would be needed

Copy link
Contributor

Choose a reason for hiding this comment

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

It calls into currency factory

Copy link
Contributor

Choose a reason for hiding this comment

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

No I mean in asset-registry this value is used as a key for ForeignToLocal so this would not work after the first LP token if it's not unique

Copy link
Contributor

Choose a reason for hiding this comment

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

so this should perhaps be called something like "create_and_register"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tracking an ever incrementing next LP token ID in Pablo would be needed

Two+ counters/nonce for one type of token seems like a terrible misuse of storage

Copy link
Contributor

@vimukthi-git vimukthi-git Dec 7, 2022

Choose a reason for hiding this comment

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

hmm not really that bad when you think about the way Multilocation supposed to work https://github.com/paritytech/xcm-format#71-description. So Pablo is at the protocol/smart contract layer. Eventually we can migrate the assets-registry to remove tracking of another local identifier all together and just use Multilocation for mappings. This way we decentralize all asset "unique" ID tracking to each protocol and get rid of the currency factory at the same time. Anyway more stuff to add to your RFC later. For now just generating and storing a nonce is ok for Pablo IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This asset should also never be considered foreign. We'll eventually want AR (or something else) to be able to route between foreign and local assets. Maybe it's worth taking the time to at least prepare the interface of AR for that. Even if we don't go all the way with a full asset revamp just yet.

This would allow us to dynamically create local assets and, with a Multi Location, create foreign assets without unnecessary complexity and keeping storage abuse at a minimum.

I think something like Moonbeam's Asset Registrar can be implemented here but with more elegance.

Copy link
Contributor

Choose a reason for hiding this comment

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

This asset should also never be considered foreign.

Yes, as we agreed it's a temp solution. We can use the multi location to understand if the given asset is foreign or not later.

We'll eventually want AR (or something else) to be able to route between foreign and local assets

yes for BYOG I guess.

This would allow us to dynamically create local assets and, with a Multi Location, create foreign assets without unnecessary complexity and keeping storage abuse at a minimum.

Yes!

I think something like Moonbeam's Asset Registrar can be implemented here but with more elegance.

That would be cool to evolve into :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made updates to #2489 with my thoughts on this system

@PoisonPhang PoisonPhang marked this pull request as draft December 7, 2022 21:35
@PoisonPhang
Copy link
Contributor Author

Closing as this will instead be handled by #2624

@PoisonPhang PoisonPhang closed this Dec 8, 2022
@KaiserKarel KaiserKarel deleted the connor/lp-token-fix branch January 31, 2023 18:02
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.

4 participants