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 authored and GitHub committed 2023-06-12 09:10:19 +01:00
1 parent 62f37e105c
commit 9716c8a1cb
14 files changed
+462 -88

No files matched your search

@@ -418,6 +418,34 @@ fn expand_origin_pallet_conversions(
}
}
}
#attr
impl<'a> TryFrom<&'a OriginCaller> for &'a #pallet_origin {
type Error = ();
fn try_from(
x: &'a OriginCaller,
) -> #scrate::sp_std::result::Result<&'a #pallet_origin, ()> {
if let OriginCaller::#variant_name(l) = x {
Ok(&l)
} else {
Err(())
}
}
}
#attr
impl<'a> TryFrom<&'a RuntimeOrigin> for &'a #pallet_origin {
type Error = ();
fn try_from(
x: &'a RuntimeOrigin,
) -> #scrate::sp_std::result::Result<&'a #pallet_origin, ()> {
if let OriginCaller::#variant_name(l) = &x.caller {
Ok(&l)
} else {
Err(())
}
}
}
}
}