moonbeam_runtime_common/
impl_moonbeam_xcm_call.rs1#[macro_export]
18macro_rules! impl_moonbeam_xcm_call {
19 {} => {
20
21 pub struct MoonbeamCall;
22 impl CallDispatcher<RuntimeCall> for MoonbeamCall {
23 fn dispatch(
24 call: RuntimeCall,
25 origin: RuntimeOrigin,
26 ) -> Result<
27 PostDispatchInfoOf<RuntimeCall>,
28 DispatchErrorWithPostInfo<PostDispatchInfoOf<RuntimeCall>>
29 > {
30 if let Ok(raw_origin) = TryInto::<RawOrigin<AccountId>>::try_into(origin.clone().caller) {
31 match (call.clone(), raw_origin) {
32 (
33 RuntimeCall::EthereumXcm(pallet_ethereum_xcm::Call::transact { .. }) |
34 RuntimeCall::EthereumXcm(pallet_ethereum_xcm::Call::transact_through_proxy { .. }),
35 RawOrigin::Signed(account_id)
36 ) => {
37 return RuntimeCall::dispatch(
38 call,
39 pallet_ethereum_xcm::Origin::XcmEthereumTransaction(
40 account_id.into()
41 ).into()
42 );
43 },
44 _ => {}
45 }
46 }
47 RuntimeCall::dispatch(call, origin)
48 }
49 }
50 }
51}