Skip to content

Commit

Permalink
Use the balance trait as we have one (paritytech#13136)
Browse files Browse the repository at this point in the history
  • Loading branch information
gilescope authored and ark0f committed Feb 27, 2023
1 parent 10af8fc commit 8b3990b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
14 changes: 3 additions & 11 deletions frame/transaction-payment/asset-tx-payment/src/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,21 @@ use codec::FullCodec;
use frame_support::{
traits::{
fungibles::{Balanced, CreditOf, Inspect},
tokens::BalanceConversion,
tokens::{Balance, BalanceConversion},
},
unsigned::TransactionValidityError,
};
use scale_info::TypeInfo;
use sp_runtime::{
traits::{
AtLeast32BitUnsigned, DispatchInfoOf, MaybeSerializeDeserialize, One, PostDispatchInfoOf,
},
traits::{DispatchInfoOf, MaybeSerializeDeserialize, One, PostDispatchInfoOf},
transaction_validity::InvalidTransaction,
};
use sp_std::{fmt::Debug, marker::PhantomData};

/// Handle withdrawing, refunding and depositing of transaction fees.
pub trait OnChargeAssetTransaction<T: Config> {
/// The underlying integer type in which fees are calculated.
type Balance: AtLeast32BitUnsigned
+ FullCodec
+ Copy
+ MaybeSerializeDeserialize
+ Debug
+ Default
+ TypeInfo;
type Balance: Balance;
/// The type used to identify the assets used for transaction payment.
type AssetId: FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default + Eq + TypeInfo;
/// The type used to store the intermediate values between pre- and post-dispatch.
Expand Down
17 changes: 4 additions & 13 deletions frame/transaction-payment/src/payment.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
/// ! Traits and default implementation for paying transaction fees.
use crate::Config;

use codec::FullCodec;
use sp_runtime::{
traits::{
AtLeast32BitUnsigned, DispatchInfoOf, MaybeSerializeDeserialize, PostDispatchInfoOf,
Saturating, Zero,
},
traits::{DispatchInfoOf, PostDispatchInfoOf, Saturating, Zero},
transaction_validity::InvalidTransaction,
};
use sp_std::{fmt::Debug, marker::PhantomData};
use sp_std::marker::PhantomData;

use frame_support::{
traits::{Currency, ExistenceRequirement, Imbalance, OnUnbalanced, WithdrawReasons},
Expand All @@ -22,13 +18,8 @@ type NegativeImbalanceOf<C, T> =
/// Handle withdrawing, refunding and depositing of transaction fees.
pub trait OnChargeTransaction<T: Config> {
/// The underlying integer type in which fees are calculated.
type Balance: AtLeast32BitUnsigned
+ FullCodec
+ Copy
+ MaybeSerializeDeserialize
+ Debug
+ Default
+ scale_info::TypeInfo;
type Balance: frame_support::traits::tokens::Balance;

type LiquidityInfo: Default;

/// Before the transaction is executed the payment of the transaction fees
Expand Down

0 comments on commit 8b3990b

Please sign in to comment.