mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
asset-conversion pallet: pool's AccountId derivation warn docs (#14811)
* pool_id docs * fmt
This commit is contained in:
@@ -147,6 +147,9 @@ pub mod pallet {
|
|||||||
|
|
||||||
/// Type that identifies either the native currency or a token class from `Assets`.
|
/// Type that identifies either the native currency or a token class from `Assets`.
|
||||||
/// `Ord` is added because of `get_pool_id`.
|
/// `Ord` is added because of `get_pool_id`.
|
||||||
|
///
|
||||||
|
/// The pool's `AccountId` is derived from this type. Any changes to the type may
|
||||||
|
/// necessitate a migration.
|
||||||
type MultiAssetId: AssetId + Ord + From<Self::AssetId>;
|
type MultiAssetId: AssetId + Ord + From<Self::AssetId>;
|
||||||
|
|
||||||
/// Type to convert an `AssetId` into `MultiAssetId`.
|
/// Type to convert an `AssetId` into `MultiAssetId`.
|
||||||
@@ -1193,7 +1196,9 @@ pub mod pallet {
|
|||||||
()
|
()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
let MultiAssetIdConversionResult::Converted(asset_id) = T::MultiAssetIdConverter::try_convert(asset) else {
|
let MultiAssetIdConversionResult::Converted(asset_id) =
|
||||||
|
T::MultiAssetIdConverter::try_convert(asset)
|
||||||
|
else {
|
||||||
return Err(())
|
return Err(())
|
||||||
};
|
};
|
||||||
let minimal = T::Assets::minimum_balance(asset_id);
|
let minimal = T::Assets::minimum_balance(asset_id);
|
||||||
|
|||||||
@@ -66,7 +66,11 @@ fn pool_assets() -> Vec<u32> {
|
|||||||
|
|
||||||
fn create_tokens(owner: u128, tokens: Vec<NativeOrAssetId<u32>>) {
|
fn create_tokens(owner: u128, tokens: Vec<NativeOrAssetId<u32>>) {
|
||||||
for token_id in tokens {
|
for token_id in tokens {
|
||||||
let MultiAssetIdConversionResult::Converted(asset_id) = NativeOrAssetIdConverter::try_convert(&token_id) else { unreachable!("invalid token") };
|
let MultiAssetIdConversionResult::Converted(asset_id) =
|
||||||
|
NativeOrAssetIdConverter::try_convert(&token_id)
|
||||||
|
else {
|
||||||
|
unreachable!("invalid token")
|
||||||
|
};
|
||||||
assert_ok!(Assets::force_create(RuntimeOrigin::root(), asset_id, owner, false, 1));
|
assert_ok!(Assets::force_create(RuntimeOrigin::root(), asset_id, owner, false, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ use codec::{Decode, Encode, MaxEncodedLen};
|
|||||||
use scale_info::TypeInfo;
|
use scale_info::TypeInfo;
|
||||||
use sp_std::{cmp::Ordering, marker::PhantomData};
|
use sp_std::{cmp::Ordering, marker::PhantomData};
|
||||||
|
|
||||||
|
/// Pool ID.
|
||||||
|
///
|
||||||
|
/// The pool's `AccountId` is derived from this type. Any changes to the type may necessitate a
|
||||||
|
/// migration.
|
||||||
pub(super) type PoolIdOf<T> = (<T as Config>::MultiAssetId, <T as Config>::MultiAssetId);
|
pub(super) type PoolIdOf<T> = (<T as Config>::MultiAssetId, <T as Config>::MultiAssetId);
|
||||||
|
|
||||||
/// Stores the lp_token asset id a particular pool has been assigned.
|
/// Stores the lp_token asset id a particular pool has been assigned.
|
||||||
|
|||||||
Reference in New Issue
Block a user