difftreelog
reafactor: switch scheduler to sponsoring primitive
in: master
2 files changed
pallets/scheduler/Cargo.tomldiffbeforeafterboth14codec = { package = "parity-scale-codec", version = "2.0.0", 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' }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' }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' }17sp-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' }18sp-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' }19sp-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' }20frame-benchmarking = { default-features = false, version = '3.0.0', optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' }222123pallet-nft-transaction-payment = { default-features = false, path = "../nft-transaction-payment" }22up-sponsorship = { default-features = false, path = "../../primitives/sponsorship", version = "0.1.0" }24pallet-nft = { default-features = false, path = "../nft" }25nft-data-structs = { path = '../../primitives', default-features = false }26log = { version = "0.4.14", default-features = false }23log = { version = "0.4.14", default-features = false }272428[dev-dependencies]25[dev-dependencies]37 "frame-benchmarking/std",34 "frame-benchmarking/std",38 "frame-support/std",35 "frame-support/std",39 "frame-system/std",36 "frame-system/std",40 "pallet-nft-transaction-payment/std",41 "pallet-nft/std",42 "pallet-contracts/std",43 "nft-data-structs/std",37 "up-sponsorship/std",44 "sp-io/std",38 "sp-io/std",45 "sp-std/std",39 "sp-std/std",46 "log/std",40 "log/std",pallets/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();