Skip to content

Support white-listing of locations #703

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

Closed
stechu opened this issue Feb 22, 2022 · 5 comments
Closed

Support white-listing of locations #703

stechu opened this issue Feb 22, 2022 · 5 comments

Comments

@stechu
Copy link
Contributor

stechu commented Feb 22, 2022

One common error in XCM is when sending to unsupported location. It would be great for xtoken to provide an optional support for white-listing locations.

@xlc
Copy link
Member

xlc commented Feb 22, 2022

We could have a location filter, and another pallet to manage the whitelist registration

@stechu
Copy link
Contributor Author

stechu commented Feb 22, 2022

We could have a location filter, and another pallet to manage the whitelist registration

yeah, adding interface for hooking the other pallet that manage the whitelist registration and then xtoken can return an UnsupportedLocation error rather than returning XCMExecutionFailed would be nice.

@Dengjianping
Copy link
Contributor

Dengjianping commented Mar 1, 2022

Yeah, some teams are using hardcoded locations, some are using a on-chain manager to manage locations.

If xtoken is going to support getting location by manager, we can add an associated type to Config, just like:

#[pallet::config]
pub trait Config: frame_system::Config {
    // ...
    type WhiteListingMultiLocations: WhiteListingMultiLocations<Self::CurrencyId, Self::Balance>;
    // ...
}

And this trait WhiteListingMultiLocations should include methods like get supported location by CurrencyId.

pub trait WhiteListingMultiLocations<CurrencyId, Balance> {
    fn get_supported_locations(&self, currency_id: CurrencyId) -> Option<MultiLocation>;
    fn get_all_supported_locations(&self) -> Option<Vec<MultiLocation>>;
    fn get_xcm_fee(&self, currency_id: CurrencyId) -> Balance;
    // fn get_asset(&self, currency_id: CurrencyId) -> AssetInfo;
    // or more methods 
}

@xlc
Copy link
Member

xlc commented Mar 1, 2022

PRs are welcome.

@xlc
Copy link
Member

xlc commented Mar 25, 2022

closed by #714

@xlc xlc closed this as completed Mar 25, 2022
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

No branches or pull requests

3 participants