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§

source

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.

source

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.

Implementations on Foreign Types§

source§

impl<DEXId: PartialEq + Copy, AccountId, AssetId> LiquidityProxyTrait<DEXId, AccountId, AssetId> for ()

source§

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>

source§

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>

Implementors§