mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 19:07:57 +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:
@@ -52,14 +52,14 @@
|
||||
//!
|
||||
//! ```
|
||||
//! use frame_support::{decl_module, dispatch};
|
||||
//! use frame_support::weights::{SimpleDispatchInfo, MINIMUM_WEIGHT};
|
||||
//! use frame_support::weights::MINIMUM_WEIGHT;
|
||||
//! use frame_system::{self as system, ensure_root};
|
||||
//!
|
||||
//! pub trait Trait: frame_system::Trait {}
|
||||
//!
|
||||
//! decl_module! {
|
||||
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
//! #[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
//! #[weight = MINIMUM_WEIGHT]
|
||||
//! pub fn privileged_function(origin) -> dispatch::DispatchResult {
|
||||
//! ensure_root(origin)?;
|
||||
//!
|
||||
@@ -93,7 +93,7 @@ use sp_runtime::traits::{StaticLookup, Dispatchable};
|
||||
use frame_support::{
|
||||
Parameter, decl_module, decl_event, decl_storage, decl_error, ensure,
|
||||
};
|
||||
use frame_support::weights::{SimpleDispatchInfo, MINIMUM_WEIGHT, GetDispatchInfo, FunctionOf};
|
||||
use frame_support::weights::{MINIMUM_WEIGHT, GetDispatchInfo, FunctionOf};
|
||||
use frame_system::{self as system, ensure_signed};
|
||||
|
||||
pub trait Trait: frame_system::Trait {
|
||||
@@ -151,7 +151,7 @@ decl_module! {
|
||||
/// - Limited storage reads.
|
||||
/// - One DB change.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
fn set_key(origin, new: <T::Lookup as StaticLookup>::Source) {
|
||||
// This is a public call, so we ensure that the origin is some signed account.
|
||||
let sender = ensure_signed(origin)?;
|
||||
|
||||
Reference in New Issue
Block a user