Frame: Give Referendum SubmitOrigin argument (#14326)

* Referedum's SubmitOrigin should have an arg

* Fixes

* Nits and two extra utils

* Fixes

* Fixes
This commit is contained in:
Gavin Wood
2023-06-12 09:10:19 +01:00
committed by GitHub
parent 62f37e105c
commit 9716c8a1cb
14 changed files with 462 additions and 88 deletions
+20
View File
@@ -89,6 +89,26 @@ impl<AccountId> From<Option<AccountId>> for RawOrigin<AccountId> {
}
}
impl<AccountId> RawOrigin<AccountId> {
/// Returns `Some` with a reference to the `AccountId` if `self` is `Signed`, `None` otherwise.
pub fn as_signed(&self) -> Option<&AccountId> {
match &self {
Self::Signed(x) => Some(x),
_ => None,
}
}
/// Returns `true` if `self` is `Root`, `None` otherwise.
pub fn is_root(&self) -> bool {
matches!(&self, Self::Root)
}
/// Returns `true` if `self` is `None`, `None` otherwise.
pub fn is_none(&self) -> bool {
matches!(&self, Self::None)
}
}
/// A type that can be used as a parameter in a dispatchable function.
///
/// When using `decl_module` all arguments for call functions must implement this trait.