mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
Migrate all doc to new pallet macro (#10187)
* Migrate all doc to new pallet macro Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix indent Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix format Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
@@ -157,17 +157,25 @@
|
||||
//! ### Example: Rewarding a validator by id.
|
||||
//!
|
||||
//! ```
|
||||
//! use frame_support::{decl_module, dispatch};
|
||||
//! use frame_system::ensure_signed;
|
||||
//! use pallet_staking::{self as staking};
|
||||
//!
|
||||
//! pub trait Config: staking::Config {}
|
||||
//! #[frame_support::pallet]
|
||||
//! pub mod pallet {
|
||||
//! use super::*;
|
||||
//! use frame_support::pallet_prelude::*;
|
||||
//! use frame_system::pallet_prelude::*;
|
||||
//!
|
||||
//! decl_module! {
|
||||
//! pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
//! #[pallet::pallet]
|
||||
//! pub struct Pallet<T>(_);
|
||||
//!
|
||||
//! #[pallet::config]
|
||||
//! pub trait Config: frame_system::Config + staking::Config {}
|
||||
//!
|
||||
//! #[pallet::call]
|
||||
//! impl<T: Config> Pallet<T> {
|
||||
//! /// Reward a validator.
|
||||
//! #[weight = 0]
|
||||
//! pub fn reward_myself(origin) -> dispatch::DispatchResult {
|
||||
//! #[pallet::weight(0)]
|
||||
//! pub fn reward_myself(origin: OriginFor<T>) -> DispatchResult {
|
||||
//! let reported = ensure_signed(origin)?;
|
||||
//! <staking::Pallet<T>>::reward_by_ids(vec![(reported, 10)]);
|
||||
//! Ok(())
|
||||
|
||||
Reference in New Issue
Block a user