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§
sourcefn address(id: &PoolId) -> Result<AccountId, ()>
fn address(id: &PoolId) -> Result<AccountId, ()>
Retrieves the account address associated with a valid PoolId
.
sourcefn pool_id(asset1: &AssetKind, asset2: &AssetKind) -> Result<PoolId, ()>
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§
sourcefn pool_address(asset1: &AssetKind, asset2: &AssetKind) -> Result<AccountId, ()>
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.