pub trait EthExtra {
type Config: Config + Config;
type Extension: TransactionExtension<<Self::Config as Config>::RuntimeCall>;
// Required method
fn get_eth_extension(
nonce: <Self::Config as Config>::Nonce,
tip: <<Self::Config as Config>::Currency as Inspect<<Self::Config as Config>::AccountId>>::Balance,
) -> Self::Extension;
// Provided method
fn try_into_checked_extrinsic(
payload: Vec<u8>,
encoded_len: usize,
) -> Result<CheckedExtrinsic<<Self::Config as Config>::AccountId, <Self::Config as Config>::RuntimeCall, Self::Extension>, InvalidTransaction>
where <Self::Config as Config>::Nonce: TryFrom<U256>,
<<Self::Config as Config>::Currency as Inspect<<Self::Config as Config>::AccountId>>::Balance: Into<U256> + TryFrom<U256>,
MomentOf<Self::Config>: Into<U256>,
<Self::Config as Config>::RuntimeCall: Dispatchable<Info = DispatchInfo> + From<Call<Self::Config>>,
<<Self::Config as Config>::OnChargeTransaction as OnChargeTransaction<Self::Config>>::Balance: Into<<<Self::Config as Config>::Currency as Inspect<<Self::Config as Config>::AccountId>>::Balance>,
<Self::Config as Config>::Hash: IsType<H256> { ... }
}
Expand description
EthExtra convert an unsigned crate::Call::eth_transact
into a [CheckedExtrinsic
].
Required Associated Types§
Sourcetype Extension: TransactionExtension<<Self::Config as Config>::RuntimeCall>
type Extension: TransactionExtension<<Self::Config as Config>::RuntimeCall>
The Runtime’s transaction extension. It should include at least:
- [
frame_system::CheckNonce
] to ensure that the nonce from the Ethereum transaction is correct.
Required Methods§
Sourcefn get_eth_extension(
nonce: <Self::Config as Config>::Nonce,
tip: <<Self::Config as Config>::Currency as Inspect<<Self::Config as Config>::AccountId>>::Balance,
) -> Self::Extension
fn get_eth_extension( nonce: <Self::Config as Config>::Nonce, tip: <<Self::Config as Config>::Currency as Inspect<<Self::Config as Config>::AccountId>>::Balance, ) -> Self::Extension
Get the transaction extension to apply to an unsigned crate::Call::eth_transact
extrinsic.
§Parameters
nonce
: The nonce extracted from the Ethereum transaction.tip
: The transaction tip calculated from the Ethereum transaction.
Provided Methods§
Sourcefn try_into_checked_extrinsic(
payload: Vec<u8>,
encoded_len: usize,
) -> Result<CheckedExtrinsic<<Self::Config as Config>::AccountId, <Self::Config as Config>::RuntimeCall, Self::Extension>, InvalidTransaction>where
<Self::Config as Config>::Nonce: TryFrom<U256>,
<<Self::Config as Config>::Currency as Inspect<<Self::Config as Config>::AccountId>>::Balance: Into<U256> + TryFrom<U256>,
MomentOf<Self::Config>: Into<U256>,
<Self::Config as Config>::RuntimeCall: Dispatchable<Info = DispatchInfo> + From<Call<Self::Config>>,
<<Self::Config as Config>::OnChargeTransaction as OnChargeTransaction<Self::Config>>::Balance: Into<<<Self::Config as Config>::Currency as Inspect<<Self::Config as Config>::AccountId>>::Balance>,
<Self::Config as Config>::Hash: IsType<H256>,
fn try_into_checked_extrinsic(
payload: Vec<u8>,
encoded_len: usize,
) -> Result<CheckedExtrinsic<<Self::Config as Config>::AccountId, <Self::Config as Config>::RuntimeCall, Self::Extension>, InvalidTransaction>where
<Self::Config as Config>::Nonce: TryFrom<U256>,
<<Self::Config as Config>::Currency as Inspect<<Self::Config as Config>::AccountId>>::Balance: Into<U256> + TryFrom<U256>,
MomentOf<Self::Config>: Into<U256>,
<Self::Config as Config>::RuntimeCall: Dispatchable<Info = DispatchInfo> + From<Call<Self::Config>>,
<<Self::Config as Config>::OnChargeTransaction as OnChargeTransaction<Self::Config>>::Balance: Into<<<Self::Config as Config>::Currency as Inspect<<Self::Config as Config>::AccountId>>::Balance>,
<Self::Config as Config>::Hash: IsType<H256>,
Convert the unsigned crate::Call::eth_transact
into a [CheckedExtrinsic
].
and ensure that the fees from the Ethereum transaction correspond to the fees computed from
the encoded_len, the injected gas_limit and storage_deposit_limit.
§Parameters
payload
: The RLP-encoded Ethereum transaction.gas_limit
: The gas limit for the extrinsicstorage_deposit_limit
: The storage deposit limit for the extrinsic,encoded_len
: The encoded length of the extrinsic.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.