Pallets: Asset Rate - Rename AssetId to AssetKind, Introduce AssetKindFactory Trait (#14514)

* asset-rate rename asset_id to asset_kind

* asset-rate pallet benchmarks asset kind factory

* rename to SEED

* fixes

* Update frame/asset-rate/src/benchmarking.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* sp-core optional dep

* sp-core included for benchmarks

* sp-core to dev dep

* sp-core add dep prefix

---------

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
Muharem Ismailov
2023-07-26 16:49:53 +02:00
committed by GitHub
parent 5a5b1df69b
commit 99fc51ce3e
6 changed files with 79 additions and 51 deletions
+4 -4
View File
@@ -66,7 +66,7 @@ fn remove_unknown_throws() {
new_test_ext().execute_with(|| {
assert_noop!(
AssetRate::remove(RuntimeOrigin::root(), ASSET_ID,),
Error::<Test>::UnknownAssetId
Error::<Test>::UnknownAssetKind
);
});
}
@@ -89,7 +89,7 @@ fn update_unknown_throws() {
new_test_ext().execute_with(|| {
assert_noop!(
AssetRate::update(RuntimeOrigin::root(), ASSET_ID, FixedU128::from_float(0.5)),
Error::<Test>::UnknownAssetId
Error::<Test>::UnknownAssetKind
);
});
}
@@ -101,7 +101,7 @@ fn convert_works() {
let conversion = <AssetRate as ConversionFromAssetBalance<
BalanceOf<Test>,
<Test as pallet_asset_rate::Config>::AssetId,
<Test as pallet_asset_rate::Config>::AssetKind,
BalanceOf<Test>,
>>::from_asset_balance(10, ASSET_ID);
assert_eq!(conversion.expect("Conversion rate exists for asset"), 25);
@@ -113,7 +113,7 @@ fn convert_unknown_throws() {
new_test_ext().execute_with(|| {
let conversion = <AssetRate as ConversionFromAssetBalance<
BalanceOf<Test>,
<Test as pallet_asset_rate::Config>::AssetId,
<Test as pallet_asset_rate::Config>::AssetKind,
BalanceOf<Test>,
>>::from_asset_balance(10, ASSET_ID);
assert!(conversion.is_err());