Add FixedPointOperand blanket implementation (#14634)

* bound `Balance` to `FixedPointOperand`

* ".git/.scripts/commands/fmt/fmt.sh"

* clean up code

* Apply suggestions from code review

Co-authored-by: Gavin Wood <gavin@parity.io>

* wip

* add blanket `FixedPointOperand` impl

* update nis CurrencyBalance

* remove CheckedNeg bound

---------

Co-authored-by: command-bot <>
Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
Juan
2023-08-02 09:54:11 +02:00
committed by GitHub
parent 77321288c3
commit 85f9931e4f
11 changed files with 35 additions and 63 deletions
@@ -60,7 +60,6 @@ use sp_runtime::{
transaction_validity::{
InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction,
},
FixedPointOperand,
};
#[cfg(test)]
@@ -165,12 +164,8 @@ pub struct ChargeAssetTxPayment<T: Config> {
impl<T: Config> ChargeAssetTxPayment<T>
where
T::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
AssetBalanceOf<T>: Send + Sync + FixedPointOperand,
BalanceOf<T>: Send
+ Sync
+ FixedPointOperand
+ Into<ChargeAssetBalanceOf<T>>
+ From<ChargeAssetLiquidityOf<T>>,
AssetBalanceOf<T>: Send + Sync,
BalanceOf<T>: Send + Sync + Into<ChargeAssetBalanceOf<T>> + From<ChargeAssetLiquidityOf<T>>,
ChargeAssetIdOf<T>: Send + Sync,
{
/// Utility constructor. Used only in client/factory code.
@@ -234,11 +229,10 @@ impl<T: Config> sp_std::fmt::Debug for ChargeAssetTxPayment<T> {
impl<T: Config> SignedExtension for ChargeAssetTxPayment<T>
where
T::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
AssetBalanceOf<T>: Send + Sync + FixedPointOperand,
AssetBalanceOf<T>: Send + Sync,
BalanceOf<T>: Send
+ Sync
+ From<u64>
+ FixedPointOperand
+ Into<ChargeAssetBalanceOf<T>>
+ Into<ChargeAssetLiquidityOf<T>>
+ From<ChargeAssetLiquidityOf<T>>,