Skip to content

Commit

Permalink
pass asset id as ref for ConversionFromAssetBalance
Browse files Browse the repository at this point in the history
  • Loading branch information
muharem committed Sep 14, 2023
1 parent 7e13f4c commit e64fba7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion substrate/frame/asset-rate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ where

fn from_asset_balance(
balance: BalanceOf<T>,
asset_kind: AssetKindOf<T>,
asset_kind: &AssetKindOf<T>,
) -> Result<BalanceOf<T>, pallet::Error<T>> {
let rate = pallet::ConversionRateToNative::<T>::get(asset_kind)
.ok_or(pallet::Error::<T>::UnknownAssetKind.into())?;
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/asset-rate/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ fn convert_works() {
BalanceOf<Test>,
<Test as pallet_asset_rate::Config>::AssetKind,
BalanceOf<Test>,
>>::from_asset_balance(10, ASSET_ID);
>>::from_asset_balance(10, &ASSET_ID);
assert_eq!(conversion.expect("Conversion rate exists for asset"), 25);
});
}
Expand All @@ -147,7 +147,7 @@ fn convert_unknown_throws() {
BalanceOf<Test>,
<Test as pallet_asset_rate::Config>::AssetKind,
BalanceOf<Test>,
>>::from_asset_balance(10, ASSET_ID);
>>::from_asset_balance(10, &ASSET_ID);
assert!(conversion.is_err());
});
}
2 changes: 1 addition & 1 deletion substrate/frame/support/src/traits/tokens/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pub trait ConversionFromAssetBalance<AssetBalance, AssetId, OutBalance> {
type Error;
fn from_asset_balance(
balance: AssetBalance,
asset_id: AssetId,
asset_id: &AssetId,
) -> Result<OutBalance, Self::Error>;
}

Expand Down

0 comments on commit e64fba7

Please sign in to comment.