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
--- 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",
modifiedpallets/scheduler/src/lib.rsdiffbeforeafterboth
64 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;
7169
72/// 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 the
73/// pallet is dependent on specific other pallets, then their configuration traits71/// pallet is dependent on specific other pallets, then their configuration traits
103 type MaxScheduledPerBlock: Get<u32>;101 type MaxScheduledPerBlock: Get<u32>;
104102
105 /// Sponsoring function103 /// Sponsoring function
106 type Sponsoring: SponsoringResolve<Self::AccountId, <Self as Config>::Call>;104 type SponsorshipHandler: SponsorshipHandler<Self::AccountId, <Self as Config>::Call>;
107105
108 /// 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());