mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 16:21:06 +00:00
Migrate away from SimpleDispatchInfo (#5686)
* Migrate away from SimpleDispatchInfo * Fix imports * Better doc * Update lib.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
//!
|
||||
//! ```
|
||||
//! use frame_support::{decl_module, dispatch};
|
||||
//! use frame_support::weights::{SimpleDispatchInfo, MINIMUM_WEIGHT};
|
||||
//! use frame_support::weights::MINIMUM_WEIGHT;
|
||||
//! # use pallet_timestamp as timestamp;
|
||||
//! use frame_system::{self as system, ensure_signed};
|
||||
//!
|
||||
@@ -70,7 +70,7 @@
|
||||
//!
|
||||
//! decl_module! {
|
||||
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
//! #[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
//! #[weight = MINIMUM_WEIGHT]
|
||||
//! pub fn get_time(origin) -> dispatch::DispatchResult {
|
||||
//! let _sender = ensure_signed(origin)?;
|
||||
//! let _now = <timestamp::Module<T>>::get();
|
||||
@@ -101,7 +101,7 @@ use frame_support::debug;
|
||||
use frame_support::{
|
||||
Parameter, decl_storage, decl_module,
|
||||
traits::{Time, UnixTime, Get},
|
||||
weights::{SimpleDispatchInfo, MINIMUM_WEIGHT},
|
||||
weights::{MINIMUM_WEIGHT, DispatchClass},
|
||||
};
|
||||
use sp_runtime::{
|
||||
RuntimeString,
|
||||
@@ -148,7 +148,7 @@ decl_module! {
|
||||
/// `MinimumPeriod`.
|
||||
///
|
||||
/// The dispatch origin for this call must be `Inherent`.
|
||||
#[weight = SimpleDispatchInfo::FixedMandatory(MINIMUM_WEIGHT)]
|
||||
#[weight = (MINIMUM_WEIGHT, DispatchClass::Mandatory)]
|
||||
fn set(origin, #[compact] now: T::Moment) {
|
||||
ensure_none(origin)?;
|
||||
assert!(!<Self as Store>::DidUpdate::exists(), "Timestamp must be updated only once in the block");
|
||||
|
||||
Reference in New Issue
Block a user