Use the balance trait as we have one (#13136)

This commit is contained in:
Squirrel
2023-01-13 13:47:18 +00:00
committed by GitHub
parent 8ac1de8f04
commit deeaa1c8fd
2 changed files with 7 additions and 24 deletions
@@ -21,15 +21,13 @@ 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};
@@ -37,13 +35,7 @@ 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.
@@ -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},
@@ -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