difftreelog
Merge pull request #428 from UniqueNetwork/doc/scheduler
in: master
Doc/scheduler
1 file changed
pallets/scheduler/src/lib.rsdiffbeforeafterboth32// See the License for the specific language governing permissions and32// See the License for the specific language governing permissions and33// limitations under the License.33// limitations under the License.343435//! # Schedulerdo_reschedule35//! # Unique scheduler36//! A Pallet for scheduling dispatches.37//!38//! - [`Config`]39//! - [`Call`]40//! - [`Pallet`]41//!42//! ## Overview36//!43//!37//! This Pallet exposes capabilities for scheduling dispatches to occur at a44//! This Pallet exposes capabilities for scheduling dispatches to occur at a38//! specified block number or at a specified period. These scheduled dispatches45//! specified block number or at a specified period. These scheduled dispatches39//! may be named or anonymous and may be canceled.46//! should be named and may be canceled.40//!47//!41//! **NOTE:** The scheduled calls will be dispatched with the default filter48//! **NOTE:** The unique scheduler is designed for deferred transaction calls by block number.42//! for the origin: namely `frame_system::Config::BaseCallFilter` for all origin49//! Any user can book a call of a certain transaction to a specific block number.43//! except root which will get no filter. And not the filter contained in origin50//! Also possible to book a call with a certain frequency.44//! use to call `fn schedule`.45//!51//!46//! If a call is scheduled using proxy or whatever mecanism which adds filter,52//! Key differences from the original pallet:47//! then those filter will not be used when dispatching the schedule call.53//! https://crates.io/crates/pallet-scheduler54//! Schedule Id restricted by 16 bytes. Identificator for booked call.55//! Priority limited by HARD DEADLINE (<= 63). Calls over maximum weight don't include to block.56//! The maximum weight that may be scheduled per block for any dispatchables of less priority than `schedule::HARD_DEADLINE`.57//! Maybe_periodic limit is 100 calls. Reserved for future sponsored transaction support.58//! At 100 calls reserved amount is not so much and this is avoid potential problems with balance locks.59//! Any account allowed to schedule any calls. Account withdraw implemented through default transaction logic.48//!60//!49//! ## Interface61//! ## Interface50//!62//!51//! ### Dispatchable Functions63//! ### Dispatchable Functions52//!64//!53//! * `schedule` - schedule a dispatch, which may be periodic, to occur at a specified block and54//! with a specified priority.55//! * `cancel` - cancel a scheduled dispatch, specified by block number and index.56//! * `schedule_named` - augments the `schedule` interface with an additional `Vec<u8>` parameter65//! * `schedule_named` - augments the `schedule` interface with an additional `Vec<u8>` parameter57//! that can be used for identification.66//! that can be used for identification.58//! * `cancel_named` - the named complement to the cancel function.67//! * `cancel_named` - the named complement to the cancel function.265 count: u32,274 count: u32,266 ) -> Result<(), DispatchError>;275 ) -> Result<(), DispatchError>;267276277 /// Unlock centain amount from payer268 fn pay_for_call(278 fn pay_for_call(269 id: ScheduledId,279 id: ScheduledId,270 sponsor: <T as frame_system::Config>::AccountId,280 sponsor: <T as frame_system::Config>::AccountId,438 // );448 // );439 // }449 // }440450451 // Execute transaction via chain default pipeline452 // That means dispatch will be processed like any user's extrinsic e.g. transaction fees will be taken441 let r = T::CallExecutor::dispatch_call(sender, call.clone());453 let r = T::CallExecutor::dispatch_call(sender, call.clone());442454443 let mut actual_call_weight: Weight = item_weight;455 let mut actual_call_weight: Weight = item_weight;482 Agenda::<T>::append(wake, Some(s));494 Agenda::<T>::append(wake, Some(s));483 }495 }484 }496 }497 /// Weight should be 0, because transaction already paid485 0498 0486 //total_weight499 //total_weight487 }500 }