git.delta.rocks / unique-network / refs/commits / 9e3831c3a333

difftreelog

fix disable xcm teleports

Daniel Shiposha2022-12-22parent: #3673a42.patch.diff
in: master

1 file changed

modifiedruntime/common/config/xcm/foreignassets.rsdiffbeforeafterboth
18 traits::{Contains, Get, fungibles},18 traits::{Contains, Get, fungibles},
19 parameter_types,19 parameter_types,
20};20};
21use sp_runtime::traits::{Zero, Convert};21use sp_runtime::traits::Convert;
22use xcm::v1::{Junction::*, MultiLocation, Junctions::*};22use xcm::v1::{Junction::*, MultiLocation, Junctions::*};
23use xcm::latest::MultiAsset;23use xcm::latest::MultiAsset;
24use xcm_builder::{FungiblesAdapter, ConvertedConcreteAssetId};24use xcm_builder::{FungiblesAdapter, ConvertedConcreteAssetId};
38 pub CheckingAccount: AccountId = PolkadotXcm::check_account();38 pub CheckingAccount: AccountId = PolkadotXcm::check_account();
39}39}
4040
41/// Allow checking in assets that have issuance > 0.41/// No teleports are allowed
42pub struct NonZeroIssuance<AccountId, ForeignAssets>(PhantomData<(AccountId, ForeignAssets)>);42pub struct NoTeleports<AccountId, ForeignAssets>(PhantomData<(AccountId, ForeignAssets)>);
4343
44impl<AccountId, ForeignAssets> Contains<<ForeignAssets as fungibles::Inspect<AccountId>>::AssetId>44impl<AccountId, ForeignAssets> Contains<<ForeignAssets as fungibles::Inspect<AccountId>>::AssetId>
45 for NonZeroIssuance<AccountId, ForeignAssets>45 for NoTeleports<AccountId, ForeignAssets>
46where46where
47 ForeignAssets: fungibles::Inspect<AccountId>,47 ForeignAssets: fungibles::Inspect<AccountId>,
48{48{
49 fn contains(id: &<ForeignAssets as fungibles::Inspect<AccountId>>::AssetId) -> bool {49 fn contains(_id: &<ForeignAssets as fungibles::Inspect<AccountId>>::AssetId) -> bool {
50 !ForeignAssets::total_issuance(*id).is_zero()50 false
51 }51 }
52}52}
5353
132 LocationToAccountId,132 LocationToAccountId,
133 // Our chain's account ID type (we can't get away without mentioning it explicitly):133 // Our chain's account ID type (we can't get away without mentioning it explicitly):
134 AccountId,134 AccountId,
135 // We only want to allow teleports of known assets. We use non-zero issuance as an indication135 // No teleports are allowed
136 // that this asset is known.
137 NonZeroIssuance<AccountId, ForeignAssets>,136 NoTeleports<AccountId, ForeignAssets>,
138 // The account to use for tracking teleports.137 // The account to use for tracking teleports.
139 CheckingAccount,138 CheckingAccount,
140>;139>;