Weights to u64 + Balances Weights (#5446)

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2020-04-16 10:43:18 +02:00
committed by GitHub
parent 1c7525fd4b
commit 980b635c8d
82 changed files with 636 additions and 428 deletions
+6 -6
View File
@@ -25,7 +25,7 @@ use sp_runtime::traits::{
StaticLookup, Member, LookupError, Zero, One, BlakeTwo256, Hash, Saturating, AtLeast32Bit
};
use frame_support::{Parameter, decl_module, decl_error, decl_event, decl_storage, ensure};
use frame_support::weights::{Weight, SimpleDispatchInfo, WeighData};
use frame_support::weights::{Weight, MINIMUM_WEIGHT, SimpleDispatchInfo};
use frame_support::dispatch::DispatchResult;
use frame_support::traits::{Currency, ReservableCurrency, Get, BalanceStatus::Reserved};
use frame_support::storage::migration::take_storage_value;
@@ -102,7 +102,7 @@ decl_module! {
fn on_initialize() -> Weight {
Self::migrations();
SimpleDispatchInfo::default().weigh_data(())
MINIMUM_WEIGHT
}
/// Assign an previously unassigned index.
@@ -121,7 +121,7 @@ decl_module! {
/// - One reserve operation.
/// - One event.
/// # </weight>
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
fn claim(origin, index: T::AccountIndex) {
let who = ensure_signed(origin)?;
@@ -149,7 +149,7 @@ decl_module! {
/// - One transfer operation.
/// - One event.
/// # </weight>
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
fn transfer(origin, new: T::AccountId, index: T::AccountIndex) {
let who = ensure_signed(origin)?;
ensure!(who != new, Error::<T>::NotTransfer);
@@ -180,7 +180,7 @@ decl_module! {
/// - One reserve operation.
/// - One event.
/// # </weight>
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
fn free(origin, index: T::AccountIndex) {
let who = ensure_signed(origin)?;
@@ -209,7 +209,7 @@ decl_module! {
/// - Up to one reserve operation.
/// - One event.
/// # </weight>
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
fn force_transfer(origin, new: T::AccountId, index: T::AccountIndex) {
ensure_root(origin)?;
+1
View File
@@ -61,6 +61,7 @@ impl frame_system::Trait for Test {
type Event = MetaEvent;
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();