Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into sw/charge-fee
  • Loading branch information
shaunxw committed Mar 6, 2019
commit fb91b0726ace35df181a8dddeb81a7f1b0b6f71b
2 changes: 0 additions & 2 deletions node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ impl balances::Trait for Runtime {
type OnFreeBalanceZero = ();
/// What to do if a new account is created.
type OnNewAccount = Indices;
/// Restrict whether an account can transfer funds. We don't place any further restrictions.
type EnsureAccountLiquid = ();
/// Charge fee.
type ChargeFee = Fees;
/// The uniquitous event type.
Expand Down
1 change: 0 additions & 1 deletion node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ impl balances::Trait for Runtime {
type Balance = Balance;
type OnFreeBalanceZero = ((Staking, Contract), Session);
type OnNewAccount = Indices;
type EnsureAccountLiquid = (Staking, Democracy);
type ChargeFee = fees::Module<Runtime>;
type Event = Event;
}
Expand Down
11 changes: 5 additions & 6 deletions srml/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ use rstd::{cmp, result};
use parity_codec::{Codec, Encode, Decode};
use srml_support::{StorageValue, StorageMap, Parameter, decl_event, decl_storage, decl_module, ensure};
use srml_support::traits::{
UpdateBalanceOutcome, Currency, EnsureAccountLiquid, OnFreeBalanceZero, TransferAsset, ChargeFee,
WithdrawReason, ArithmeticType,
UpdateBalanceOutcome, Currency, OnFreeBalanceZero, TransferAsset, ChargeFee,
WithdrawReason, WithdrawReasons, ArithmeticType, LockIdentifier, LockableCurrency
};
use srml_support::dispatch::Result;
use primitives::traits::{
Expand All @@ -54,9 +54,6 @@ pub trait Trait: system::Trait {
/// Handler for when a new account is created.
type OnNewAccount: OnNewAccount<Self::AccountId>;

/// A function that returns true iff a given account can transfer its funds to another account.
type EnsureAccountLiquid: EnsureAccountLiquid<Self::AccountId, Self::Balance>;

/// Charge fee.
type ChargeFee: ChargeFee<Self::AccountId, Amount=Self::Balance>;

Expand Down Expand Up @@ -619,7 +616,9 @@ impl<T: Trait> TransferAsset<T::AccountId> for Module<T> {
let b = Self::free_balance(who);
// ensure `who`'s account won't be killed.
ensure!(b >= value + Self::existential_deposit(), "account has too few funds");
Self::set_free_balance(who, b - value);
let new_balance = b - value;
Self::ensure_account_can_withdraw(who, value, reason, new_balance)?;
Self::set_free_balance(who, new_balance);
Self::decrease_total_stake_by(value);
Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion srml/balances/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ impl Trait for Runtime {
type Balance = u64;
type OnFreeBalanceZero = ();
type OnNewAccount = ();
type EnsureAccountLiquid = ();
type ChargeFee = fees::Module<Runtime>;
type Event = ();
}
Expand Down
1 change: 0 additions & 1 deletion srml/contract/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ impl balances::Trait for Test {
type Balance = u64;
type OnFreeBalanceZero = Contract;
type OnNewAccount = ();
type EnsureAccountLiquid = ();
type ChargeFee = Fees;
type Event = MetaEvent;
}
Expand Down
1 change: 0 additions & 1 deletion srml/council/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ mod tests {
type Balance = u64;
type OnFreeBalanceZero = ();
type OnNewAccount = ();
type EnsureAccountLiquid = ();
type ChargeFee = fees::Module<Test>;
type Event = Event;
}
Expand Down
1 change: 0 additions & 1 deletion srml/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ mod tests {
type Balance = u64;
type OnFreeBalanceZero = ();
type OnNewAccount = ();
type EnsureAccountLiquid = ();
type ChargeFee = fees::Module<Test>;
type Event = ();
}
Expand Down
1 change: 0 additions & 1 deletion srml/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ mod tests {
type Balance = u64;
type OnFreeBalanceZero = ();
type OnNewAccount = ();
type EnsureAccountLiquid = ();
type ChargeFee = fees::Module<Test>;
type Event = ();
}
Expand Down
1 change: 0 additions & 1 deletion srml/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ mod tests {
type Balance = u64;
type OnFreeBalanceZero = ();
type OnNewAccount = ();
type EnsureAccountLiquid = ();
type ChargeFee = fees::Module<Runtime>;
type Event = MetaEvent;
}
Expand Down
1 change: 0 additions & 1 deletion srml/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ impl balances::Trait for Test {
type Balance = u64;
type OnFreeBalanceZero = Staking;
type OnNewAccount = ();
type EnsureAccountLiquid = Staking;
type ChargeFee = fees::Module<Test>;
type Event = ();
}
Expand Down
1 change: 0 additions & 1 deletion srml/treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ mod tests {
type Balance = u64;
type OnNewAccount = ();
type OnFreeBalanceZero = ();
type EnsureAccountLiquid = ();
type ChargeFee = fees::Module<Test>;
type Event = ();
}
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.