17
17
18
18
//! # Sudo Module
19
19
//!
20
- //! - [`sudo::Trait `](./trait.Trait .html)
20
+ //! - [`sudo::Config `](./trait.Config .html)
21
21
//! - [`Call`](./enum.Call.html)
22
22
//!
23
23
//! ## Overview
55
55
//! use frame_support::{decl_module, dispatch};
56
56
//! use frame_system::ensure_root;
57
57
//!
58
- //! pub trait Trait : frame_system::Trait {}
58
+ //! pub trait Config : frame_system::Config {}
59
59
//!
60
60
//! decl_module! {
61
- //! pub struct Module<T: Trait > for enum Call where origin: T::Origin {
61
+ //! pub struct Module<T: Config > for enum Call where origin: T::Origin {
62
62
//! #[weight = 0]
63
63
//! pub fn privileged_function(origin) -> dispatch::DispatchResult {
64
64
//! ensure_root(origin)?;
82
82
//! * [Democracy](../pallet_democracy/index.html)
83
83
//!
84
84
//! [`Call`]: ./enum.Call.html
85
- //! [`Trait `]: ./trait.Trait .html
85
+ //! [`Config `]: ./trait.Config .html
86
86
//! [`Origin`]: https://docs.substrate.dev/docs/substrate-types
87
87
88
88
#![ cfg_attr( not( feature = "std" ) , no_std) ]
@@ -105,17 +105,17 @@ mod mock;
105
105
#[ cfg( test) ]
106
106
mod tests;
107
107
108
- pub trait Trait : frame_system:: Trait {
108
+ pub trait Config : frame_system:: Config {
109
109
/// The overarching event type.
110
- type Event : From < Event < Self > > + Into < <Self as frame_system:: Trait >:: Event > ;
110
+ type Event : From < Event < Self > > + Into < <Self as frame_system:: Config >:: Event > ;
111
111
112
112
/// A sudo-able call.
113
113
type Call : Parameter + UnfilteredDispatchable < Origin =Self :: Origin > + GetDispatchInfo ;
114
114
}
115
115
116
116
decl_module ! {
117
117
/// Sudo module declaration.
118
- pub struct Module <T : Trait > for enum Call where origin: T :: Origin {
118
+ pub struct Module <T : Config > for enum Call where origin: T :: Origin {
119
119
type Error = Error <T >;
120
120
121
121
fn deposit_event( ) = default ;
@@ -131,7 +131,7 @@ decl_module! {
131
131
/// - Weight of derivative `call` execution + 10,000.
132
132
/// # </weight>
133
133
#[ weight = ( call. get_dispatch_info( ) . weight + 10_000 , call. get_dispatch_info( ) . class) ]
134
- fn sudo( origin, call: Box <<T as Trait >:: Call >) -> DispatchResultWithPostInfo {
134
+ fn sudo( origin, call: Box <<T as Config >:: Call >) -> DispatchResultWithPostInfo {
135
135
// This is a public call, so we ensure that the origin is some signed account.
136
136
let sender = ensure_signed( origin) ?;
137
137
ensure!( sender == Self :: key( ) , Error :: <T >:: RequireSudo ) ;
@@ -153,7 +153,7 @@ decl_module! {
153
153
/// - The weight of this call is defined by the caller.
154
154
/// # </weight>
155
155
#[ weight = ( * _weight, call. get_dispatch_info( ) . class) ]
156
- fn sudo_unchecked_weight( origin, call: Box <<T as Trait >:: Call >, _weight: Weight ) -> DispatchResultWithPostInfo {
156
+ fn sudo_unchecked_weight( origin, call: Box <<T as Config >:: Call >, _weight: Weight ) -> DispatchResultWithPostInfo {
157
157
// This is a public call, so we ensure that the origin is some signed account.
158
158
let sender = ensure_signed( origin) ?;
159
159
ensure!( sender == Self :: key( ) , Error :: <T >:: RequireSudo ) ;
@@ -206,7 +206,7 @@ decl_module! {
206
206
) ]
207
207
fn sudo_as( origin,
208
208
who: <T :: Lookup as StaticLookup >:: Source ,
209
- call: Box <<T as Trait >:: Call >
209
+ call: Box <<T as Config >:: Call >
210
210
) -> DispatchResultWithPostInfo {
211
211
// This is a public call, so we ensure that the origin is some signed account.
212
212
let sender = ensure_signed( origin) ?;
@@ -224,7 +224,7 @@ decl_module! {
224
224
}
225
225
226
226
decl_event ! (
227
- pub enum Event <T > where AccountId = <T as frame_system:: Trait >:: AccountId {
227
+ pub enum Event <T > where AccountId = <T as frame_system:: Config >:: AccountId {
228
228
/// A sudo just took place. \[result\]
229
229
Sudid ( DispatchResult ) ,
230
230
/// The \[sudoer\] just switched identity; the old key is supplied.
@@ -235,15 +235,15 @@ decl_event!(
235
235
) ;
236
236
237
237
decl_storage ! {
238
- trait Store for Module <T : Trait > as Sudo {
238
+ trait Store for Module <T : Config > as Sudo {
239
239
/// The `AccountId` of the sudo key.
240
240
Key get( fn key) config( ) : T :: AccountId ;
241
241
}
242
242
}
243
243
244
244
decl_error ! {
245
245
/// Error for the Sudo module
246
- pub enum Error for Module <T : Trait > {
246
+ pub enum Error for Module <T : Config > {
247
247
/// Sender must be the Sudo account
248
248
RequireSudo ,
249
249
}
0 commit comments