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:
Kian Paimani
2020-04-22 09:20:28 +02:00
committed by GitHub
parent 25c3ab2c1e
commit 50a7e12b3f
40 changed files with 458 additions and 405 deletions
+9 -9
View File
@@ -159,7 +159,7 @@ use codec::{Encode, Decode};
use frame_support::{
decl_module, decl_event, decl_storage, decl_error, ensure,
Parameter, RuntimeDebug, weights::{MINIMUM_WEIGHT, GetDispatchInfo, SimpleDispatchInfo, FunctionOf},
Parameter, RuntimeDebug, weights::{MINIMUM_WEIGHT, GetDispatchInfo, FunctionOf},
traits::{Currency, ReservableCurrency, Get, BalanceStatus},
dispatch::PostDispatchInfo,
};
@@ -365,7 +365,7 @@ decl_module! {
/// - One storage write O(1)
/// - One event
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn set_recovered(origin, lost: T::AccountId, rescuer: T::AccountId) {
ensure_root(origin)?;
// Create the recovery storage item.
@@ -400,7 +400,7 @@ decl_module! {
///
/// Total Complexity: O(F + X)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(100_000_000)]
#[weight = 100_000_000]
fn create_recovery(origin,
friends: Vec<T::AccountId>,
threshold: u16,
@@ -460,7 +460,7 @@ decl_module! {
///
/// Total Complexity: O(F + X)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(100_000_000)]
#[weight = 100_000_000]
fn initiate_recovery(origin, account: T::AccountId) {
let who = ensure_signed(origin)?;
// Check that the account is recoverable
@@ -506,7 +506,7 @@ decl_module! {
///
/// Total Complexity: O(F + logF + V + logV)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(100_000_000)]
#[weight = 100_000_000]
fn vouch_recovery(origin, lost: T::AccountId, rescuer: T::AccountId) {
let who = ensure_signed(origin)?;
// Get the recovery configuration for the lost account.
@@ -545,7 +545,7 @@ decl_module! {
///
/// Total Complexity: O(F + V)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(100_000_000)]
#[weight = 100_000_000]
fn claim_recovery(origin, account: T::AccountId) {
let who = ensure_signed(origin)?;
// Get the recovery configuration for the lost account
@@ -590,7 +590,7 @@ decl_module! {
///
/// Total Complexity: O(V + X)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(30_000_000)]
#[weight = 30_000_000]
fn close_recovery(origin, rescuer: T::AccountId) {
let who = ensure_signed(origin)?;
// Take the active recovery process started by the rescuer for this account.
@@ -622,7 +622,7 @@ decl_module! {
///
/// Total Complexity: O(F + X)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(30_000_000)]
#[weight = 30_000_000]
fn remove_recovery(origin) {
let who = ensure_signed(origin)?;
// Check there are no active recoveries
@@ -647,7 +647,7 @@ decl_module! {
/// # <weight>
/// - One storage mutation to check account is recovered by `who`. O(1)
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn cancel_recovered(origin, account: T::AccountId) {
let who = ensure_signed(origin)?;
// Check `who` is allowed to make a call on behalf of `account`