use srml_support::codec::{Encode, Decode}; pub trait Trait: 'static + Eq + Clone { type Origin: Into, Self::Origin>> + From>; type BlockNumber: Decode + Encode + Clone + Default; type Hash; type AccountId: Encode + Decode; type Event: From; } srml_support::decl_module! { pub struct Module for enum Call where origin: T::Origin { } } impl Module { pub fn deposit_event(_event: impl Into) { } } srml_support::decl_event!( pub enum Event { ExtrinsicSuccess, ExtrinsicFailed, } ); /// Origin for the system module. #[derive(PartialEq, Eq, Clone)] #[cfg_attr(feature = "std", derive(Debug))] pub enum RawOrigin { Root, Signed(AccountId), None, } impl From> for RawOrigin { fn from(s: Option) -> RawOrigin { match s { Some(who) => RawOrigin::Signed(who), None => RawOrigin::None, } } } pub type Origin = RawOrigin<::AccountId>; #[allow(dead_code)] pub fn ensure_root(o: OuterOrigin) -> Result<(), &'static str> where OuterOrigin: Into, OuterOrigin>> { o.into().map(|_| ()).map_err(|_| "bad origin: expected to be a root origin") }