Kusama origins as xcm multi_location (#6273)

* Kusamsa origins as xcm multilocation

* Fellows origin index

* origins to xcm plurality body

* cleanup

* fix cargo spellcheck

* Apply suggestions from code review

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* include Fellows into scope

* include Fellows into scope

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
Muharem Ismailov
2022-12-21 09:33:01 +01:00
committed by GitHub
parent 87f9e4e140
commit dd46523f82
6 changed files with 74 additions and 11 deletions
@@ -321,3 +321,20 @@ where
})
}
}
/// `Convert` implementation to convert from an origin which passes the check of an `EnsureOrigin`
/// into a voice of a given pluralistic `Body`.
pub struct OriginToPluralityVoice<RuntimeOrigin, EnsureBodyOrigin, Body>(
PhantomData<(RuntimeOrigin, EnsureBodyOrigin, Body)>,
);
impl<RuntimeOrigin: Clone, EnsureBodyOrigin: EnsureOrigin<RuntimeOrigin>, Body: Get<BodyId>>
Convert<RuntimeOrigin, MultiLocation>
for OriginToPluralityVoice<RuntimeOrigin, EnsureBodyOrigin, Body>
{
fn convert(o: RuntimeOrigin) -> Result<MultiLocation, RuntimeOrigin> {
match EnsureBodyOrigin::try_origin(o) {
Ok(_) => Ok(Junction::Plurality { id: Body::get(), part: BodyPart::Voice }.into()),
Err(o) => Err(o),
}
}
}