@@ -16,7 +16,10 @@ use primitives::{AccumulateConfig, Balance, CurrencyId, Leverage, Leverages, Liq
1616use sp_arithmetic:: Fixed128 ;
1717use sp_runtime:: { traits:: Saturating , DispatchResult , ModuleId , RuntimeDebug } ;
1818use sp_std:: { cmp:: max, prelude:: * } ;
19- use traits:: { LiquidityPools , MarginProtocolLiquidityPools , OnDisableLiquidityPool , OnRemoveLiquidityPool } ;
19+ use traits:: {
20+ LiquidityPools , MarginProtocolLiquidityPools , MarginProtocolLiquidityPoolsManager , OnDisableLiquidityPool ,
21+ OnRemoveLiquidityPool ,
22+ } ;
2023
2124#[ cfg( feature = "std" ) ]
2225use serde:: { Deserialize , Serialize } ;
@@ -40,6 +43,7 @@ pub const MODULE_ID: ModuleId = ModuleId(*b"lami/mlp");
4043pub trait Trait : frame_system:: Trait {
4144 type Event : From < Event < Self > > + Into < <Self as system:: Trait >:: Event > ;
4245 type BaseLiquidityPools : LiquidityPools < Self :: AccountId > ;
46+ type PoolManager : MarginProtocolLiquidityPoolsManager ;
4347 type MultiCurrency : MultiCurrency < Self :: AccountId , Balance = Balance , CurrencyId = CurrencyId > ;
4448 type UpdateOrigin : EnsureOrigin < Self :: Origin > ;
4549 type MaxSwap : Get < Fixed128 > ;
@@ -192,6 +196,9 @@ decl_module! {
192196 let who = ensure_signed( origin) ?;
193197 ensure!( Self :: is_owner( pool_id, & who) , Error :: <T >:: NoPermission ) ;
194198 ensure!( Self :: enabled_trading_pair( & pair) . is_some( ) , Error :: <T >:: TradingPairNotEnabled ) ;
199+
200+ <T :: PoolManager as MarginProtocolLiquidityPoolsManager >:: ensure_can_enable_trading_pair( pool_id, pair) ?;
201+
195202 LiquidityPoolEnabledTradingPairs :: insert( & pool_id, & pair, true ) ;
196203 Self :: deposit_event( RawEvent :: LiquidityPoolTradingPairEnabled ( pair) )
197204 }
0 commit comments