mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 20:07:56 +00:00
[Feature] Limit collectives teleports to DOT (#1579)
* [Feature] Limit collectives teleports to DOT * Update pallets/xcm/src/lib.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * fix review comments * Update parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * [ci] Apply cargo-fmt Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> Co-authored-by: Chevdor <chevdor@users.noreply.github.com> Co-authored-by: paritytech-ci <paritytech-ci@parity.io>
This commit is contained in:
@@ -5,8 +5,9 @@ use frame_support::{
|
||||
traits::{fungibles::Inspect, tokens::BalanceConversion},
|
||||
weights::{Weight, WeightToFee, WeightToFeePolynomial},
|
||||
};
|
||||
use sp_runtime::traits::Get;
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_executor::traits::ShouldExecute;
|
||||
use xcm_executor::traits::{FilterAssetLocation, ShouldExecute};
|
||||
|
||||
//TODO: move DenyThenTry to polkadot's xcm module.
|
||||
/// Deny executing the XCM if it matches any of the Deny filter regardless of anything else.
|
||||
@@ -107,3 +108,14 @@ where
|
||||
Ok(asset_amount)
|
||||
}
|
||||
}
|
||||
|
||||
/// Accepts an asset if it is a native asset from a particular `MultiLocation`.
|
||||
pub struct ConcreteNativeAssetFrom<Location>(PhantomData<Location>);
|
||||
impl<Location: Get<MultiLocation>> FilterAssetLocation for ConcreteNativeAssetFrom<Location> {
|
||||
fn filter_asset_location(asset: &MultiAsset, origin: &MultiLocation) -> bool {
|
||||
log::trace!(target: "xcm::filter_asset_location",
|
||||
"ConcreteNativeAsset asset: {:?}, origin: {:?}, location: {:?}",
|
||||
asset, origin, Location::get());
|
||||
matches!(asset.id, Concrete(ref id) if id == origin && origin == &Location::get())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user