decouple balances from some modules (#1641)

* decouple balances from some module by creating a new traits in support/traits
* improve decl_event
This commit is contained in:
thiolliere
2019-02-08 17:43:12 +01:00
committed by GitHub
parent 83f9e1e720
commit e5dbcf6890
19 changed files with 510 additions and 341 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ use {balances, system};
use rstd::cell::RefCell;
use rstd::collections::btree_map::{BTreeMap, Entry};
use rstd::prelude::*;
use runtime_support::{StorageMap, StorageDoubleMap};
use runtime_support::{StorageMap, StorageDoubleMap, traits::UpdateBalanceOutcome};
pub struct ChangeEntry<T: Trait> {
balance: Option<T::Balance>,
@@ -65,7 +65,7 @@ impl<T: Trait> AccountDb<T> for DirectAccountDb {
fn commit(&mut self, s: ChangeSet<T>) {
for (address, changed) in s.into_iter() {
if let Some(balance) = changed.balance {
if let balances::UpdateBalanceOutcome::AccountKilled =
if let UpdateBalanceOutcome::AccountKilled =
balances::Module::<T>::set_free_balance_creating(&address, balance)
{
// Account killed. This will ultimately lead to calling `OnFreeBalanceZero` callback