mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 00:01:03 +00:00
Make decl_module! implement OnFinalise (#947)
This commit is contained in:
@@ -41,7 +41,7 @@ extern crate srml_system as system;
|
||||
use rstd::prelude::*;
|
||||
use rstd::result;
|
||||
use codec::{HasCompact, Compact};
|
||||
use primitives::traits::{Zero, OnFinalise, As, MaybeSerializeDebug};
|
||||
use primitives::traits::{Zero, As, MaybeSerializeDebug};
|
||||
use srml_support::{StorageValue, StorageMap, Parameter, Dispatchable, IsSubType};
|
||||
use srml_support::dispatch::Result;
|
||||
use system::ensure_signed;
|
||||
@@ -68,6 +68,11 @@ decl_module! {
|
||||
|
||||
fn start_referendum(proposal: Box<T::Proposal>, vote_threshold: VoteThreshold) -> Result;
|
||||
fn cancel_referendum(ref_index: Compact<ReferendumIndex>) -> Result;
|
||||
fn on_finalise(n: T::BlockNumber) {
|
||||
if let Err(e) = Self::end_block(n) {
|
||||
runtime_io::print(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,14 +313,6 @@ impl<T: Trait> Module<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> OnFinalise<T::BlockNumber> for Module<T> {
|
||||
fn on_finalise(n: T::BlockNumber) {
|
||||
if let Err(e) = Self::end_block(n) {
|
||||
runtime_io::print(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user