pub trait OnTradeHandler<AssetId, Balance> {
    fn on_trade(
        source: Source,
        asset_a: AssetId,
        asset_b: AssetId,
        amount_a: Balance,
        amount_b: Balance,
        liquidity_a: Balance,
        liquidity_b: Balance
    ) -> Result<Weight, (Weight, DispatchError)>; fn on_trade_weight() -> Weight; }
Expand description

Handler used by AMM pools to perform some tasks when a trade is executed.

Required Methods§

Include a trade in the average price calculation of the price-oracle pallet.

Known overhead for a trade in on_initialize/on_finalize. Needs to be specified here if we don’t want to make AMM pools tightly coupled with the price oracle pallet, otherwise we can’t access the weight. Add this weight to an extrinsic from which you call on_trade.

Implementations on Foreign Types§

Implementors§