referrerpolicy=no-referrer-when-downgrade

Trait pallet_asset_conversion::PoolLocator

source ·
pub trait PoolLocator<AccountId, AssetKind, PoolId> {
    // Required methods
    fn address(id: &PoolId) -> Result<AccountId, ()>;
    fn pool_id(asset1: &AssetKind, asset2: &AssetKind) -> Result<PoolId, ()>;

    // Provided method
    fn pool_address(
        asset1: &AssetKind,
        asset2: &AssetKind,
    ) -> Result<AccountId, ()> { ... }
}
Expand description

Provides means to resolve the PoolId and AccountId from a pair of assets.

Resulting PoolId remains consistent whether the asset pair is presented as (asset1, asset2) or (asset2, asset1). The derived AccountId may serve as an address for liquidity provider tokens.

Required Methods§

source

fn address(id: &PoolId) -> Result<AccountId, ()>

Retrieves the account address associated with a valid PoolId.

source

fn pool_id(asset1: &AssetKind, asset2: &AssetKind) -> Result<PoolId, ()>

Identifies the PoolId for a given pair of assets.

Returns an error if the asset pair isn’t supported.

Provided Methods§

source

fn pool_address(asset1: &AssetKind, asset2: &AssetKind) -> Result<AccountId, ()>

Retrieves the account address associated with a given asset pair.

Returns an error if the asset pair isn’t supported.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<AccountId, AssetKind, AccountIdConverter> PoolLocator<AccountId, AssetKind, (AssetKind, AssetKind)> for Ascending<AccountId, AssetKind, AccountIdConverter>
where AssetKind: Ord + Clone + Encode, AccountId: Decode, AccountIdConverter: for<'a> TryConvert<&'a (AssetKind, AssetKind), AccountId>,

source§

impl<First, Second, AccountId, AssetKind> PoolLocator<AccountId, AssetKind, (AssetKind, AssetKind)> for Chain<First, Second>
where First: PoolLocator<AccountId, AssetKind, (AssetKind, AssetKind)>, Second: PoolLocator<AccountId, AssetKind, (AssetKind, AssetKind)>,

source§

impl<FirstAsset, AccountId, AssetKind, AccountIdConverter> PoolLocator<AccountId, AssetKind, (AssetKind, AssetKind)> for WithFirstAsset<FirstAsset, AccountId, AssetKind, AccountIdConverter>
where AssetKind: Eq + Clone + Encode, AccountId: Decode, FirstAsset: Get<AssetKind>, AccountIdConverter: for<'a> TryConvert<&'a (AssetKind, AssetKind), AccountId>,