mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +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`.
|
||||
/// `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 to convert an `AssetId` into `MultiAssetId`.
|
||||
@@ -1193,7 +1196,9 @@ pub mod pallet {
|
||||
()
|
||||
);
|
||||
} 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(())
|
||||
};
|
||||
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>>) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,10 @@ use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
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);
|
||||
|
||||
/// Stores the lp_token asset id a particular pool has been assigned.
|
||||
|
||||
Reference in New Issue
Block a user