Skip to content

Commit

Permalink
Merge pull request #111 from AurevoirXavier/fix-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hackfisher authored Nov 25, 2019
2 parents 51aecb1 + 21c0032 commit a447084
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 33 deletions.
4 changes: 2 additions & 2 deletions srml/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use support::{
dispatch::Result,
traits::{
Currency, ExistenceRequirement, Get, Imbalance, OnFreeBalanceZero, OnUnbalanced, ReservableCurrency,
SignedImbalance, UpdateBalanceOutcome, WithdrawReason, WithdrawReasons,
SignedImbalance, UpdateBalanceOutcome,
},
Parameter, StorageValue,
};
Expand All @@ -41,7 +41,7 @@ mod mock;
mod tests;

pub use self::imbalances::{NegativeImbalance, PositiveImbalance};
use darwinia_support::{BalanceLock, LockIdentifier, LockableCurrency, WithdrawLock};
use darwinia_support::{BalanceLock, LockIdentifier, LockableCurrency, WithdrawLock, WithdrawReason, WithdrawReasons};

pub trait Subtrait<I: Instance = DefaultInstance>: system::Trait + timestamp::Trait {
/// The balance of an account.
Expand Down
12 changes: 6 additions & 6 deletions srml/balances/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
#![cfg(test)]

use super::*;
use mock::{info_from_weight, Balances, ExtBuilder, Runtime, System, CALL};
use sr_primitives::traits::SignedExtension;
use support::{
assert_err, assert_noop, assert_ok,
traits::{
Currency, ExistenceRequirement::AllowDeath, LockIdentifier, LockableCurrency, ReservableCurrency,
WithdrawReason, WithdrawReasons,
},
traits::{Currency, ExistenceRequirement::AllowDeath, LockableCurrency, ReservableCurrency},
};
use system::RawOrigin;
use transaction_payment::ChargeTransactionPayment;

use darwinia_support::{LockIdentifier, WithdrawReason, WithdrawReasons};

use super::*;
use mock::{info_from_weight, Balances, ExtBuilder, Runtime, System, CALL};

const ID_1: LockIdentifier = *b"1 ";
const ID_2: LockIdentifier = *b"2 ";
const ID_3: LockIdentifier = *b"3 ";
Expand Down
7 changes: 2 additions & 5 deletions srml/kton/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@ use sr_primitives::{
use srml_support::{
decl_event, decl_module, decl_storage,
dispatch::Result,
traits::{
Currency, ExistenceRequirement, Imbalance, OnUnbalanced, SignedImbalance, UpdateBalanceOutcome, WithdrawReason,
WithdrawReasons,
},
traits::{Currency, ExistenceRequirement, Imbalance, OnUnbalanced, SignedImbalance, UpdateBalanceOutcome},
Parameter, StorageMap, StorageValue,
};
use system::ensure_signed;

use darwinia_support::{BalanceLock, LockIdentifier, LockableCurrency, WithdrawLock};
use darwinia_support::{BalanceLock, LockIdentifier, LockableCurrency, WithdrawLock, WithdrawReason, WithdrawReasons};
use imbalance::{NegativeImbalance, PositiveImbalance};

#[cfg(test)]
Expand Down
7 changes: 3 additions & 4 deletions srml/kton/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use srml_support::{
assert_err, assert_noop, assert_ok,
traits::{Currency, LockIdentifier, WithdrawReason, WithdrawReasons},
};
use srml_support::{assert_err, assert_noop, assert_ok, traits::Currency};

use darwinia_support::{LockIdentifier, WithdrawReason, WithdrawReasons};

use super::*;
use crate::mock::*;
Expand Down
6 changes: 4 additions & 2 deletions srml/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ use sr_staking_primitives::{
};
use srml_support::{
decl_event, decl_module, decl_storage, ensure,
traits::{Currency, Get, Imbalance, OnFreeBalanceZero, OnUnbalanced, Time, WithdrawReason, WithdrawReasons},
traits::{Currency, Get, Imbalance, OnFreeBalanceZero, OnUnbalanced, Time},
};
use system::{ensure_root, ensure_signed};

use darwinia_support::{LockIdentifier, LockableCurrency, NormalLock, StakingLock, TimeStamp, WithdrawLock};
use darwinia_support::{
LockIdentifier, LockableCurrency, NormalLock, StakingLock, TimeStamp, WithdrawLock, WithdrawReason, WithdrawReasons,
};
use phragmen::{build_support_map, elect, equalize, ExtendedBalance, PhragmenStakedAssignment};

use core::convert::TryInto;
Expand Down
7 changes: 2 additions & 5 deletions srml/staking/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
use srml_support::{
assert_err, assert_ok,
traits::{Currency, WithdrawReason, WithdrawReasons},
};
use srml_support::{assert_err, assert_ok, traits::Currency};

use super::*;
use crate::mock::*;
use darwinia_support::{BalanceLock, NormalLock, StakingLock, WithdrawLock};
use darwinia_support::{BalanceLock, NormalLock, StakingLock, WithdrawLock, WithdrawReason, WithdrawReasons};

// gen_paired_account!(a(1), b(2), m(12));
// will create stash `a` and controller `b`
Expand Down
13 changes: 5 additions & 8 deletions srml/support/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#![recursion_limit = "128"]
#![cfg_attr(not(feature = "std"), no_std)]

pub use srml_support::traits::{LockIdentifier, WithdrawReason, WithdrawReasons};

pub use structs::*;
pub use traits::*;

/// An identifier for a lock. Used for disambiguating different locks so that
/// they can be individually replaced or removed.
pub type LockIdentifier = [u8; 8];

pub type TimeStamp = u64;

mod structs {
Expand All @@ -17,9 +15,8 @@ mod structs {
traits::{SaturatedConversion, SimpleArithmetic},
RuntimeDebug,
};
use srml_support::traits::WithdrawReasons;

use super::{LockIdentifier, TimeStamp};
use super::{LockIdentifier, TimeStamp, WithdrawReasons};

#[derive(Clone, PartialEq, Encode, Decode, RuntimeDebug)]
pub struct BalanceLock<Balance, Moment> {
Expand Down Expand Up @@ -97,9 +94,9 @@ mod structs {
}

mod traits {
use srml_support::traits::{Currency, WithdrawReasons};
use srml_support::traits::Currency;

use super::{LockIdentifier, WithdrawLock};
use super::{LockIdentifier, WithdrawLock, WithdrawReasons};

pub trait OnMinted<Balance> {
fn on_minted(value: Balance);
Expand Down
2 changes: 1 addition & 1 deletion types.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},

"BalanceLock": {
"id": "Vec<u8>",
"id": "LockIdentifier",
"withdraw_lock": "WithdrawLock",
"reasons": "WithdrawReasons"
},
Expand Down

0 comments on commit a447084

Please sign in to comment.