git.delta.rocks / unique-network / refs/commits / fd7a252de8c6

difftreelog

ffeat: add new fns to test-utils pallet

Daniel Shiposha2022-09-12parent: #6f1c728.patch.diff
in: master

3 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6675,6 +6675,7 @@
 dependencies = [
  "frame-support",
  "frame-system",
+ "pallet-unique-scheduler",
  "parity-scale-codec 3.1.5",
  "scale-info",
 ]
modifiedtest-pallets/utils/Cargo.tomldiffbeforeafterboth
--- a/test-pallets/utils/Cargo.toml
+++ b/test-pallets/utils/Cargo.toml
@@ -10,6 +10,7 @@
 scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
 frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
 frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
+pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
 
 [features]
 default = ["std"]
@@ -18,4 +19,5 @@
 	"scale-info/std",
 	"frame-support/std",
 	"frame-system/std",
+	"pallet-unique-scheduler/std",
 ]
modifiedtest-pallets/utils/src/lib.rsdiffbeforeafterboth
before · test-pallets/utils/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![cfg_attr(not(feature = "std"), no_std)]1819pub use pallet::*;2021#[frame_support::pallet]22pub mod pallet {23	use frame_support::pallet_prelude::*;24	use frame_system::pallet_prelude::*;2526	#[pallet::config]27	pub trait Config: frame_system::Config {28		type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;29	}3031	#[pallet::event]32	#[pallet::generate_deposit(pub(super) fn deposit_event)]33	pub enum Event<T: Config> {34		ValueIsSet,35		ShouldRollback,36	}3738	#[pallet::pallet]39	#[pallet::generate_store(pub(super) trait Store)]40	pub struct Pallet<T>(_);4142	#[pallet::storage]43	#[pallet::getter(fn something)]44	pub type TestValue<T> = StorageValue<_, u32, ValueQuery>;4546	#[pallet::error]47	pub enum Error<T> {48		TriggerRollback,49	}5051	#[pallet::call]52	impl<T: Config> Pallet<T> {53		#[pallet::weight(10_000)]54		pub fn set_test_value(origin: OriginFor<T>, value: u32) -> DispatchResult {55			ensure_signed(origin)?;5657			<TestValue<T>>::put(value);5859			Self::deposit_event(Event::ValueIsSet);6061			Ok(())62		}6364		#[pallet::weight(10_000)]65		pub fn set_test_value_and_rollback(origin: OriginFor<T>, value: u32) -> DispatchResult {66			Self::set_test_value(origin, value)?;6768			Self::deposit_event(Event::ShouldRollback);6970			Err(<Error<T>>::TriggerRollback.into())71		}7273		#[pallet::weight(100_000_000)]74		pub fn just_take_fee(_origin: OriginFor<T>) -> DispatchResult {75			Ok(())76		}77	}78}