git.delta.rocks / unique-network / refs/commits / 3f04e2d67df0

difftreelog

feat scheduler feature

Daniel Shiposha2022-08-01parent: #ba78248.patch.diff
in: master

6 files changed

modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
119 "orml-vesting/std",119 "orml-vesting/std",
120]120]
121limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']121limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
122opal-runtime = ['rmrk']122opal-runtime = ['scheduler', 'rmrk']
123123
124scheduler = []
124rmrk = []125rmrk = []
125126
126################################################################################127################################################################################
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
110use polkadot_parachain::primitives::Sibling;110use polkadot_parachain::primitives::Sibling;
111use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};111use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
112use xcm_builder::{112use xcm_builder::{
113 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,113 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,
114 EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,114 EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
115 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,115 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
116 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,116 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
967967
968pub struct SchedulerPaymentExecutor;968pub struct SchedulerPaymentExecutor;
969
970#[cfg(feature = "scheduler")]
969impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>971impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
970 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor972 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
971where973where
1066 }1068 }
1067}1069}
10681070
1071#[cfg(feature = "scheduler")]
1069impl pallet_unique_scheduler::Config for Runtime {1072impl pallet_unique_scheduler::Config for Runtime {
1070 type Event = Event;1073 type Event = Event;
1071 type Origin = Origin;1074 type Origin = Origin;
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
120limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']120limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
121quartz-runtime = []121quartz-runtime = []
122122
123scheduler = []
123rmrk = []124rmrk = []
124125
125################################################################################126################################################################################
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
28use 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::*;
33
34#[cfg(feature = "scheduler")]
35use sp_runtime::{
36 traits::Member,
37 generic::Era,
38 DispatchErrorWithPostInfo
39};
32// #[cfg(any(feature = "std", test))]40// #[cfg(any(feature = "std", test))]
33// pub use sp_runtime::BuildStorage;41// pub use sp_runtime::BuildStorage;
3442
35use 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};
80
81#[cfg(feature = "scheduler")]
72use pallet_unique_scheduler::DispatchCall;82use pallet_unique_scheduler::DispatchCall;
83
73use 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};
103112
104// 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,
949958
950type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;959type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;
960
961#[cfg(feature = "scheduler")]
951use frame_support::traits::NamedReservableCurrency;962use frame_support::traits::NamedReservableCurrency;
952963
964#[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}
966978
967// 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 SchedulerPaymentExecutor981
970// 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 SchedulerPaymentExecutor
973// + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>985where
974// + GetDispatchInfo986 <T as frame_system::Config>::Call: Member
975// + 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 + GetDispatchInfo
978// + 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 };
10061018
1007// fn reserve_balance(1019 extrinsic.apply::<Runtime>(&dispatch_info, 0)
1008// id: [u8; 16],1020 }
1009// sponsor: <T as frame_system::Config>::AccountId,1021
1010// 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()),1031
1020// 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,1038
1027// 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,1054
1043// ) -> 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}
10531068
1054parameter_types! {1069parameter_types! {
1055 pub const NoPreimagePostponement: Option<u32> = Some(10);1070 pub const NoPreimagePostponement: Option<u32> = Some(10);
1065 }1080 }
1066}1081}
10671082
1068// 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}
10831099
1084type EvmSponsorshipHandler = (1100type EvmSponsorshipHandler = (
1085 UniqueEthSponsorshipHandler<Runtime>,1101 UniqueEthSponsorshipHandler<Runtime>,
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
121limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']121limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
122unique-runtime = []122unique-runtime = []
123
124scheduler = []
125rmrk = []
123126
124################################################################################127################################################################################
125# Substrate Dependencies128# Substrate Dependencies
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
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
32#[cfg(feature = "scheduler")]
31use fp_self_contained::*;33use fp_self_contained::*;
34
35#[cfg(feature = "scheduler")]
36use sp_runtime::{
37 traits::Member,
38 generic::Era,
39 DispatchErrorWithPostInfo
40};
32// #[cfg(any(feature = "std", test))]41// #[cfg(any(feature = "std", test))]
33// pub use sp_runtime::BuildStorage;42// pub use sp_runtime::BuildStorage;
3443
35use sp_runtime::{44use sp_runtime::{
36 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,45 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,
37 traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero, Member},46 traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero},
38 transaction_validity::{TransactionSource, TransactionValidity},47 transaction_validity::{TransactionSource, TransactionValidity},
39 ApplyExtrinsicResult, RuntimeAppPublic,48 ApplyExtrinsicResult, RuntimeAppPublic,
40};49};
70 },79 },
71};80};
81
82#[cfg(feature = "scheduler")]
72use pallet_unique_scheduler::DispatchCall;83use pallet_unique_scheduler::DispatchCall;
84
73use up_data_structs::{85use up_data_structs::{
93use fp_rpc::TransactionStatus;105use fp_rpc::TransactionStatus;
94use sp_runtime::{106use sp_runtime::{
95 traits::{107 traits::{
96 Applyable, BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf,108 BlockNumberProvider, Dispatchable, PostDispatchInfoOf, DispatchInfoOf,
97 Saturating, CheckedConversion,109 Saturating, CheckedConversion,
98 },110 },
99 generic::Era,
100 transaction_validity::TransactionValidityError,111 transaction_validity::TransactionValidityError, SaturatedConversion,
101 DispatchErrorWithPostInfo, SaturatedConversion,
102};112};
103113
104// pub use pallet_timestamp::Call as TimestampCall;114// pub use pallet_timestamp::Call as TimestampCall;
109use polkadot_parachain::primitives::Sibling;119use polkadot_parachain::primitives::Sibling;
110use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};120use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
111use xcm_builder::{121use xcm_builder::{
112 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,122 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,
113 EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,123 EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
114 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,124 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
115 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,125 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
950960
951type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;961type ChargeTransactionPayment = pallet_charge_transaction::ChargeTransactionPayment<Runtime>;
962
963#[cfg(feature = "scheduler")]
952use frame_support::traits::NamedReservableCurrency;964use frame_support::traits::NamedReservableCurrency;
953965
966#[cfg(feature = "scheduler")]
954fn get_signed_extras(from: <Runtime as frame_system::Config>::AccountId) -> SignedExtraScheduler {967fn get_signed_extras(from: <Runtime as frame_system::Config>::AccountId) -> SignedExtraScheduler {
955 (968 (
956 frame_system::CheckSpecVersion::<Runtime>::new(),969 frame_system::CheckSpecVersion::<Runtime>::new(),
965 )978 )
966}979}
967980
968// pub struct SchedulerPaymentExecutor;981#[cfg(feature = "scheduler")]
969// impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>982pub struct SchedulerPaymentExecutor;
970// DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor983
971// where984#[cfg(feature = "scheduler")]
972// <T as frame_system::Config>::Call: Member985impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
973// + Dispatchable<Origin = Origin, Info = DispatchInfo>986 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
974// + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>987where
975// + GetDispatchInfo988 <T as frame_system::Config>::Call: Member
976// + From<frame_system::Call<Runtime>>,989 + Dispatchable<Origin = Origin, Info = DispatchInfo>
977// SelfContainedSignedInfo: Send + Sync + 'static,990 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>
978// Call: From<<T as frame_system::Config>::Call>991 + GetDispatchInfo
979// + From<<T as pallet_unique_scheduler::Config>::Call>992 + From<frame_system::Call<Runtime>>,
980// + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,993 SelfContainedSignedInfo: Send + Sync + 'static,
981// sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,994 Call: From<<T as frame_system::Config>::Call>
982// {995 + From<<T as pallet_unique_scheduler::Config>::Call>
983// fn dispatch_call(996 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
984// signer: <T as frame_system::Config>::AccountId,997 sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
985// call: <T as pallet_unique_scheduler::Config>::Call,998{
986// ) -> Result<999 fn dispatch_call(
987// Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,1000 signer: <T as frame_system::Config>::AccountId,
988// TransactionValidityError,1001 call: <T as pallet_unique_scheduler::Config>::Call,
989// > {1002 ) -> Result<
990// let dispatch_info = call.get_dispatch_info();1003 Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
991// let extrinsic = fp_self_contained::CheckedExtrinsic::<1004 TransactionValidityError,
992// AccountId,1005 > {
993// Call,1006 let dispatch_info = call.get_dispatch_info();
994// SignedExtraScheduler,1007 let extrinsic = fp_self_contained::CheckedExtrinsic::<
995// SelfContainedSignedInfo,1008 AccountId,
996// > {1009 Call,
997// signed:1010 SignedExtraScheduler,
998// CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(1011 SelfContainedSignedInfo,
999// signer.clone().into(),1012 > {
1000// get_signed_extras(signer.into()),1013 signed:
1001// ),1014 CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(
1002// function: call.into(),1015 signer.clone().into(),
1003// };1016 get_signed_extras(signer.into()),
10041017 ),
1005// extrinsic.apply::<Runtime>(&dispatch_info, 0)1018 function: call.into(),
1006// }1019 };
10071020
1008// fn reserve_balance(1021 extrinsic.apply::<Runtime>(&dispatch_info, 0)
1009// id: [u8; 16],1022 }
1010// sponsor: <T as frame_system::Config>::AccountId,1023
1011// call: <T as pallet_unique_scheduler::Config>::Call,1024 fn reserve_balance(
1012// count: u32,1025 id: [u8; 16],
1013// ) -> Result<(), DispatchError> {1026 sponsor: <T as frame_system::Config>::AccountId,
1014// let dispatch_info = call.get_dispatch_info();1027 call: <T as pallet_unique_scheduler::Config>::Call,
1015// let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)1028 count: u32,
1016// .saturating_mul(count.into());1029 ) -> Result<(), DispatchError> {
10171030 let dispatch_info = call.get_dispatch_info();
1018// <Balances as NamedReservableCurrency<AccountId>>::reserve_named(1031 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)
1019// &id,1032 .saturating_mul(count.into());
1020// &(sponsor.into()),1033
1021// weight,1034 <Balances as NamedReservableCurrency<AccountId>>::reserve_named(
1022// )1035 &id,
1023// }1036 &(sponsor.into()),
10241037 weight,
1025// fn pay_for_call(1038 )
1026// id: [u8; 16],1039 }
1027// sponsor: <T as frame_system::Config>::AccountId,1040
1028// call: <T as pallet_unique_scheduler::Config>::Call,1041 fn pay_for_call(
1029// ) -> Result<u128, DispatchError> {1042 id: [u8; 16],
1030// let dispatch_info = call.get_dispatch_info();1043 sponsor: <T as frame_system::Config>::AccountId,
1031// let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);1044 call: <T as pallet_unique_scheduler::Config>::Call,
1032// Ok(1045 ) -> Result<u128, DispatchError> {
1033// <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1046 let dispatch_info = call.get_dispatch_info();
1034// &id,1047 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
1035// &(sponsor.into()),1048 Ok(
1036// weight,1049 <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
1037// ),1050 &id,
1038// )1051 &(sponsor.into()),
1039// }1052 weight,
10401053 ),
1041// fn cancel_reserve(1054 )
1042// id: [u8; 16],1055 }
1043// sponsor: <T as frame_system::Config>::AccountId,1056
1044// ) -> Result<u128, DispatchError> {1057 fn cancel_reserve(
1045// Ok(1058 id: [u8; 16],
1046// <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1059 sponsor: <T as frame_system::Config>::AccountId,
1047// &id,1060 ) -> Result<u128, DispatchError> {
1048// &(sponsor.into()),1061 Ok(
1049// u128::MAX,1062 <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
1050// ),1063 &id,
1051// )1064 &(sponsor.into()),
1052// }1065 u128::MAX,
1053// }1066 ),
1067 )
1068 }
1069}
10541070
1055parameter_types! {1071parameter_types! {
1056 pub const NoPreimagePostponement: Option<u32> = Some(10);1072 pub const NoPreimagePostponement: Option<u32> = Some(10);
1066 }1082 }
1067}1083}
10681084
1069// impl pallet_unique_scheduler::Config for Runtime {1085#[cfg(feature = "scheduler")]
1070// type Event = Event;1086impl pallet_unique_scheduler::Config for Runtime {
1071// type Origin = Origin;1087 type Event = Event;
1072// type Currency = Balances;1088 type Origin = Origin;
1073// type PalletsOrigin = OriginCaller;1089 type Currency = Balances;
1074// type Call = Call;1090 type PalletsOrigin = OriginCaller;
1075// type MaximumWeight = MaximumSchedulerWeight;1091 type Call = Call;
1076// type ScheduleOrigin = EnsureSigned<AccountId>;1092 type MaximumWeight = MaximumSchedulerWeight;
1077// type MaxScheduledPerBlock = MaxScheduledPerBlock;1093 type ScheduleOrigin = EnsureSigned<AccountId>;
1078// type WeightInfo = ();1094 type MaxScheduledPerBlock = MaxScheduledPerBlock;
1079// type CallExecutor = SchedulerPaymentExecutor;1095 type WeightInfo = ();
1080// type OriginPrivilegeCmp = OriginPrivilegeCmp;1096 type CallExecutor = SchedulerPaymentExecutor;
1081// type PreimageProvider = ();1097 type OriginPrivilegeCmp = OriginPrivilegeCmp;
1082// type NoPreimagePostponement = NoPreimagePostponement;1098 type PreimageProvider = ();
1083// }1099 type NoPreimagePostponement = NoPreimagePostponement;
1100}
10841101
1085type EvmSponsorshipHandler = (1102type EvmSponsorshipHandler = (
1086 UniqueEthSponsorshipHandler<Runtime>,1103 UniqueEthSponsorshipHandler<Runtime>,
1166 frame_system::CheckEra<Runtime>,1183 frame_system::CheckEra<Runtime>,
1167 frame_system::CheckNonce<Runtime>,1184 frame_system::CheckNonce<Runtime>,
1168 frame_system::CheckWeight<Runtime>,1185 frame_system::CheckWeight<Runtime>,
1169 pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1186 ChargeTransactionPayment,
1170 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,1187 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,
1171 pallet_ethereum::FakeTransactionFinalizer<Runtime>,1188 pallet_ethereum::FakeTransactionFinalizer<Runtime>,
1172);1189);