mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 09:31:12 +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
@@ -1162,7 +1162,7 @@ fn set_min_balance_should_work() {
|
||||
#[test]
|
||||
fn balance_conversion_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
use frame_support::traits::tokens::BalanceConversion;
|
||||
use frame_support::traits::tokens::ConversionToAssetBalance;
|
||||
|
||||
let id = 42;
|
||||
assert_ok!(Assets::force_create(RuntimeOrigin::root(), id, 1, true, 10));
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
use super::*;
|
||||
use frame_support::{
|
||||
pallet_prelude::*,
|
||||
traits::{fungible, tokens::BalanceConversion},
|
||||
traits::{fungible, tokens::ConversionToAssetBalance},
|
||||
};
|
||||
use sp_runtime::{traits::Convert, FixedPointNumber, FixedPointOperand, FixedU128};
|
||||
|
||||
@@ -228,7 +228,7 @@ type BalanceOf<F, T> = <F as fungible::Inspect<AccountIdOf<T>>>::Balance;
|
||||
/// Converts a balance value into an asset balance based on the ratio between the fungible's
|
||||
/// minimum balance and the minimum asset balance.
|
||||
pub struct BalanceToAssetBalance<F, T, CON, I = ()>(PhantomData<(F, T, CON, I)>);
|
||||
impl<F, T, CON, I> BalanceConversion<BalanceOf<F, T>, AssetIdOf<T, I>, AssetBalanceOf<T, I>>
|
||||
impl<F, T, CON, I> ConversionToAssetBalance<BalanceOf<F, T>, AssetIdOf<T, I>, AssetBalanceOf<T, I>>
|
||||
for BalanceToAssetBalance<F, T, CON, I>
|
||||
where
|
||||
F: fungible::Inspect<AccountIdOf<T>>,
|
||||
|
||||
Reference in New Issue
Block a user