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