mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-07 11:58:01 +00:00
instantiate statemint
This commit is contained in:
@@ -72,7 +72,7 @@ where
|
||||
/// A `HandleCredit` implementation that naively transfers the fees to the block author.
|
||||
/// Will drop and burn the assets in case the transfer fails.
|
||||
pub struct AssetsToBlockAuthor<R, I>(PhantomData<(R, I)>);
|
||||
impl<R, I> HandleCredit<AccountIdOf<R>, pallet_assets::Pallet<R, I>> for AssetsToBlockAuthor<R>
|
||||
impl<R, I> HandleCredit<AccountIdOf<R>, pallet_assets::Pallet<R, I>> for AssetsToBlockAuthor<R, I>
|
||||
where
|
||||
I: 'static,
|
||||
R: pallet_authorship::Config + pallet_assets::Config<I>,
|
||||
|
||||
@@ -321,7 +321,7 @@ impl Default for ProxyType {
|
||||
Self::Any
|
||||
}
|
||||
}
|
||||
type TrustBackedAssetsCall = pallet_assets::Call<Runtime, frame_support::instances::Instance1>;
|
||||
type TrustBackedAssetsCall = pallet_assets::Call<Runtime, TrustBackedAssetsInstance>;
|
||||
impl InstanceFilter<RuntimeCall> for ProxyType {
|
||||
fn filter(&self, c: &RuntimeCall) -> bool {
|
||||
match self {
|
||||
@@ -533,7 +533,7 @@ impl pallet_asset_tx_payment::Config for Runtime {
|
||||
ConvertInto,
|
||||
TrustBackedAssetsInstance,
|
||||
>,
|
||||
AssetsToBlockAuthor<Runtime>,
|
||||
AssetsToBlockAuthor<Runtime, TrustBackedAssetsInstance>,
|
||||
>;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,9 @@ parameter_types! {
|
||||
pub type AssetsForceOrigin =
|
||||
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<DotLocation, ExecutiveBody>>>;
|
||||
|
||||
impl pallet_assets::Config for Runtime {
|
||||
pub type TrustBackedAssetsInstance = pallet_assets::Instance1;
|
||||
type TrustBackedAssetsCall = pallet_assets::Call<Runtime, TrustBackedAssetsInstance>;
|
||||
impl pallet_assets::Config<TrustBackedAssetsInstance> for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Balance = Balance;
|
||||
type AssetId = AssetId;
|
||||
@@ -357,7 +359,7 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
|
||||
ProxyType::NonTransfer => !matches!(
|
||||
c,
|
||||
RuntimeCall::Balances { .. } |
|
||||
RuntimeCall::Assets { .. } |
|
||||
RuntimeCall::TrustBackedAssets { .. } |
|
||||
RuntimeCall::Uniques { .. }
|
||||
),
|
||||
ProxyType::CancelProxy => matches!(
|
||||
@@ -369,7 +371,7 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
|
||||
ProxyType::Assets => {
|
||||
matches!(
|
||||
c,
|
||||
RuntimeCall::Assets { .. } |
|
||||
RuntimeCall::TrustBackedAssets { .. } |
|
||||
RuntimeCall::Utility { .. } |
|
||||
RuntimeCall::Multisig { .. } |
|
||||
RuntimeCall::Uniques { .. }
|
||||
@@ -377,12 +379,13 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
|
||||
},
|
||||
ProxyType::AssetOwner => matches!(
|
||||
c,
|
||||
RuntimeCall::Assets(pallet_assets::Call::create { .. }) |
|
||||
RuntimeCall::Assets(pallet_assets::Call::destroy { .. }) |
|
||||
RuntimeCall::Assets(pallet_assets::Call::transfer_ownership { .. }) |
|
||||
RuntimeCall::Assets(pallet_assets::Call::set_team { .. }) |
|
||||
RuntimeCall::Assets(pallet_assets::Call::set_metadata { .. }) |
|
||||
RuntimeCall::Assets(pallet_assets::Call::clear_metadata { .. }) |
|
||||
RuntimeCall::TrustBackedAssets(TrustBackedAssetsCall::create { .. }) |
|
||||
RuntimeCall::TrustBackedAssets(TrustBackedAssetsCall::destroy { .. }) |
|
||||
RuntimeCall::TrustBackedAssets(
|
||||
TrustBackedAssetsCall::transfer_ownership { .. }
|
||||
) | RuntimeCall::TrustBackedAssets(TrustBackedAssetsCall::set_team { .. }) |
|
||||
RuntimeCall::TrustBackedAssets(TrustBackedAssetsCall::set_metadata { .. }) |
|
||||
RuntimeCall::TrustBackedAssets(TrustBackedAssetsCall::clear_metadata { .. }) |
|
||||
RuntimeCall::Uniques(pallet_uniques::Call::create { .. }) |
|
||||
RuntimeCall::Uniques(pallet_uniques::Call::destroy { .. }) |
|
||||
RuntimeCall::Uniques(pallet_uniques::Call::transfer_ownership { .. }) |
|
||||
@@ -399,12 +402,12 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
|
||||
),
|
||||
ProxyType::AssetManager => matches!(
|
||||
c,
|
||||
RuntimeCall::Assets(pallet_assets::Call::mint { .. }) |
|
||||
RuntimeCall::Assets(pallet_assets::Call::burn { .. }) |
|
||||
RuntimeCall::Assets(pallet_assets::Call::freeze { .. }) |
|
||||
RuntimeCall::Assets(pallet_assets::Call::thaw { .. }) |
|
||||
RuntimeCall::Assets(pallet_assets::Call::freeze_asset { .. }) |
|
||||
RuntimeCall::Assets(pallet_assets::Call::thaw_asset { .. }) |
|
||||
RuntimeCall::TrustBackedAssets(TrustBackedAssetsCall::mint { .. }) |
|
||||
RuntimeCall::TrustBackedAssets(TrustBackedAssetsCall::burn { .. }) |
|
||||
RuntimeCall::TrustBackedAssets(TrustBackedAssetsCall::freeze { .. }) |
|
||||
RuntimeCall::TrustBackedAssets(TrustBackedAssetsCall::thaw { .. }) |
|
||||
RuntimeCall::TrustBackedAssets(TrustBackedAssetsCall::freeze_asset { .. }) |
|
||||
RuntimeCall::TrustBackedAssets(TrustBackedAssetsCall::thaw_asset { .. }) |
|
||||
RuntimeCall::Uniques(pallet_uniques::Call::mint { .. }) |
|
||||
RuntimeCall::Uniques(pallet_uniques::Call::burn { .. }) |
|
||||
RuntimeCall::Uniques(pallet_uniques::Call::freeze { .. }) |
|
||||
@@ -549,10 +552,15 @@ impl pallet_collator_selection::Config for Runtime {
|
||||
|
||||
impl pallet_asset_tx_payment::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Fungibles = Assets;
|
||||
type Fungibles = TrustBackedAssets;
|
||||
type OnChargeAssetTransaction = pallet_asset_tx_payment::FungiblesAdapter<
|
||||
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
|
||||
AssetsToBlockAuthor<Runtime>,
|
||||
pallet_assets::BalanceToAssetBalance<
|
||||
Balances,
|
||||
Runtime,
|
||||
ConvertInto,
|
||||
TrustBackedAssetsInstance,
|
||||
>,
|
||||
AssetsToBlockAuthor<Runtime, TrustBackedAssetsInstance>,
|
||||
>;
|
||||
}
|
||||
|
||||
@@ -628,7 +636,7 @@ construct_runtime!(
|
||||
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 42,
|
||||
|
||||
// The main stage.
|
||||
Assets: pallet_assets::{Pallet, Call, Storage, Event<T>} = 50,
|
||||
TrustBackedAssets: pallet_assets::<Instance1>::{Pallet, Call, Storage, Event<T>} = 50,
|
||||
Uniques: pallet_uniques::{Pallet, Call, Storage, Event<T>} = 51,
|
||||
}
|
||||
);
|
||||
@@ -664,8 +672,18 @@ pub type Executive = frame_executive::Executive<
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllPalletsWithSystem,
|
||||
MigrateAssetsPallet,
|
||||
>;
|
||||
|
||||
pub struct MigrateAssetsPallet;
|
||||
impl frame_support::traits::OnRuntimeUpgrade for MigrateAssetsPallet {
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
use frame_support::storage::migration;
|
||||
migration::move_pallet(b"Assets", b"TrustBackedAssets");
|
||||
<Runtime as frame_system::Config>::DbWeight::get().writes(1)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
#[macro_use]
|
||||
extern crate frame_benchmarking;
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
// limitations under the License.
|
||||
|
||||
use super::{
|
||||
AccountId, AllPalletsWithSystem, AssetId, Assets, Authorship, Balance, Balances, ParachainInfo,
|
||||
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee,
|
||||
XcmpQueue,
|
||||
AccountId, AllPalletsWithSystem, AssetId, Authorship, Balance, Balances, ParachainInfo,
|
||||
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
|
||||
TrustBackedAssets, WeightToFee, XcmpQueue,
|
||||
};
|
||||
use frame_support::{
|
||||
match_types, parameter_types,
|
||||
@@ -45,8 +45,8 @@ parameter_types! {
|
||||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
|
||||
pub const Local: MultiLocation = MultiLocation::here();
|
||||
pub AssetsPalletLocation: MultiLocation =
|
||||
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
|
||||
pub TrustBackedAssetsPalletLocation: MultiLocation =
|
||||
PalletInstance(<TrustBackedAssets as PalletInfoAccess>::index() as u8).into();
|
||||
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ pub type CurrencyTransactor = CurrencyAdapter<
|
||||
/// Means for transacting assets besides the native currency on this chain.
|
||||
pub type FungiblesTransactor = FungiblesAdapter<
|
||||
// Use this fungibles implementation:
|
||||
Assets,
|
||||
TrustBackedAssets,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
ConvertedConcreteId<
|
||||
AssetId,
|
||||
Balance,
|
||||
AsPrefixedGeneralIndex<AssetsPalletLocation, AssetId, JustTry>,
|
||||
AsPrefixedGeneralIndex<TrustBackedAssetsPalletLocation, AssetId, JustTry>,
|
||||
JustTry,
|
||||
>,
|
||||
// Convert an XCM MultiLocation into a local account id:
|
||||
@@ -93,7 +93,7 @@ pub type FungiblesTransactor = FungiblesAdapter<
|
||||
AccountId,
|
||||
// We only want to allow teleports of known assets. We use non-zero issuance as an indication
|
||||
// that this asset is known.
|
||||
parachains_common::impls::NonZeroIssuance<AccountId, Assets>,
|
||||
parachains_common::impls::NonZeroIssuance<AccountId, TrustBackedAssets>,
|
||||
// The account to use for tracking teleports.
|
||||
CheckingAccount,
|
||||
>;
|
||||
|
||||
@@ -249,19 +249,6 @@ impl pallet_assets::Config<TrustBackedAssetsInstance> for Runtime {
|
||||
type Helper = ();
|
||||
}
|
||||
|
||||
// This is frustrating...
|
||||
// use pallet_assets::BenchmarkHelper;
|
||||
// pub struct XcmBenchmarkHelper;
|
||||
// #[cfg(feature = "runtime-benchmarks")]
|
||||
// impl<AssetId: From<MultiLocationForAssetId>> BenchmarkHelper<AssetId> for XcmBenchmarkHelper {
|
||||
// fn create_asset_id(id: u32) -> AssetId {
|
||||
// match id {
|
||||
// x => MultiLocationForAssetId { parents: 1, interior: X1(Parachain(x)) },
|
||||
// _ => MultiLocationForAssetId { parents: 0, interior: Here },
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/// Assets managed by some foreign location.
|
||||
type ForeignAssetsInstance = pallet_assets::Instance2;
|
||||
impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
|
||||
@@ -281,7 +268,7 @@ impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
|
||||
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
|
||||
type AssetAccountDeposit = AssetAccountDeposit;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type Helper = ();
|
||||
type Helper = (); //XcmBenchmarkHelper;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -356,7 +343,7 @@ impl Default for ProxyType {
|
||||
Self::Any
|
||||
}
|
||||
}
|
||||
type TrustBackedAssetsCall = pallet_assets::Call<Runtime, frame_support::instances::Instance1>;
|
||||
type TrustBackedAssetsCall = pallet_assets::Call<Runtime, TrustBackedAssetsInstance>;
|
||||
impl InstanceFilter<RuntimeCall> for ProxyType {
|
||||
fn filter(&self, c: &RuntimeCall) -> bool {
|
||||
match self {
|
||||
@@ -563,7 +550,7 @@ impl pallet_asset_tx_payment::Config for Runtime {
|
||||
ConvertInto,
|
||||
TrustBackedAssetsInstance,
|
||||
>,
|
||||
AssetsToBlockAuthor<Runtime>,
|
||||
AssetsToBlockAuthor<Runtime, TrustBackedAssetsInstance>,
|
||||
>;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,16 @@ parameter_types! {
|
||||
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
||||
}
|
||||
|
||||
// This is frustrating...
|
||||
// use pallet_assets::BenchmarkHelper;
|
||||
// pub struct XcmBenchmarkHelper;
|
||||
// #[cfg(feature = "runtime-benchmarks")]
|
||||
// impl<MultiLocation: From<u32>> BenchmarkHelper<MultiLocation> for XcmBenchmarkHelper {
|
||||
// fn create_asset_id(id: u32) -> MultiLocation {
|
||||
// (Parent, Parachain(id)).into()
|
||||
// }
|
||||
// }
|
||||
|
||||
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
|
||||
/// when determining ownership of accounts for asset transacting and when attempting to use XCM
|
||||
/// `Transact` in order to determine the dispatch Origin.
|
||||
|
||||
Reference in New Issue
Block a user