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
@@ -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(())
}
}
}
}
}