From 900dc0450c74d0ea66ea5681817952d313dc6e08 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Thu, 24 Jun 2021 19:46:18 +0000 Subject: [PATCH] reafactor: switch scheduler to sponsoring primitive --- --- a/pallets/scheduler/Cargo.toml +++ b/pallets/scheduler/Cargo.toml @@ -14,15 +14,12 @@ codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' } frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' } -pallet-contracts = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' } sp-runtime = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' } sp-std = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' } sp-io = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' } frame-benchmarking = { default-features = false, version = '3.0.0', optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.3' } -pallet-nft-transaction-payment = { default-features = false, path = "../nft-transaction-payment" } -pallet-nft = { default-features = false, path = "../nft" } -nft-data-structs = { path = '../../primitives', default-features = false } +up-sponsorship = { default-features = false, path = "../../primitives/sponsorship", version = "0.1.0" } log = { version = "0.4.14", default-features = false } [dev-dependencies] @@ -37,10 +34,7 @@ "frame-benchmarking/std", "frame-support/std", "frame-system/std", - "pallet-nft-transaction-payment/std", - "pallet-nft/std", - "pallet-contracts/std", - "nft-data-structs/std", + "up-sponsorship/std", "sp-io/std", "sp-std/std", "log/std", --- 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; /// Sponsoring function - type Sponsoring: SponsoringResolve::Call>; + type SponsorshipHandler: SponsorshipHandler::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(); -- gitstuff