pub struct FungiblesAdapter<CON, HC>(_);
Expand description
Implements the asset transaction for a balance to asset converter (implementing
ConversionToAssetBalance
) and a credit handler (implementing HandleCredit
).
The credit handler is given the complete fee in terms of the asset used for the transaction.
Trait Implementations§
source§impl<T, CON, HC> OnChargeAssetTransaction<T> for FungiblesAdapter<CON, HC>where
T: Config,
CON: ConversionToAssetBalance<<<T as Config>::OnChargeTransaction as OnChargeTransaction<T>>::Balance, <<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::AssetId, <<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::Balance>,
HC: HandleCredit<T::AccountId, T::Fungibles>,
<<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::AssetId: FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default + Eq + TypeInfo,
impl<T, CON, HC> OnChargeAssetTransaction<T> for FungiblesAdapter<CON, HC>where T: Config, CON: ConversionToAssetBalance<<<T as Config>::OnChargeTransaction as OnChargeTransaction<T>>::Balance, <<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::AssetId, <<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::Balance>, HC: HandleCredit<T::AccountId, T::Fungibles>, <<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::AssetId: FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default + Eq + TypeInfo,
Default implementation for a runtime instantiating this pallet, a balance to asset converter and a credit handler.
source§fn withdraw_fee(
who: &T::AccountId,
_call: &T::RuntimeCall,
_info: &DispatchInfoOf<T::RuntimeCall>,
asset_id: Self::AssetId,
fee: Self::Balance,
_tip: Self::Balance
) -> Result<Self::LiquidityInfo, TransactionValidityError>
fn withdraw_fee( who: &T::AccountId, _call: &T::RuntimeCall, _info: &DispatchInfoOf<T::RuntimeCall>, asset_id: Self::AssetId, fee: Self::Balance, _tip: Self::Balance ) -> Result<Self::LiquidityInfo, TransactionValidityError>
Withdraw the predicted fee from the transaction origin.
Note: The fee
already includes the tip
.
source§fn correct_and_deposit_fee(
who: &T::AccountId,
_dispatch_info: &DispatchInfoOf<T::RuntimeCall>,
_post_info: &PostDispatchInfoOf<T::RuntimeCall>,
corrected_fee: Self::Balance,
tip: Self::Balance,
paid: Self::LiquidityInfo
) -> Result<(<<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::Balance, <<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::Balance), TransactionValidityError>
fn correct_and_deposit_fee( who: &T::AccountId, _dispatch_info: &DispatchInfoOf<T::RuntimeCall>, _post_info: &PostDispatchInfoOf<T::RuntimeCall>, corrected_fee: Self::Balance, tip: Self::Balance, paid: Self::LiquidityInfo ) -> Result<(<<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::Balance, <<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::Balance), TransactionValidityError>
Hand the fee and the tip over to the [HandleCredit]
implementation.
Since the predicted fee might have been too high, parts of the fee may be refunded.
Note: The corrected_fee
already includes the tip
.
Returns the fee and tip in the asset used for payment as (fee, tip).
§type Balance = <<T as Config>::OnChargeTransaction as OnChargeTransaction<T>>::Balance
type Balance = <<T as Config>::OnChargeTransaction as OnChargeTransaction<T>>::Balance
The underlying integer type in which fees are calculated.
§type AssetId = <<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::AssetId
type AssetId = <<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::AssetId
The type used to identify the assets used for transaction payment.
§type LiquidityInfo = Imbalance<<<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::AssetId, <<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::Balance, <<T as Config>::Fungibles as Balanced<<T as Config>::AccountId>>::OnDropCredit, <<T as Config>::Fungibles as Balanced<<T as Config>::AccountId>>::OnDropDebt>
type LiquidityInfo = Imbalance<<<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::AssetId, <<T as Config>::Fungibles as Inspect<<T as Config>::AccountId>>::Balance, <<T as Config>::Fungibles as Balanced<<T as Config>::AccountId>>::OnDropCredit, <<T as Config>::Fungibles as Balanced<<T as Config>::AccountId>>::OnDropDebt>
The type used to store the intermediate values between pre- and post-dispatch.
Auto Trait Implementations§
impl<CON, HC> RefUnwindSafe for FungiblesAdapter<CON, HC>where CON: RefUnwindSafe, HC: RefUnwindSafe,
impl<CON, HC> Send for FungiblesAdapter<CON, HC>where CON: Send, HC: Send,
impl<CON, HC> Sync for FungiblesAdapter<CON, HC>where CON: Sync, HC: Sync,
impl<CON, HC> Unpin for FungiblesAdapter<CON, HC>where CON: Unpin, HC: Unpin,
impl<CON, HC> UnwindSafe for FungiblesAdapter<CON, HC>where CON: UnwindSafe, HC: UnwindSafe,
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read moresource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.