1234567891011121314151617use sp_core::H160;18use sp_runtime::{19 traits::{Dispatchable, DispatchInfoOf, PostDispatchInfoOf},20 transaction_validity::{TransactionValidityError, TransactionValidity},21};22use crate::{Origin, Call};2324impl fp_self_contained::SelfContainedCall for Call {25 type SignedInfo = H160;2627 fn is_self_contained(&self) -> bool {28 match self {29 Call::Ethereum(call) => call.is_self_contained(),30 _ => false,31 }32 }3334 fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {35 match self {36 Call::Ethereum(call) => call.check_self_contained(),37 _ => None,38 }39 }4041 fn validate_self_contained(42 &self,43 info: &Self::SignedInfo,44 dispatch_info: &DispatchInfoOf<Call>,45 len: usize,46 ) -> Option<TransactionValidity> {47 match self {48 Call::Ethereum(call) => call.validate_self_contained(info, dispatch_info, len),49 _ => None,50 }51 }5253 fn pre_dispatch_self_contained(54 &self,55 info: &Self::SignedInfo,56 ) -> Option<Result<(), TransactionValidityError>> {57 match self {58 Call::Ethereum(call) => call.pre_dispatch_self_contained(info),59 _ => None,60 }61 }6263 fn apply_self_contained(64 self,65 info: Self::SignedInfo,66 ) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {67 match self {68 call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(69 Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),70 )),71 _ => None,72 }73 }74}