Trait common::LiquidityProxyTrait
source · pub trait LiquidityProxyTrait<DEXId: PartialEq + Copy, AccountId, AssetId> {
// Required methods
fn quote(
dex_id: DEXId,
input_asset_id: &AssetId,
output_asset_id: &AssetId,
amount: QuoteAmount<Balance>,
filter: LiquiditySourceFilter<DEXId, LiquiditySourceType>,
deduce_fee: bool
) -> Result<SwapOutcome<Balance>, DispatchError>;
fn exchange(
dex_id: DEXId,
sender: &AccountId,
receiver: &AccountId,
input_asset_id: &AssetId,
output_asset_id: &AssetId,
amount: SwapAmount<Balance>,
filter: LiquiditySourceFilter<DEXId, LiquiditySourceType>
) -> Result<SwapOutcome<Balance>, DispatchError>;
}
Expand description
Indicates that particular object can be used to perform exchanges with aggregation capability.
Required Methods§
sourcefn quote(
dex_id: DEXId,
input_asset_id: &AssetId,
output_asset_id: &AssetId,
amount: QuoteAmount<Balance>,
filter: LiquiditySourceFilter<DEXId, LiquiditySourceType>,
deduce_fee: bool
) -> Result<SwapOutcome<Balance>, DispatchError>
fn quote( dex_id: DEXId, input_asset_id: &AssetId, output_asset_id: &AssetId, amount: QuoteAmount<Balance>, filter: LiquiditySourceFilter<DEXId, LiquiditySourceType>, deduce_fee: bool ) -> Result<SwapOutcome<Balance>, DispatchError>
Get spot price of tokens based on desired amount, None returned if liquidity source does not have available exchange methods for indicated path.
sourcefn exchange(
dex_id: DEXId,
sender: &AccountId,
receiver: &AccountId,
input_asset_id: &AssetId,
output_asset_id: &AssetId,
amount: SwapAmount<Balance>,
filter: LiquiditySourceFilter<DEXId, LiquiditySourceType>
) -> Result<SwapOutcome<Balance>, DispatchError>
fn exchange( dex_id: DEXId, sender: &AccountId, receiver: &AccountId, input_asset_id: &AssetId, output_asset_id: &AssetId, amount: SwapAmount<Balance>, filter: LiquiditySourceFilter<DEXId, LiquiditySourceType> ) -> Result<SwapOutcome<Balance>, DispatchError>
Perform exchange based on desired amount.