difftreelog
feat scheduler feature
in: master
6 files changed
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -119,8 +119,9 @@
"orml-vesting/std",
]
limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
-opal-runtime = ['rmrk']
+opal-runtime = ['scheduler', 'rmrk']
+scheduler = []
rmrk = []
################################################################################
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -110,7 +110,7 @@
use polkadot_parachain::primitives::Sibling;
use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
use xcm_builder::{
- AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
+ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,
EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
@@ -966,6 +966,8 @@
}
pub struct SchedulerPaymentExecutor;
+
+#[cfg(feature = "scheduler")]
impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
where
@@ -1066,6 +1068,7 @@
}
}
+#[cfg(feature = "scheduler")]
impl pallet_unique_scheduler::Config for Runtime {
type Event = Event;
type Origin = Origin;
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -120,6 +120,7 @@
limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
quartz-runtime = []
+scheduler = []
rmrk = []
################################################################################
runtime/quartz/src/lib.rsdiffbeforeafterboth28use sp_api::impl_runtime_apis;28use sp_api::impl_runtime_apis;29use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};29use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};30use sp_runtime::DispatchError;30use sp_runtime::DispatchError;31#[cfg(feature = "scheduler")]31use fp_self_contained::*;32use fp_self_contained::*;3334#[cfg(feature = "scheduler")]35use sp_runtime::{36 traits::Member,37 generic::Era,38 DispatchErrorWithPostInfo39};32// #[cfg(any(feature = "std", test))]40// #[cfg(any(feature = "std", test))]33// pub use sp_runtime::BuildStorage;41// pub use sp_runtime::BuildStorage;344235use sp_runtime::{43use sp_runtime::{36 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,44 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,37 traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero, Member},45 traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero},38 transaction_validity::{TransactionSource, TransactionValidity},46 transaction_validity::{TransactionSource, TransactionValidity},39 ApplyExtrinsicResult, RuntimeAppPublic,47 ApplyExtrinsicResult, RuntimeAppPublic,40};48};70 },78 },71};79};8081#[cfg(feature = "scheduler")]72use pallet_unique_scheduler::DispatchCall;82use pallet_unique_scheduler::DispatchCall;8373use up_data_structs::{84use up_data_structs::{93use fp_rpc::TransactionStatus;104use fp_rpc::TransactionStatus;94use sp_runtime::{105use sp_runtime::{95 traits::{106 traits::{96 Applyable, BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf,107 BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf,97 Saturating, CheckedConversion,108 Saturating, CheckedConversion,98 },109 },99 generic::Era,100 transaction_validity::TransactionValidityError,110 transaction_validity::TransactionValidityError, SaturatedConversion,101 DispatchErrorWithPostInfo, SaturatedConversion,102};111};103112104// pub use pallet_timestamp::Call as TimestampCall;113// pub use pallet_timestamp::Call as TimestampCall;109use polkadot_parachain::primitives::Sibling;118use polkadot_parachain::primitives::Sibling;110use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};119use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};111use xcm_builder::{120use xcm_builder::{112 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,121 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,113 EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,122 EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,114 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,123 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,115 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,124 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,949958950type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;959type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;960961#[cfg(feature = "scheduler")]951use frame_support::traits::NamedReservableCurrency;962use frame_support::traits::NamedReservableCurrency;952963964#[cfg(feature = "scheduler")]953fn get_signed_extras(from: <Runtime as frame_system::Config>::AccountId) -> SignedExtraScheduler {965fn get_signed_extras(from: <Runtime as frame_system::Config>::AccountId) -> SignedExtraScheduler {954 (966 (955 frame_system::CheckSpecVersion::<Runtime>::new(),967 frame_system::CheckSpecVersion::<Runtime>::new(),964 )976 )965}977}966978967// pub struct SchedulerPaymentExecutor;979#[cfg(feature = "scheduler")]968// impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>980pub struct SchedulerPaymentExecutor;969// DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor981970// where982#[cfg(feature = "scheduler")]971// <T as frame_system::Config>::Call: Member983impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>972// + Dispatchable<Origin = Origin, Info = DispatchInfo>984 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor973// + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>985where974// + GetDispatchInfo986 <T as frame_system::Config>::Call: Member975// + From<frame_system::Call<Runtime>>,987 + Dispatchable<Origin = Origin, Info = DispatchInfo>976// SelfContainedSignedInfo: Send + Sync + 'static,988 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>977// Call: From<<T as frame_system::Config>::Call>989 + GetDispatchInfo978// + From<<T as pallet_unique_scheduler::Config>::Call>990 + From<frame_system::Call<Runtime>>,979// + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,991 SelfContainedSignedInfo: Send + Sync + 'static,980// sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,992 Call: From<<T as frame_system::Config>::Call>981// {993 + From<<T as pallet_unique_scheduler::Config>::Call>982// fn dispatch_call(994 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,983// signer: <T as frame_system::Config>::AccountId,995 sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,984// call: <T as pallet_unique_scheduler::Config>::Call,996{985// ) -> Result<997 fn dispatch_call(986// Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,998 signer: <T as frame_system::Config>::AccountId,987// TransactionValidityError,999 call: <T as pallet_unique_scheduler::Config>::Call,988// > {1000 ) -> Result<989// let dispatch_info = call.get_dispatch_info();1001 Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,990// let extrinsic = fp_self_contained::CheckedExtrinsic::<1002 TransactionValidityError,991// AccountId,1003 > {992// Call,1004 let dispatch_info = call.get_dispatch_info();993// SignedExtraScheduler,1005 let extrinsic = fp_self_contained::CheckedExtrinsic::<994// SelfContainedSignedInfo,1006 AccountId,995// > {1007 Call,996// signed:1008 SignedExtraScheduler,997// CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(1009 SelfContainedSignedInfo,998// signer.clone().into(),1010 > {999// get_signed_extras(signer.into()),1011 signed:1000// ),1012 CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(1001// function: call.into(),1013 signer.clone().into(),1002// };1014 get_signed_extras(signer.into()),10031015 ),1004// extrinsic.apply::<Runtime>(&dispatch_info, 0)1016 function: call.into(),1005// }1017 };100610181007// fn reserve_balance(1019 extrinsic.apply::<Runtime>(&dispatch_info, 0)1008// id: [u8; 16],1020 }1009// sponsor: <T as frame_system::Config>::AccountId,10211010// call: <T as pallet_unique_scheduler::Config>::Call,1022 fn reserve_balance(1011// count: u32,1023 id: [u8; 16],1012// ) -> Result<(), DispatchError> {1024 sponsor: <T as frame_system::Config>::AccountId,1013// let dispatch_info = call.get_dispatch_info();1025 call: <T as pallet_unique_scheduler::Config>::Call,1014// let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)1026 count: u32,1015// .saturating_mul(count.into());1027 ) -> Result<(), DispatchError> {10161028 let dispatch_info = call.get_dispatch_info();1017// <Balances as NamedReservableCurrency<AccountId>>::reserve_named(1029 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)1018// &id,1030 .saturating_mul(count.into());1019// &(sponsor.into()),10311020// weight.into(),1032 <Balances as NamedReservableCurrency<AccountId>>::reserve_named(1021// )1033 &id,1022// }1034 &(sponsor.into()),10231035 weight.into(),1024// fn pay_for_call(1036 )1025// id: [u8; 16],1037 }1026// sponsor: <T as frame_system::Config>::AccountId,10381027// call: <T as pallet_unique_scheduler::Config>::Call,1039 fn pay_for_call(1028// ) -> Result<u128, DispatchError> {1040 id: [u8; 16],1029// let dispatch_info = call.get_dispatch_info();1041 sponsor: <T as frame_system::Config>::AccountId,1030// let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);1042 call: <T as pallet_unique_scheduler::Config>::Call,1031// Ok(1043 ) -> Result<u128, DispatchError> {1032// <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1044 let dispatch_info = call.get_dispatch_info();1033// &id,1045 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);1034// &(sponsor.into()),1046 Ok(1035// weight.into(),1047 <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1036// ),1048 &id,1037// )1049 &(sponsor.into()),1038// }1050 weight.into(),10391051 ),1040// fn cancel_reserve(1052 )1041// id: [u8; 16],1053 }1042// sponsor: <T as frame_system::Config>::AccountId,10541043// ) -> Result<u128, DispatchError> {1055 fn cancel_reserve(1044// Ok(1056 id: [u8; 16],1045// <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1057 sponsor: <T as frame_system::Config>::AccountId,1046// &id,1058 ) -> Result<u128, DispatchError> {1047// &(sponsor.into()),1059 Ok(1048// u128::MAX,1060 <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1049// ),1061 &id,1050// )1062 &(sponsor.into()),1051// }1063 u128::MAX,1052// }1064 ),1065 )1066 }1067}105310681054parameter_types! {1069parameter_types! {1055 pub const NoPreimagePostponement: Option<u32> = Some(10);1070 pub const NoPreimagePostponement: Option<u32> = Some(10);1065 }1080 }1066}1081}106710821068// impl pallet_unique_scheduler::Config for Runtime {1083#[cfg(feature = "scheduler")]1069// type Event = Event;1084impl pallet_unique_scheduler::Config for Runtime {1070// type Origin = Origin;1085 type Event = Event;1071// type Currency = Balances;1086 type Origin = Origin;1072// type PalletsOrigin = OriginCaller;1087 type Currency = Balances;1073// type Call = Call;1088 type PalletsOrigin = OriginCaller;1074// type MaximumWeight = MaximumSchedulerWeight;1089 type Call = Call;1075// type ScheduleOrigin = EnsureSigned<AccountId>;1090 type MaximumWeight = MaximumSchedulerWeight;1076// type MaxScheduledPerBlock = MaxScheduledPerBlock;1091 type ScheduleOrigin = EnsureSigned<AccountId>;1077// type WeightInfo = ();1092 type MaxScheduledPerBlock = MaxScheduledPerBlock;1078// type CallExecutor = SchedulerPaymentExecutor;1093 type WeightInfo = ();1079// type OriginPrivilegeCmp = OriginPrivilegeCmp;1094 type CallExecutor = SchedulerPaymentExecutor;1080// type PreimageProvider = ();1095 type OriginPrivilegeCmp = OriginPrivilegeCmp;1081// type NoPreimagePostponement = NoPreimagePostponement;1096 type PreimageProvider = ();1082// }1097 type NoPreimagePostponement = NoPreimagePostponement;1098}108310991084type EvmSponsorshipHandler = (1100type EvmSponsorshipHandler = (1085 UniqueEthSponsorshipHandler<Runtime>,1101 UniqueEthSponsorshipHandler<Runtime>,runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -121,6 +121,9 @@
limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
unique-runtime = []
+scheduler = []
+rmrk = []
+
################################################################################
# Substrate Dependencies
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -28,13 +28,22 @@
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};
use sp_runtime::DispatchError;
+
+#[cfg(feature = "scheduler")]
use fp_self_contained::*;
+
+#[cfg(feature = "scheduler")]
+use sp_runtime::{
+ traits::Member,
+ generic::Era,
+ DispatchErrorWithPostInfo
+};
// #[cfg(any(feature = "std", test))]
// pub use sp_runtime::BuildStorage;
use sp_runtime::{
Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,
- traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero, Member},
+ traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, RuntimeAppPublic,
};
@@ -69,7 +78,10 @@
WeightToFee,
},
};
+
+#[cfg(feature = "scheduler")]
use pallet_unique_scheduler::DispatchCall;
+
use up_data_structs::{
CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
CollectionStats, RpcCollection,
@@ -93,12 +105,10 @@
use fp_rpc::TransactionStatus;
use sp_runtime::{
traits::{
- Applyable, BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf,
+ BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf,
Saturating, CheckedConversion,
},
- generic::Era,
- transaction_validity::TransactionValidityError,
- DispatchErrorWithPostInfo, SaturatedConversion,
+ transaction_validity::TransactionValidityError, SaturatedConversion,
};
// pub use pallet_timestamp::Call as TimestampCall;
@@ -109,7 +119,7 @@
use polkadot_parachain::primitives::Sibling;
use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
use xcm_builder::{
- AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
+ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,
EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
@@ -949,8 +959,11 @@
}
type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;
+
+#[cfg(feature = "scheduler")]
use frame_support::traits::NamedReservableCurrency;
+#[cfg(feature = "scheduler")]
fn get_signed_extras(from: <Runtime as frame_system::Config>::AccountId) -> SignedExtraScheduler {
(
frame_system::CheckSpecVersion::<Runtime>::new(),
@@ -965,92 +978,95 @@
)
}
-// pub struct SchedulerPaymentExecutor;
-// impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
-// DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
-// where
-// <T as frame_system::Config>::Call: Member
-// + Dispatchable<Origin = Origin, Info = DispatchInfo>
-// + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>
-// + GetDispatchInfo
-// + From<frame_system::Call<Runtime>>,
-// SelfContainedSignedInfo: Send + Sync + 'static,
-// Call: From<<T as frame_system::Config>::Call>
-// + From<<T as pallet_unique_scheduler::Config>::Call>
-// + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
-// sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
-// {
-// fn dispatch_call(
-// signer: <T as frame_system::Config>::AccountId,
-// call: <T as pallet_unique_scheduler::Config>::Call,
-// ) -> Result<
-// Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
-// TransactionValidityError,
-// > {
-// let dispatch_info = call.get_dispatch_info();
-// let extrinsic = fp_self_contained::CheckedExtrinsic::<
-// AccountId,
-// Call,
-// SignedExtraScheduler,
-// SelfContainedSignedInfo,
-// > {
-// signed:
-// CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(
-// signer.clone().into(),
-// get_signed_extras(signer.into()),
-// ),
-// function: call.into(),
-// };
+#[cfg(feature = "scheduler")]
+pub struct SchedulerPaymentExecutor;
-// extrinsic.apply::<Runtime>(&dispatch_info, 0)
-// }
+#[cfg(feature = "scheduler")]
+impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
+ DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
+where
+ <T as frame_system::Config>::Call: Member
+ + Dispatchable<Origin = Origin, Info = DispatchInfo>
+ + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>
+ + GetDispatchInfo
+ + From<frame_system::Call<Runtime>>,
+ SelfContainedSignedInfo: Send + Sync + 'static,
+ Call: From<<T as frame_system::Config>::Call>
+ + From<<T as pallet_unique_scheduler::Config>::Call>
+ + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
+ sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
+{
+ fn dispatch_call(
+ signer: <T as frame_system::Config>::AccountId,
+ call: <T as pallet_unique_scheduler::Config>::Call,
+ ) -> Result<
+ Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
+ TransactionValidityError,
+ > {
+ let dispatch_info = call.get_dispatch_info();
+ let extrinsic = fp_self_contained::CheckedExtrinsic::<
+ AccountId,
+ Call,
+ SignedExtraScheduler,
+ SelfContainedSignedInfo,
+ > {
+ signed:
+ CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(
+ signer.clone().into(),
+ get_signed_extras(signer.into()),
+ ),
+ function: call.into(),
+ };
-// fn reserve_balance(
-// id: [u8; 16],
-// sponsor: <T as frame_system::Config>::AccountId,
-// call: <T as pallet_unique_scheduler::Config>::Call,
-// count: u32,
-// ) -> Result<(), DispatchError> {
-// let dispatch_info = call.get_dispatch_info();
-// let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)
-// .saturating_mul(count.into());
+ extrinsic.apply::<Runtime>(&dispatch_info, 0)
+ }
-// <Balances as NamedReservableCurrency<AccountId>>::reserve_named(
-// &id,
-// &(sponsor.into()),
-// weight,
-// )
-// }
+ fn reserve_balance(
+ id: [u8; 16],
+ sponsor: <T as frame_system::Config>::AccountId,
+ call: <T as pallet_unique_scheduler::Config>::Call,
+ count: u32,
+ ) -> Result<(), DispatchError> {
+ let dispatch_info = call.get_dispatch_info();
+ let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)
+ .saturating_mul(count.into());
-// fn pay_for_call(
-// id: [u8; 16],
-// sponsor: <T as frame_system::Config>::AccountId,
-// call: <T as pallet_unique_scheduler::Config>::Call,
-// ) -> Result<u128, DispatchError> {
-// let dispatch_info = call.get_dispatch_info();
-// let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
-// Ok(
-// <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
-// &id,
-// &(sponsor.into()),
-// weight,
-// ),
-// )
-// }
+ <Balances as NamedReservableCurrency<AccountId>>::reserve_named(
+ &id,
+ &(sponsor.into()),
+ weight,
+ )
+ }
-// fn cancel_reserve(
-// id: [u8; 16],
-// sponsor: <T as frame_system::Config>::AccountId,
-// ) -> Result<u128, DispatchError> {
-// Ok(
-// <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
-// &id,
-// &(sponsor.into()),
-// u128::MAX,
-// ),
-// )
-// }
-// }
+ fn pay_for_call(
+ id: [u8; 16],
+ sponsor: <T as frame_system::Config>::AccountId,
+ call: <T as pallet_unique_scheduler::Config>::Call,
+ ) -> Result<u128, DispatchError> {
+ let dispatch_info = call.get_dispatch_info();
+ let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
+ Ok(
+ <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
+ &id,
+ &(sponsor.into()),
+ weight,
+ ),
+ )
+ }
+
+ fn cancel_reserve(
+ id: [u8; 16],
+ sponsor: <T as frame_system::Config>::AccountId,
+ ) -> Result<u128, DispatchError> {
+ Ok(
+ <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
+ &id,
+ &(sponsor.into()),
+ u128::MAX,
+ ),
+ )
+ }
+}
parameter_types! {
pub const NoPreimagePostponement: Option<u32> = Some(10);
@@ -1066,21 +1082,22 @@
}
}
-// impl pallet_unique_scheduler::Config for Runtime {
-// type Event = Event;
-// type Origin = Origin;
-// type Currency = Balances;
-// type PalletsOrigin = OriginCaller;
-// type Call = Call;
-// type MaximumWeight = MaximumSchedulerWeight;
-// type ScheduleOrigin = EnsureSigned<AccountId>;
-// type MaxScheduledPerBlock = MaxScheduledPerBlock;
-// type WeightInfo = ();
-// type CallExecutor = SchedulerPaymentExecutor;
-// type OriginPrivilegeCmp = OriginPrivilegeCmp;
-// type PreimageProvider = ();
-// type NoPreimagePostponement = NoPreimagePostponement;
-// }
+#[cfg(feature = "scheduler")]
+impl pallet_unique_scheduler::Config for Runtime {
+ type Event = Event;
+ type Origin = Origin;
+ type Currency = Balances;
+ type PalletsOrigin = OriginCaller;
+ type Call = Call;
+ type MaximumWeight = MaximumSchedulerWeight;
+ type ScheduleOrigin = EnsureSigned<AccountId>;
+ type MaxScheduledPerBlock = MaxScheduledPerBlock;
+ type WeightInfo = ();
+ type CallExecutor = SchedulerPaymentExecutor;
+ type OriginPrivilegeCmp = OriginPrivilegeCmp;
+ type PreimageProvider = ();
+ type NoPreimagePostponement = NoPreimagePostponement;
+}
type EvmSponsorshipHandler = (
UniqueEthSponsorshipHandler<Runtime>,
@@ -1166,7 +1183,7 @@
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
- pallet_charge_transaction::ChargeTransactionPayment<Runtime>,
+ ChargeTransactionPayment,
//pallet_contract_helpers::ContractHelpersExtension<Runtime>,
pallet_ethereum::FakeTransactionFinalizer<Runtime>,
);