SystemOrigin trait (#7226)

* SystemOrigin trait

* OriginTrait provides AccountId

* Use new trait definition

* Consolidate trait

Co-authored-by: Gav Wood <gavin@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Sergei Shulepov
2020-10-05 19:13:12 +02:00
committed by GitHub
parent 2e72767034
commit 2cf4fb2cbc
2 changed files with 30 additions and 3 deletions
+12
View File
@@ -1621,6 +1621,9 @@ pub trait OriginTrait: Sized {
/// The caller origin, overarching type of all pallets origins.
type PalletsOrigin;
/// The AccountId used across the system.
type AccountId;
/// Add a filter to the origin.
fn add_filter(&mut self, filter: impl Fn(&Self::Call) -> bool + 'static);
@@ -1635,6 +1638,15 @@ pub trait OriginTrait: Sized {
/// Get the caller.
fn caller(&self) -> &Self::PalletsOrigin;
/// Create with system none origin and `frame-system::Trait::BaseCallFilter`.
fn none() -> Self;
/// Create with system root origin and no filter.
fn root() -> Self;
/// Create with system signed origin and `frame-system::Trait::BaseCallFilter`.
fn signed(by: Self::AccountId) -> Self;
}
/// Trait to be used when types are exactly same.