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.rsdiffbeforeafterboth64 weights::{GetDispatchInfo, Weight},64 weights::{GetDispatchInfo, Weight},65};65};66use frame_system::{self as system, ensure_signed};66use frame_system::{self as system, ensure_signed};67use pallet_nft::*;67pub use weights::WeightInfo;68// use pallet_nft_transaction_payment::{self as nft_transaction_payment};69use nft_data_structs::*;68use up_sponsorship::SponsorshipHandler;70pub use weights::WeightInfo;716972/// Our pallet's configuration trait. All our types and constants go in here. If the70/// Our pallet's configuration trait. All our types and constants go in here. If the73/// pallet is dependent on specific other pallets, then their configuration traits71/// pallet is dependent on specific other pallets, then their configuration traits103 type MaxScheduledPerBlock: Get<u32>;101 type MaxScheduledPerBlock: Get<u32>;104102105 /// Sponsoring function103 /// Sponsoring function106 type Sponsoring: SponsoringResolve<Self::AccountId, <Self as Config>::Call>;104 type SponsorshipHandler: SponsorshipHandler<Self::AccountId, <Self as Config>::Call>;107105108 /// Weight information for extrinsics in this pallet.106 /// Weight information for extrinsics in this pallet.109 type WeightInfo: WeightInfo;107 type WeightInfo: WeightInfo;405 s.origin.clone()403 s.origin.clone()406 ).into();404 ).into();407 let sender = ensure_signed(origin).unwrap_or(T::AccountId::default());405 let sender = ensure_signed(origin).unwrap_or(T::AccountId::default());408 let who_will_pay = T::Sponsoring::resolve(&sender, &s.call.clone()).unwrap_or(406 let who_will_pay = T::SponsorshipHandler::get_sponsor(&sender, &s.call).unwrap_or(sender);409 sender);410 let sponsor = T::PalletsOrigin::from(system::RawOrigin::Signed(who_will_pay));407 let sponsor = T::PalletsOrigin::from(system::RawOrigin::Signed(who_will_pay));411 let r = s.call.clone().dispatch(sponsor.into());408 let r = s.call.clone().dispatch(sponsor.into());