mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 11:38:01 +00:00
refactor: inconsistent BalanceConversion fn (#13610)
* refactor: inconsistent BalanceConversion fn * Revert "refactor: inconsistent BalanceConversion fn" This reverts commit 1177877631a11b64df6f019b5390a8a7018e3a3f. * refactor: rename BalanceConversion trait * feat: add ConversionFromAssetBalance
This commit is contained in:
committed by
GitHub
parent
795fcf0484
commit
74bbae6901
@@ -29,8 +29,8 @@ pub mod nonfungibles_v2;
|
||||
pub use imbalance::Imbalance;
|
||||
pub mod pay;
|
||||
pub use misc::{
|
||||
AssetId, Balance, BalanceConversion, BalanceStatus, ConvertRank, DepositConsequence,
|
||||
ExistenceRequirement, Fortitude, GetSalary, Locker, Precision, Preservation, Provenance,
|
||||
Restriction, WithdrawConsequence, WithdrawReasons,
|
||||
AssetId, Balance, BalanceStatus, ConversionFromAssetBalance, ConversionToAssetBalance,
|
||||
ConvertRank, DepositConsequence, ExistenceRequirement, Fortitude, GetSalary, Locker, Precision,
|
||||
Preservation, Provenance, Restriction, WithdrawConsequence, WithdrawReasons,
|
||||
};
|
||||
pub use pay::{Pay, PayFromAccount, PaymentStatus};
|
||||
|
||||
@@ -244,9 +244,19 @@ impl<
|
||||
}
|
||||
|
||||
/// Converts a balance value into an asset balance.
|
||||
pub trait BalanceConversion<InBalance, AssetId, OutBalance> {
|
||||
pub trait ConversionToAssetBalance<InBalance, AssetId, AssetBalance> {
|
||||
type Error;
|
||||
fn to_asset_balance(balance: InBalance, asset_id: AssetId) -> Result<OutBalance, Self::Error>;
|
||||
fn to_asset_balance(balance: InBalance, asset_id: AssetId)
|
||||
-> Result<AssetBalance, Self::Error>;
|
||||
}
|
||||
|
||||
/// Converts an asset balance value into balance.
|
||||
pub trait ConversionFromAssetBalance<AssetBalance, AssetId, OutBalance> {
|
||||
type Error;
|
||||
fn from_asset_balance(
|
||||
balance: AssetBalance,
|
||||
asset_id: AssetId,
|
||||
) -> Result<OutBalance, Self::Error>;
|
||||
}
|
||||
|
||||
/// Trait to handle asset locking mechanism to ensure interactions with the asset can be implemented
|
||||
|
||||
Reference in New Issue
Block a user