Trait pallet_evm::OnChargeEVMTransaction
source · pub trait OnChargeEVMTransaction<T: Config> {
type LiquidityInfo: Default;
// Required methods
fn withdraw_fee(
who: &H160,
fee: U256
) -> Result<Self::LiquidityInfo, Error<T>>;
fn correct_and_deposit_fee(
who: &H160,
corrected_fee: U256,
base_fee: U256,
already_withdrawn: Self::LiquidityInfo
) -> Self::LiquidityInfo;
fn pay_priority_fee(tip: Self::LiquidityInfo);
}
Expand description
Handle withdrawing, refunding and depositing of transaction fees.
Similar to OnChargeTransaction
of pallet_transaction_payment
Required Associated Types§
type LiquidityInfo: Default
Required Methods§
sourcefn withdraw_fee(who: &H160, fee: U256) -> Result<Self::LiquidityInfo, Error<T>>
fn withdraw_fee(who: &H160, fee: U256) -> Result<Self::LiquidityInfo, Error<T>>
Before the transaction is executed the payment of the transaction fees need to be secured.
sourcefn correct_and_deposit_fee(
who: &H160,
corrected_fee: U256,
base_fee: U256,
already_withdrawn: Self::LiquidityInfo
) -> Self::LiquidityInfo
fn correct_and_deposit_fee( who: &H160, corrected_fee: U256, base_fee: U256, already_withdrawn: Self::LiquidityInfo ) -> Self::LiquidityInfo
After the transaction was executed the actual fee can be calculated.
This function should refund any overpaid fees and optionally deposit
the corrected amount, and handles the base fee rationing using the provided
OnUnbalanced
implementation.
Returns the NegativeImbalance
- if any - produced by the priority fee.
sourcefn pay_priority_fee(tip: Self::LiquidityInfo)
fn pay_priority_fee(tip: Self::LiquidityInfo)
Introduced in EIP1559 to handle the priority tip.
Implementations on Foreign Types§
source§impl<T> OnChargeEVMTransaction<T> for ()where
T: Config,
<T::Currency as Currency<<T as Config>::AccountId>>::PositiveImbalance: Imbalance<<T::Currency as Currency<<T as Config>::AccountId>>::Balance, Opposite = <T::Currency as Currency<<T as Config>::AccountId>>::NegativeImbalance>,
<T::Currency as Currency<<T as Config>::AccountId>>::NegativeImbalance: Imbalance<<T::Currency as Currency<<T as Config>::AccountId>>::Balance, Opposite = <T::Currency as Currency<<T as Config>::AccountId>>::PositiveImbalance>,
U256: UniqueSaturatedInto<BalanceOf<T>>,
impl<T> OnChargeEVMTransaction<T> for ()where T: Config, <T::Currency as Currency<<T as Config>::AccountId>>::PositiveImbalance: Imbalance<<T::Currency as Currency<<T as Config>::AccountId>>::Balance, Opposite = <T::Currency as Currency<<T as Config>::AccountId>>::NegativeImbalance>, <T::Currency as Currency<<T as Config>::AccountId>>::NegativeImbalance: Imbalance<<T::Currency as Currency<<T as Config>::AccountId>>::Balance, Opposite = <T::Currency as Currency<<T as Config>::AccountId>>::PositiveImbalance>, U256: UniqueSaturatedInto<BalanceOf<T>>,
Implementation for () does not specify what to do with imbalance