Make decl_module! implement OnFinalise (#947)

This commit is contained in:
Bastian Köcher
2018-10-23 09:58:15 +02:00
committed by GitHub
parent 52093c4b7a
commit 1ba73e0e88
19 changed files with 158 additions and 117 deletions
+4 -8
View File
@@ -103,7 +103,7 @@ use double_map::StorageDoubleMap;
use rstd::prelude::*;
use rstd::marker::PhantomData;
use codec::{Codec, HasCompact};
use runtime_primitives::traits::{Hash, As, SimpleArithmetic, OnFinalise};
use runtime_primitives::traits::{Hash, As, SimpleArithmetic};
use runtime_support::dispatch::Result;
use runtime_support::{Parameter, StorageMap, StorageValue};
use system::ensure_signed;
@@ -167,6 +167,9 @@ decl_module! {
init_code: Vec<u8>,
data: Vec<u8>
) -> Result;
fn on_finalise() {
<GasSpent<T>>::kill();
}
}
}
@@ -326,10 +329,3 @@ impl<T: Trait> balances::OnFreeBalanceZero<T::AccountId> for Module<T> {
<StorageOf<T>>::remove_prefix(who.clone());
}
}
/// Finalization hook for the smart-contract module.
impl<T: Trait> OnFinalise<T::BlockNumber> for Module<T> {
fn on_finalise(_n: T::BlockNumber) {
<GasSpent<T>>::kill();
}
}