git.delta.rocks / unique-network / refs/commits / 900dc0450c74

difftreelog

reafactor: switch scheduler to sponsoring primitive

Yaroslav Bolyukin2021-06-24parent: #afcf32a.patch.diff
in: master

2 files changed

modifiedpallets/scheduler/Cargo.tomldiffbeforeafterboth
before · pallets/scheduler/Cargo.toml
1[package]2name = "pallet-scheduler"3version = "3.0.0"4authors = ["Parity Technologies <admin@parity.io>"]5edition = "2018"6license = "Unlicense"7homepage = "https://substrate.dev"8repository = "https://github.com/paritytech/substrate/"9description = "FRAME example pallet"10readme = "README.md"1112[dependencies]13serde = { version = "1.0.119", default-features = false }14codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }15frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }16frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }17pallet-contracts = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }18sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }19sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }20sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }21frame-benchmarking = { default-features = false, version = '3.0.0', optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }2223pallet-nft-transaction-payment = { default-features = false, path = "../nft-transaction-payment" }24pallet-nft = { default-features = false, path = "../nft" }25nft-data-structs = { path = '../../primitives', default-features = false }26log = { version = "0.4.14", default-features = false }2728[dev-dependencies]29sp-core = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }30substrate-test-utils = { version = "3.0.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }3132[features]33default = ["std"]34std = [35	"codec/std",36	"sp-runtime/std",37	"frame-benchmarking/std",38	"frame-support/std",39	"frame-system/std",40	"pallet-nft-transaction-payment/std",41	"pallet-nft/std",42	"pallet-contracts/std",43	"nft-data-structs/std",44	"sp-io/std",45	"sp-std/std",46	"log/std",47]48runtime-benchmarks = [49	"frame-benchmarking",50	"frame-support/runtime-benchmarks",51	"frame-system/runtime-benchmarks",52]53#try-runtime = ["frame-support/try-runtime"]
modifiedpallets/scheduler/src/lib.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -64,10 +64,8 @@
 	weights::{GetDispatchInfo, Weight},
 };
 use frame_system::{self as system, ensure_signed};
-use pallet_nft::*;
-// use pallet_nft_transaction_payment::{self as nft_transaction_payment};
-use nft_data_structs::*;
 pub use weights::WeightInfo;
+use up_sponsorship::SponsorshipHandler;
 
 /// Our pallet's configuration trait. All our types and constants go in here. If the
 /// pallet is dependent on specific other pallets, then their configuration traits
@@ -103,7 +101,7 @@
 	type MaxScheduledPerBlock: Get<u32>;
 
 	/// Sponsoring function
-	type Sponsoring: SponsoringResolve<Self::AccountId, <Self as Config>::Call>;
+	type SponsorshipHandler: SponsorshipHandler<Self::AccountId, <Self as Config>::Call>;
 
 	/// Weight information for extrinsics in this pallet.
 	type WeightInfo: WeightInfo;
@@ -405,8 +403,7 @@
 							s.origin.clone()
 						).into();
 						let sender = ensure_signed(origin).unwrap_or(T::AccountId::default());
-						let who_will_pay = T::Sponsoring::resolve(&sender, &s.call.clone()).unwrap_or(
-							sender);
+						let who_will_pay = T::SponsorshipHandler::get_sponsor(&sender, &s.call).unwrap_or(sender);
 						let sponsor = T::PalletsOrigin::from(system::RawOrigin::Signed(who_will_pay));
 						let r = s.call.clone().dispatch(sponsor.into());
 						let maybe_id = s.maybe_id.clone();