mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 11:31:05 +00:00
Instantiate All Assets Pallets (#1908)
* instantiate all assets pallets * assets instance * fmt * fix merge errors * fmt * no default instance * Generic AssetFeeAsExistentialDepositMultiplier Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * remove old import * don't rename pallet in runtime * fix merge Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -68,16 +68,17 @@ 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>(PhantomData<R>);
|
pub struct AssetsToBlockAuthor<R, I>(PhantomData<(R, I)>);
|
||||||
impl<R> HandleCredit<AccountIdOf<R>, pallet_assets::Pallet<R>> for AssetsToBlockAuthor<R>
|
impl<R, I> HandleCredit<AccountIdOf<R>, pallet_assets::Pallet<R, I>> for AssetsToBlockAuthor<R, I>
|
||||||
where
|
where
|
||||||
R: pallet_authorship::Config + pallet_assets::Config,
|
I: 'static,
|
||||||
|
R: pallet_authorship::Config + pallet_assets::Config<I>,
|
||||||
AccountIdOf<R>: From<polkadot_primitives::AccountId> + Into<polkadot_primitives::AccountId>,
|
AccountIdOf<R>: From<polkadot_primitives::AccountId> + Into<polkadot_primitives::AccountId>,
|
||||||
{
|
{
|
||||||
fn handle_credit(credit: CreditOf<AccountIdOf<R>, pallet_assets::Pallet<R>>) {
|
fn handle_credit(credit: CreditOf<AccountIdOf<R>, pallet_assets::Pallet<R, I>>) {
|
||||||
if let Some(author) = pallet_authorship::Pallet::<R>::author() {
|
if let Some(author) = pallet_authorship::Pallet::<R>::author() {
|
||||||
// In case of error: Will drop the result triggering the `OnDrop` of the imbalance.
|
// In case of error: Will drop the result triggering the `OnDrop` of the imbalance.
|
||||||
let _ = pallet_assets::Pallet::<R>::resolve(&author, credit);
|
let _ = pallet_assets::Pallet::<R, I>::resolve(&author, credit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ mod types {
|
|||||||
pub type StatemintAuraId = sp_consensus_aura::ed25519::AuthorityId;
|
pub type StatemintAuraId = sp_consensus_aura::ed25519::AuthorityId;
|
||||||
|
|
||||||
// Id used for identifying assets.
|
// Id used for identifying assets.
|
||||||
pub type AssetId = u32;
|
pub type AssetIdForTrustBackedAssets = u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Common constants of parachains.
|
/// Common constants of parachains.
|
||||||
|
|||||||
@@ -76,30 +76,37 @@ impl ShouldExecute for DenyReserveTransferToRelayChain {
|
|||||||
/// A `ChargeFeeInFungibles` implementation that converts the output of
|
/// A `ChargeFeeInFungibles` implementation that converts the output of
|
||||||
/// a given WeightToFee implementation an amount charged in
|
/// a given WeightToFee implementation an amount charged in
|
||||||
/// a particular assetId from pallet-assets
|
/// a particular assetId from pallet-assets
|
||||||
pub struct AssetFeeAsExistentialDepositMultiplier<Runtime, WeightToFee, BalanceConverter>(
|
pub struct AssetFeeAsExistentialDepositMultiplier<
|
||||||
PhantomData<(Runtime, WeightToFee, BalanceConverter)>,
|
Runtime,
|
||||||
);
|
WeightToFee,
|
||||||
impl<CurrencyBalance, Runtime, WeightToFee, BalanceConverter>
|
BalanceConverter,
|
||||||
|
AssetInstance: 'static,
|
||||||
|
>(PhantomData<(Runtime, WeightToFee, BalanceConverter, AssetInstance)>);
|
||||||
|
impl<CurrencyBalance, Runtime, WeightToFee, BalanceConverter, AssetInstance>
|
||||||
cumulus_primitives_utility::ChargeWeightInFungibles<
|
cumulus_primitives_utility::ChargeWeightInFungibles<
|
||||||
AccountIdOf<Runtime>,
|
AccountIdOf<Runtime>,
|
||||||
pallet_assets::Pallet<Runtime>,
|
pallet_assets::Pallet<Runtime, AssetInstance>,
|
||||||
> for AssetFeeAsExistentialDepositMultiplier<Runtime, WeightToFee, BalanceConverter>
|
> for AssetFeeAsExistentialDepositMultiplier<Runtime, WeightToFee, BalanceConverter, AssetInstance>
|
||||||
where
|
where
|
||||||
Runtime: pallet_assets::Config,
|
Runtime: pallet_assets::Config<AssetInstance>,
|
||||||
WeightToFee: WeightToFeePolynomial<Balance = CurrencyBalance>,
|
WeightToFee: WeightToFeePolynomial<Balance = CurrencyBalance>,
|
||||||
BalanceConverter: BalanceConversion<
|
BalanceConverter: BalanceConversion<
|
||||||
CurrencyBalance,
|
CurrencyBalance,
|
||||||
<Runtime as pallet_assets::Config>::AssetId,
|
<Runtime as pallet_assets::Config<AssetInstance>>::AssetId,
|
||||||
<Runtime as pallet_assets::Config>::Balance,
|
<Runtime as pallet_assets::Config<AssetInstance>>::Balance,
|
||||||
>,
|
>,
|
||||||
AccountIdOf<Runtime>:
|
AccountIdOf<Runtime>:
|
||||||
From<polkadot_primitives::AccountId> + Into<polkadot_primitives::AccountId>,
|
From<polkadot_primitives::AccountId> + Into<polkadot_primitives::AccountId>,
|
||||||
{
|
{
|
||||||
fn charge_weight_in_fungibles(
|
fn charge_weight_in_fungibles(
|
||||||
asset_id: <pallet_assets::Pallet<Runtime> as Inspect<AccountIdOf<Runtime>>>::AssetId,
|
asset_id: <pallet_assets::Pallet<Runtime, AssetInstance> as Inspect<
|
||||||
|
AccountIdOf<Runtime>,
|
||||||
|
>>::AssetId,
|
||||||
weight: Weight,
|
weight: Weight,
|
||||||
) -> Result<<pallet_assets::Pallet<Runtime> as Inspect<AccountIdOf<Runtime>>>::Balance, XcmError>
|
) -> Result<
|
||||||
{
|
<pallet_assets::Pallet<Runtime, AssetInstance> as Inspect<AccountIdOf<Runtime>>>::Balance,
|
||||||
|
XcmError,
|
||||||
|
> {
|
||||||
let amount = WeightToFee::weight_to_fee(&weight);
|
let amount = WeightToFee::weight_to_fee(&weight);
|
||||||
// If the amount gotten is not at least the ED, then make it be the ED of the asset
|
// If the amount gotten is not at least the ED, then make it be the ED of the asset
|
||||||
// This is to avoid burning assets and decreasing the supply
|
// This is to avoid burning assets and decreasing the supply
|
||||||
|
|||||||
@@ -60,8 +60,9 @@ use frame_system::{
|
|||||||
pub use parachains_common as common;
|
pub use parachains_common as common;
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::{AssetsToBlockAuthor, DealWithFees},
|
impls::{AssetsToBlockAuthor, DealWithFees},
|
||||||
opaque, AccountId, AssetId, AuraId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
opaque, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header,
|
||||||
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT,
|
||||||
|
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||||
};
|
};
|
||||||
use xcm_config::{KsmLocation, XcmConfig};
|
use xcm_config::{KsmLocation, XcmConfig};
|
||||||
|
|
||||||
@@ -231,11 +232,16 @@ parameter_types! {
|
|||||||
pub type AssetsForceOrigin =
|
pub type AssetsForceOrigin =
|
||||||
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<KsmLocation, ExecutiveBody>>>;
|
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<KsmLocation, ExecutiveBody>>>;
|
||||||
|
|
||||||
impl pallet_assets::Config for Runtime {
|
// Called "Trust Backed" assets because these are generally registered by some account, and users of
|
||||||
|
// the asset assume it has some claimed backing. The pallet is called `Assets` in
|
||||||
|
// `construct_runtime` to avoid breaking changes on storage reads.
|
||||||
|
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 = AssetIdForTrustBackedAssets;
|
||||||
type AssetIdParameter = codec::Compact<AssetId>;
|
type AssetIdParameter = codec::Compact<AssetIdForTrustBackedAssets>;
|
||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
||||||
type ForceOrigin = AssetsForceOrigin;
|
type ForceOrigin = AssetsForceOrigin;
|
||||||
@@ -353,15 +359,15 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
|
|||||||
},
|
},
|
||||||
ProxyType::AssetOwner => matches!(
|
ProxyType::AssetOwner => matches!(
|
||||||
c,
|
c,
|
||||||
RuntimeCall::Assets(pallet_assets::Call::create { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::create { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::start_destroy { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::start_destroy { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::destroy_accounts { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::destroy_accounts { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::destroy_approvals { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::destroy_approvals { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::finish_destroy { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::finish_destroy { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::transfer_ownership { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::transfer_ownership { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::set_team { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::set_team { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::set_metadata { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::set_metadata { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::clear_metadata { .. }) |
|
RuntimeCall::Assets(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 { .. }) |
|
||||||
@@ -378,12 +384,12 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
|
|||||||
),
|
),
|
||||||
ProxyType::AssetManager => matches!(
|
ProxyType::AssetManager => matches!(
|
||||||
c,
|
c,
|
||||||
RuntimeCall::Assets(pallet_assets::Call::mint { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::mint { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::burn { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::burn { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::freeze { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::freeze { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::thaw { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::thaw { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::freeze_asset { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::freeze_asset { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::thaw_asset { .. }) |
|
RuntimeCall::Assets(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 { .. }) |
|
||||||
@@ -544,8 +550,13 @@ impl pallet_asset_tx_payment::Config for Runtime {
|
|||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type Fungibles = Assets;
|
type Fungibles = Assets;
|
||||||
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>,
|
||||||
>;
|
>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,7 +632,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,
|
Assets: 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,
|
||||||
|
|
||||||
#[cfg(feature = "state-trie-version-1")]
|
#[cfg(feature = "state-trie-version-1")]
|
||||||
@@ -653,7 +664,7 @@ pub type UncheckedExtrinsic =
|
|||||||
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
||||||
/// Extrinsic type that has already been checked.
|
/// Extrinsic type that has already been checked.
|
||||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;
|
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;
|
||||||
|
/// Migrations to apply on runtime upgrade.
|
||||||
pub type Migrations = ();
|
pub type Migrations = ();
|
||||||
|
|
||||||
/// Executive: handles dispatch to the various modules.
|
/// Executive: handles dispatch to the various modules.
|
||||||
|
|||||||
@@ -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, AssetIdForTrustBackedAssets, Assets, Authorship, Balance,
|
||||||
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee,
|
Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent,
|
||||||
XcmpQueue,
|
RuntimeOrigin, TrustBackedAssetsInstance, WeightToFee, XcmpQueue,
|
||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
match_types, parameter_types,
|
match_types, parameter_types,
|
||||||
@@ -53,7 +53,7 @@ parameter_types! {
|
|||||||
pub UniversalLocation: InteriorMultiLocation =
|
pub UniversalLocation: InteriorMultiLocation =
|
||||||
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
|
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
|
||||||
pub const Local: MultiLocation = Here.into_location();
|
pub const Local: MultiLocation = Here.into_location();
|
||||||
pub AssetsPalletLocation: MultiLocation =
|
pub TrustBackedAssetsPalletLocation: MultiLocation =
|
||||||
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
|
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
|
||||||
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
||||||
}
|
}
|
||||||
@@ -90,9 +90,13 @@ pub type FungiblesTransactor = FungiblesAdapter<
|
|||||||
Assets,
|
Assets,
|
||||||
// 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,
|
AssetIdForTrustBackedAssets,
|
||||||
Balance,
|
Balance,
|
||||||
AsPrefixedGeneralIndex<AssetsPalletLocation, AssetId, JustTry>,
|
AsPrefixedGeneralIndex<
|
||||||
|
TrustBackedAssetsPalletLocation,
|
||||||
|
AssetIdForTrustBackedAssets,
|
||||||
|
JustTry,
|
||||||
|
>,
|
||||||
JustTry,
|
JustTry,
|
||||||
>,
|
>,
|
||||||
// Convert an XCM MultiLocation into a local account id:
|
// Convert an XCM MultiLocation into a local account id:
|
||||||
@@ -271,7 +275,8 @@ pub type Barrier = DenyThenTry<
|
|||||||
pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier<
|
pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier<
|
||||||
Runtime,
|
Runtime,
|
||||||
WeightToFee,
|
WeightToFee,
|
||||||
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
|
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto, TrustBackedAssetsInstance>,
|
||||||
|
TrustBackedAssetsInstance,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
pub struct XcmConfig;
|
pub struct XcmConfig;
|
||||||
@@ -298,9 +303,13 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
AccountId,
|
AccountId,
|
||||||
AssetFeeAsExistentialDepositMultiplierFeeCharger,
|
AssetFeeAsExistentialDepositMultiplierFeeCharger,
|
||||||
ConvertedConcreteId<
|
ConvertedConcreteId<
|
||||||
AssetId,
|
AssetIdForTrustBackedAssets,
|
||||||
Balance,
|
Balance,
|
||||||
AsPrefixedGeneralIndex<AssetsPalletLocation, AssetId, JustTry>,
|
AsPrefixedGeneralIndex<
|
||||||
|
TrustBackedAssetsPalletLocation,
|
||||||
|
AssetIdForTrustBackedAssets,
|
||||||
|
JustTry,
|
||||||
|
>,
|
||||||
JustTry,
|
JustTry,
|
||||||
>,
|
>,
|
||||||
Assets,
|
Assets,
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ use frame_system::{
|
|||||||
pub use parachains_common as common;
|
pub use parachains_common as common;
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::{AssetsToBlockAuthor, DealWithFees},
|
impls::{AssetsToBlockAuthor, DealWithFees},
|
||||||
opaque, AccountId, AssetId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
opaque, AccountId, AssetIdForTrustBackedAssets, Balance, BlockNumber, Hash, Header, Index,
|
||||||
StatemintAuraId as AuraId, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT,
|
Signature, StatemintAuraId as AuraId, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT,
|
||||||
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||||
};
|
};
|
||||||
use xcm_config::{DotLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
|
use xcm_config::{DotLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
|
||||||
@@ -247,11 +247,16 @@ 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 {
|
// Called "Trust Backed" assets because these are generally registered by some account, and users of
|
||||||
|
// the asset assume it has some claimed backing. The pallet is called `Assets` in
|
||||||
|
// `construct_runtime` to avoid breaking changes on storage reads.
|
||||||
|
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 = AssetIdForTrustBackedAssets;
|
||||||
type AssetIdParameter = codec::Compact<AssetId>;
|
type AssetIdParameter = codec::Compact<AssetIdForTrustBackedAssets>;
|
||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
||||||
type ForceOrigin = AssetsForceOrigin;
|
type ForceOrigin = AssetsForceOrigin;
|
||||||
@@ -369,15 +374,15 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
|
|||||||
},
|
},
|
||||||
ProxyType::AssetOwner => matches!(
|
ProxyType::AssetOwner => matches!(
|
||||||
c,
|
c,
|
||||||
RuntimeCall::Assets(pallet_assets::Call::create { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::create { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::start_destroy { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::start_destroy { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::destroy_accounts { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::destroy_accounts { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::destroy_approvals { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::destroy_approvals { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::finish_destroy { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::finish_destroy { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::transfer_ownership { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::transfer_ownership { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::set_team { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::set_team { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::set_metadata { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::set_metadata { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::clear_metadata { .. }) |
|
RuntimeCall::Assets(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 { .. }) |
|
||||||
@@ -394,12 +399,12 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
|
|||||||
),
|
),
|
||||||
ProxyType::AssetManager => matches!(
|
ProxyType::AssetManager => matches!(
|
||||||
c,
|
c,
|
||||||
RuntimeCall::Assets(pallet_assets::Call::mint { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::mint { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::burn { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::burn { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::freeze { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::freeze { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::thaw { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::thaw { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::freeze_asset { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::freeze_asset { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::thaw_asset { .. }) |
|
RuntimeCall::Assets(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 { .. }) |
|
||||||
@@ -545,8 +550,13 @@ impl pallet_asset_tx_payment::Config for Runtime {
|
|||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type Fungibles = Assets;
|
type Fungibles = Assets;
|
||||||
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>,
|
||||||
>;
|
>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -622,7 +632,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,
|
Assets: 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,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -651,7 +661,7 @@ pub type UncheckedExtrinsic =
|
|||||||
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
||||||
/// Extrinsic type that has already been checked.
|
/// Extrinsic type that has already been checked.
|
||||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;
|
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;
|
||||||
|
/// Migrations to apply on runtime upgrade.
|
||||||
pub type Migrations = ();
|
pub type Migrations = ();
|
||||||
|
|
||||||
/// Executive: handles dispatch to the various modules.
|
/// Executive: handles dispatch to the various modules.
|
||||||
|
|||||||
@@ -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, AssetIdForTrustBackedAssets, Assets, Authorship, Balance,
|
||||||
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee,
|
Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent,
|
||||||
XcmpQueue,
|
RuntimeOrigin, TrustBackedAssetsInstance, WeightToFee, XcmpQueue,
|
||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
match_types, parameter_types,
|
match_types, parameter_types,
|
||||||
@@ -53,7 +53,7 @@ parameter_types! {
|
|||||||
pub UniversalLocation: InteriorMultiLocation =
|
pub UniversalLocation: InteriorMultiLocation =
|
||||||
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
|
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().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(<Assets as PalletInfoAccess>::index() as u8).into();
|
||||||
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
||||||
}
|
}
|
||||||
@@ -90,9 +90,13 @@ pub type FungiblesTransactor = FungiblesAdapter<
|
|||||||
Assets,
|
Assets,
|
||||||
// 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,
|
AssetIdForTrustBackedAssets,
|
||||||
Balance,
|
Balance,
|
||||||
AsPrefixedGeneralIndex<AssetsPalletLocation, AssetId, JustTry>,
|
AsPrefixedGeneralIndex<
|
||||||
|
TrustBackedAssetsPalletLocation,
|
||||||
|
AssetIdForTrustBackedAssets,
|
||||||
|
JustTry,
|
||||||
|
>,
|
||||||
JustTry,
|
JustTry,
|
||||||
>,
|
>,
|
||||||
// Convert an XCM MultiLocation into a local account id:
|
// Convert an XCM MultiLocation into a local account id:
|
||||||
@@ -271,7 +275,8 @@ pub type Barrier = DenyThenTry<
|
|||||||
pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier<
|
pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier<
|
||||||
Runtime,
|
Runtime,
|
||||||
WeightToFee,
|
WeightToFee,
|
||||||
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
|
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto, TrustBackedAssetsInstance>,
|
||||||
|
TrustBackedAssetsInstance,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
pub struct XcmConfig;
|
pub struct XcmConfig;
|
||||||
@@ -298,9 +303,13 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
AccountId,
|
AccountId,
|
||||||
AssetFeeAsExistentialDepositMultiplierFeeCharger,
|
AssetFeeAsExistentialDepositMultiplierFeeCharger,
|
||||||
ConvertedConcreteId<
|
ConvertedConcreteId<
|
||||||
AssetId,
|
AssetIdForTrustBackedAssets,
|
||||||
Balance,
|
Balance,
|
||||||
AsPrefixedGeneralIndex<AssetsPalletLocation, AssetId, JustTry>,
|
AsPrefixedGeneralIndex<
|
||||||
|
TrustBackedAssetsPalletLocation,
|
||||||
|
AssetIdForTrustBackedAssets,
|
||||||
|
JustTry,
|
||||||
|
>,
|
||||||
JustTry,
|
JustTry,
|
||||||
>,
|
>,
|
||||||
Assets,
|
Assets,
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ use pallet_nfts::PalletFeatures;
|
|||||||
pub use parachains_common as common;
|
pub use parachains_common as common;
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::{AssetsToBlockAuthor, DealWithFees},
|
impls::{AssetsToBlockAuthor, DealWithFees},
|
||||||
opaque, AccountId, AssetId, AuraId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
opaque, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header,
|
||||||
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
|
Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
|
||||||
SLOT_DURATION,
|
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||||
};
|
};
|
||||||
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};
|
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};
|
||||||
|
|
||||||
@@ -214,11 +214,16 @@ parameter_types! {
|
|||||||
|
|
||||||
pub type AssetsForceOrigin = EnsureRoot<AccountId>;
|
pub type AssetsForceOrigin = EnsureRoot<AccountId>;
|
||||||
|
|
||||||
impl pallet_assets::Config for Runtime {
|
// Called "Trust Backed" assets because these are generally registered by some account, and users of
|
||||||
|
// the asset assume it has some claimed backing. The pallet is called `Assets` in
|
||||||
|
// `construct_runtime` to avoid breaking changes on storage reads.
|
||||||
|
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 = AssetIdForTrustBackedAssets;
|
||||||
type AssetIdParameter = codec::Compact<AssetId>;
|
type AssetIdParameter = codec::Compact<AssetIdForTrustBackedAssets>;
|
||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
||||||
type ForceOrigin = AssetsForceOrigin;
|
type ForceOrigin = AssetsForceOrigin;
|
||||||
@@ -337,15 +342,15 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
|
|||||||
},
|
},
|
||||||
ProxyType::AssetOwner => matches!(
|
ProxyType::AssetOwner => matches!(
|
||||||
c,
|
c,
|
||||||
RuntimeCall::Assets(pallet_assets::Call::create { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::create { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::start_destroy { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::start_destroy { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::destroy_accounts { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::destroy_accounts { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::destroy_approvals { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::destroy_approvals { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::finish_destroy { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::finish_destroy { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::transfer_ownership { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::transfer_ownership { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::set_team { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::set_team { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::set_metadata { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::set_metadata { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::clear_metadata { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::clear_metadata { .. }) |
|
||||||
RuntimeCall::Nfts(pallet_nfts::Call::create { .. }) |
|
RuntimeCall::Nfts(pallet_nfts::Call::create { .. }) |
|
||||||
RuntimeCall::Nfts(pallet_nfts::Call::destroy { .. }) |
|
RuntimeCall::Nfts(pallet_nfts::Call::destroy { .. }) |
|
||||||
RuntimeCall::Nfts(pallet_nfts::Call::transfer_ownership { .. }) |
|
RuntimeCall::Nfts(pallet_nfts::Call::transfer_ownership { .. }) |
|
||||||
@@ -373,12 +378,12 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
|
|||||||
),
|
),
|
||||||
ProxyType::AssetManager => matches!(
|
ProxyType::AssetManager => matches!(
|
||||||
c,
|
c,
|
||||||
RuntimeCall::Assets(pallet_assets::Call::mint { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::mint { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::burn { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::burn { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::freeze { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::freeze { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::thaw { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::thaw { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::freeze_asset { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::freeze_asset { .. }) |
|
||||||
RuntimeCall::Assets(pallet_assets::Call::thaw_asset { .. }) |
|
RuntimeCall::Assets(TrustBackedAssetsCall::thaw_asset { .. }) |
|
||||||
RuntimeCall::Nfts(pallet_nfts::Call::force_mint { .. }) |
|
RuntimeCall::Nfts(pallet_nfts::Call::force_mint { .. }) |
|
||||||
RuntimeCall::Nfts(pallet_nfts::Call::burn { .. }) |
|
RuntimeCall::Nfts(pallet_nfts::Call::burn { .. }) |
|
||||||
RuntimeCall::Nfts(pallet_nfts::Call::lock_item_transfer { .. }) |
|
RuntimeCall::Nfts(pallet_nfts::Call::lock_item_transfer { .. }) |
|
||||||
@@ -524,8 +529,13 @@ impl pallet_asset_tx_payment::Config for Runtime {
|
|||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type Fungibles = Assets;
|
type Fungibles = Assets;
|
||||||
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>,
|
||||||
>;
|
>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,7 +642,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,
|
Assets: 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,
|
||||||
Nfts: pallet_nfts::{Pallet, Call, Storage, Event<T>} = 52,
|
Nfts: pallet_nfts::{Pallet, Call, Storage, Event<T>} = 52,
|
||||||
}
|
}
|
||||||
@@ -662,7 +672,7 @@ pub type UncheckedExtrinsic =
|
|||||||
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
||||||
/// Extrinsic type that has already been checked.
|
/// Extrinsic type that has already been checked.
|
||||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;
|
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;
|
||||||
|
/// Migrations to apply on runtime upgrade.
|
||||||
pub type Migrations = ();
|
pub type Migrations = ();
|
||||||
|
|
||||||
/// Executive: handles dispatch to the various modules.
|
/// Executive: handles dispatch to the various modules.
|
||||||
|
|||||||
@@ -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, AssetIdForTrustBackedAssets, Assets, Authorship, Balance,
|
||||||
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee,
|
Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent,
|
||||||
XcmpQueue,
|
RuntimeOrigin, TrustBackedAssetsInstance, WeightToFee, XcmpQueue,
|
||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
match_types, parameter_types,
|
match_types, parameter_types,
|
||||||
@@ -50,10 +50,11 @@ parameter_types! {
|
|||||||
pub const WestendLocation: MultiLocation = MultiLocation::parent();
|
pub const WestendLocation: MultiLocation = MultiLocation::parent();
|
||||||
pub RelayNetwork: Option<NetworkId> = Some(NetworkId::Westend);
|
pub RelayNetwork: Option<NetworkId> = Some(NetworkId::Westend);
|
||||||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||||
|
pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
|
||||||
pub UniversalLocation: InteriorMultiLocation =
|
pub UniversalLocation: InteriorMultiLocation =
|
||||||
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
|
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
|
||||||
pub const Local: MultiLocation = Here.into_location();
|
pub const Local: MultiLocation = Here.into_location();
|
||||||
pub AssetsPalletLocation: MultiLocation =
|
pub TrustBackedAssetsPalletLocation: MultiLocation =
|
||||||
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
|
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
|
||||||
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
||||||
}
|
}
|
||||||
@@ -90,9 +91,13 @@ pub type FungiblesTransactor = FungiblesAdapter<
|
|||||||
Assets,
|
Assets,
|
||||||
// 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,
|
AssetIdForTrustBackedAssets,
|
||||||
Balance,
|
Balance,
|
||||||
AsPrefixedGeneralIndex<AssetsPalletLocation, AssetId, JustTry>,
|
AsPrefixedGeneralIndex<
|
||||||
|
TrustBackedAssetsPalletLocation,
|
||||||
|
AssetIdForTrustBackedAssets,
|
||||||
|
JustTry,
|
||||||
|
>,
|
||||||
JustTry,
|
JustTry,
|
||||||
>,
|
>,
|
||||||
// Convert an XCM MultiLocation into a local account id:
|
// Convert an XCM MultiLocation into a local account id:
|
||||||
@@ -266,7 +271,8 @@ pub type Barrier = DenyThenTry<
|
|||||||
pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier<
|
pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier<
|
||||||
Runtime,
|
Runtime,
|
||||||
WeightToFee,
|
WeightToFee,
|
||||||
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
|
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto, TrustBackedAssetsInstance>,
|
||||||
|
TrustBackedAssetsInstance,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
pub struct XcmConfig;
|
pub struct XcmConfig;
|
||||||
@@ -293,9 +299,13 @@ impl xcm_executor::Config for XcmConfig {
|
|||||||
AccountId,
|
AccountId,
|
||||||
AssetFeeAsExistentialDepositMultiplierFeeCharger,
|
AssetFeeAsExistentialDepositMultiplierFeeCharger,
|
||||||
ConvertedConcreteId<
|
ConvertedConcreteId<
|
||||||
AssetId,
|
AssetIdForTrustBackedAssets,
|
||||||
Balance,
|
Balance,
|
||||||
AsPrefixedGeneralIndex<AssetsPalletLocation, AssetId, JustTry>,
|
AsPrefixedGeneralIndex<
|
||||||
|
TrustBackedAssetsPalletLocation,
|
||||||
|
AssetIdForTrustBackedAssets,
|
||||||
|
JustTry,
|
||||||
|
>,
|
||||||
JustTry,
|
JustTry,
|
||||||
>,
|
>,
|
||||||
Assets,
|
Assets,
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ pub use sp_runtime::{Perbill, Permill};
|
|||||||
|
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::{AssetsFrom, NonZeroIssuance},
|
impls::{AssetsFrom, NonZeroIssuance},
|
||||||
AccountId, AssetId, Signature,
|
AccountId, AssetIdForTrustBackedAssets, Signature,
|
||||||
};
|
};
|
||||||
use xcm_builder::{
|
use xcm_builder::{
|
||||||
AllowKnownQueryResponses, AllowSubscriptionsFrom, AsPrefixedGeneralIndex, ConvertedConcreteId,
|
AllowKnownQueryResponses, AllowSubscriptionsFrom, AsPrefixedGeneralIndex, ConvertedConcreteId,
|
||||||
@@ -314,9 +314,9 @@ pub type FungiblesTransactor = FungiblesAdapter<
|
|||||||
Assets,
|
Assets,
|
||||||
// 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,
|
AssetIdForTrustBackedAssets,
|
||||||
u64,
|
u64,
|
||||||
AsPrefixedGeneralIndex<StatemintAssetsPalletLocation, AssetId, JustTry>,
|
AsPrefixedGeneralIndex<StatemintAssetsPalletLocation, AssetIdForTrustBackedAssets, JustTry>,
|
||||||
JustTry,
|
JustTry,
|
||||||
>,
|
>,
|
||||||
// Convert an XCM MultiLocation into a local account id:
|
// Convert an XCM MultiLocation into a local account id:
|
||||||
@@ -514,8 +514,8 @@ pub type AdminOrigin =
|
|||||||
impl pallet_assets::Config for Runtime {
|
impl pallet_assets::Config for Runtime {
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type Balance = u64;
|
type Balance = u64;
|
||||||
type AssetId = AssetId;
|
type AssetId = AssetIdForTrustBackedAssets;
|
||||||
type AssetIdParameter = codec::Compact<AssetId>;
|
type AssetIdParameter = codec::Compact<AssetIdForTrustBackedAssets>;
|
||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
||||||
type ForceOrigin = AdminOrigin;
|
type ForceOrigin = AdminOrigin;
|
||||||
|
|||||||
Reference in New Issue
Block a user