pub trait OnLiquidityChangedHandler<AssetId, Balance> {
    fn on_liquidity_changed(
        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_liquidity_changed_weight() -> Weight; }
Expand description

Handler used by AMM pools to perform some tasks when liquidity changes outside of trades.

Required Methods§

Notify that the liquidity for a pair of assets has changed.

Known overhead for a liquidity change 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_liquidity_changed.

Implementations on Foreign Types§

Implementors§