Support paying DOT as a fee (#404)

* generic template implemented

* support pay do as a fee

* update locks with latest fixes

* docs & tests

* fix clippy

* fix fmt
This commit is contained in:
Nikita Khateev
2025-02-18 07:09:43 +04:00
committed by GitHub
parent 268bb2dd12
commit d953d959e6
16 changed files with 354 additions and 26 deletions
+6 -2
View File
@@ -11,8 +11,8 @@ use crate::{
use crate::{constants::SLOT_DURATION, types::ConsensusHook};
use crate::{
constants::VERSION,
types::{AccountId, Balance, Block, Executive, Nonce},
InherentDataExt, ParachainSystem, Runtime, RuntimeBlockWeights, RuntimeCall,
types::{AccountId, AssetId, Balance, Block, Executive, Nonce},
InherentDataExt, Oracle, ParachainSystem, Runtime, RuntimeBlockWeights, RuntimeCall,
RuntimeGenesisConfig, SessionKeys, System, TransactionPayment,
};
@@ -29,6 +29,8 @@ mod apis {
type RuntimeCall = RuntimeCall;
type TransactionPayment = TransactionPayment;
type Balance = Balance;
type Oracle = Oracle;
type OracleKey = AssetId;
}
mod consensus {
@@ -83,6 +85,8 @@ mod apis {
type RuntimeCall = RuntimeCall;
type TransactionPayment = TransactionPayment;
type Balance = Balance;
type Oracle = Oracle;
type OracleKey = AssetId;
}
mod tanssi {
+15 -4
View File
@@ -82,10 +82,10 @@ use crate::{
TreasuryAccount, TreasuryInteriorLocation, TreasuryPalletId, TreasuryPaymaster, Version,
},
weights::{BlockExecutionWeight, ExtrinsicBaseWeight},
AllPalletsWithSystem, AssetManager, Balances, MessageQueue, OriginCaller, PalletInfo,
ParachainInfo, ParachainSystem, PolkadotXcm, Preimage, Referenda, Runtime, RuntimeCall,
RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask, Scheduler,
System, Treasury, WeightToFee, XcmpQueue,
AllPalletsWithSystem, AssetManager, Balances, MessageQueue, Oracle, OracleMembership,
OriginCaller, PalletInfo, ParachainInfo, ParachainSystem, PolkadotXcm, Preimage, Referenda,
Runtime, RuntimeCall, RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin,
RuntimeTask, Scheduler, System, Timestamp, Treasury, WeightToFee, XcmpQueue,
};
#[cfg(not(feature = "tanssi"))]
use crate::{Aura, CollatorSelection, Session};
@@ -176,7 +176,13 @@ impl XcmConfig for OpenZeppelinRuntime {
type XcmpQueueMaxInboundSuspended = ConstU32<1000>;
type XtokensReserveProviders = ReserveProviders;
}
parameter_types! {
pub RootOperatorAccountId: AccountId = AccountId::from([0xffu8; 32]);
}
impl AssetsConfig for OpenZeppelinRuntime {
type AccountId = AccountId;
type ApprovalDeposit = ConstU128<EXISTENTIAL_DEPOSIT>;
type AssetAccountDeposit = ConstU128<{ deposit(1, 16) }>;
type AssetDeposit = ConstU128<{ 10 * CENTS }>;
@@ -184,11 +190,16 @@ impl AssetsConfig for OpenZeppelinRuntime {
type AssetRegistrar = AssetRegistrar;
type AssetRegistrarMetadata = AssetRegistrarMetadata;
type AssetType = AssetType;
type AssetsToBlockAuthor = parachains_common::impls::AssetsToBlockAuthor<Runtime, ()>;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
type ForceOrigin = EnsureRoot<AccountId>;
type ForeignAssetModifierOrigin = EnsureRoot<AccountId>;
type FungiblesToAccount = TreasuryAccount;
type RootOperatorAccountId = RootOperatorAccountId;
type Timestamp = Timestamp;
type WeightToFee = WeightToFee;
}
#[cfg(feature = "tanssi")]
impl TanssiConfig for OpenZeppelinRuntime {
type AuthorInherent = pallet_author_inherent::weights::SubstrateWeight<Runtime>;
@@ -31,6 +31,9 @@ impl ConsensusWeight for OpenZeppelinRuntime {
impl AssetsWeight for OpenZeppelinRuntime {
type AssetManager = weights::pallet_asset_manager::WeightInfo<Runtime>;
type Assets = weights::pallet_assets::WeightInfo<Runtime>;
// TODO: fix weight on release
type OracleMembership = ();
type OrmlOracle = (); // TODO: fix weight
}
impl GovernanceWeight for OpenZeppelinRuntime {
+1 -1
View File
@@ -81,7 +81,7 @@ pub type SignedExtra = (
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
pallet_asset_tx_payment::ChargeAssetTxPayment<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim<Runtime>,
);