mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 12:11:09 +00:00
Aggregate all liquidity restrictions in a single place (#1921)
* Clean up session key rotation * Fix build * Bump version * Introduce feature to balances. * Move staking locking logic over to central point * ^^^ rest * First part of assimilation * More assimilation * More assimilation * Fix most tests * Fix build * Move Balances to new locking system * :q! * Bump runtime version * Build runtime * Convenience function * Test fix. * Whitespace * Improve type legibility. * Fix comment. * More tests. * More tests. * Bump version * Caps * Whitespace * Whitespace * Remove unneeded function.
This commit is contained in:
@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0", default-features = false }
|
||||
serde = { version = "1.0", optional = true }
|
||||
serde_derive = { version = "1.0", optional = true }
|
||||
pwasm-utils = { version = "0.6.1", default-features = false }
|
||||
parity-codec = { version = "3.1", default-features = false, features = ["derive"] }
|
||||
@@ -30,7 +30,7 @@ consensus = { package = "srml-consensus", path = "../consensus" }
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"serde/std",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"parity-codec/std",
|
||||
"substrate-primitives/std",
|
||||
|
||||
@@ -20,8 +20,8 @@ use crate::gas::{GasMeter, Token, approx_gas_for_balance};
|
||||
|
||||
use rstd::prelude::*;
|
||||
use runtime_primitives::traits::{CheckedAdd, CheckedSub, Zero};
|
||||
use srml_support::traits::WithdrawReason;
|
||||
use timestamp;
|
||||
use srml_support::traits::EnsureAccountLiquid;
|
||||
|
||||
pub type BalanceOf<T> = <T as balances::Trait>::Balance;
|
||||
pub type AccountIdOf<T> = <T as system::Trait>::AccountId;
|
||||
@@ -520,7 +520,7 @@ fn transfer<'a, T: Trait, V: Vm<T>, L: Loader<T>>(
|
||||
if would_create && value < ctx.config.existential_deposit {
|
||||
return Err("value too low to create account");
|
||||
}
|
||||
<T as balances::Trait>::EnsureAccountLiquid::ensure_account_liquid(transactor)?;
|
||||
<balances::Module<T>>::ensure_account_can_withdraw(transactor, value, WithdrawReason::Transfer, new_from_balance)?;
|
||||
|
||||
let new_to_balance = match to_balance.checked_add(&value) {
|
||||
Some(b) => b,
|
||||
|
||||
@@ -77,7 +77,6 @@ impl balances::Trait for Test {
|
||||
type Balance = u64;
|
||||
type OnFreeBalanceZero = Contract;
|
||||
type OnNewAccount = ();
|
||||
type EnsureAccountLiquid = ();
|
||||
type Event = MetaEvent;
|
||||
}
|
||||
impl timestamp::Trait for Test {
|
||||
|
||||
Reference in New Issue
Block a user