diff --git a/pallets/ocex/src/lib.rs b/pallets/ocex/src/lib.rs index 47c25b359..f7e65a772 100644 --- a/pallets/ocex/src/lib.rs +++ b/pallets/ocex/src/lib.rs @@ -956,7 +956,6 @@ pub mod pallet { Ok(()) } - /// Set Incentivised markets #[pallet::call_index(20)] #[pallet::weight(10_000)] pub fn set_lmp_epoch_config( @@ -1021,6 +1020,71 @@ pub mod pallet { Ok(()) } + // /// Set Incentivised markets + // #[pallet::call_index(20)] + // #[pallet::weight(10_000)] + // pub fn set_lmp_epoch_config( + // origin: OriginFor, + // total_liquidity_mining_rewards: Option>, + // total_trading_rewards: Option>, + // market_weightage: Option>, + // min_fees_paid: Option>, + // min_maker_volume: Option>, + // max_accounts_rewarded: Option, + // claim_safety_period: Option, + // ) -> DispatchResult { + // T::GovernanceOrigin::ensure_origin(origin)?; + // let mut config = >::get(); + // let unit: Decimal = Decimal::from(UNIT_BALANCE); + // if let Some(total_liquidity_mining_rewards) = total_liquidity_mining_rewards { + // config.total_liquidity_mining_rewards = + // Decimal::from(total_liquidity_mining_rewards.0).div(unit); + // } + // if let Some(total_trading_rewards) = total_trading_rewards { + // config.total_trading_rewards = Decimal::from(total_trading_rewards.0).div(unit); + // } + // if let Some(market_weightage) = market_weightage { + // let mut total_percent: u128 = 0u128; + // let mut weightage_map = BTreeMap::new(); + // for (market, percent) in market_weightage { + // // Check if market is registered + // ensure!( + // >::get(market.base, market.quote).is_some(), + // Error::::TradingPairNotRegistered + // ); + // // Add market weightage to total percent + // total_percent = total_percent.saturating_add(percent); + // weightage_map.insert(market, Decimal::from(percent).div(unit)); + // } + // ensure!(total_percent == UNIT_BALANCE, Error::::InvalidMarketWeightage); + // config.market_weightage = weightage_map; + // } + // if let Some(min_fees_paid) = min_fees_paid { + // let mut fees_map = BTreeMap::new(); + // for (market, fees_in_quote) in min_fees_paid { + // fees_map.insert(market, Decimal::from(fees_in_quote).div(unit)); + // } + // config.min_fees_paid = fees_map; + // } + // + // if let Some(min_maker_volume) = min_maker_volume { + // let mut volume_map = BTreeMap::new(); + // for (market, volume_in_quote) in min_maker_volume { + // volume_map.insert(market, Decimal::from(volume_in_quote).div(unit)); + // } + // config.min_maker_volume = volume_map; + // } + // if let Some(max_accounts_rewarded) = max_accounts_rewarded { + // config.max_accounts_rewarded = max_accounts_rewarded; + // } + // if let Some(claim_safety_period) = claim_safety_period { + // config.claim_safety_period = claim_safety_period; + // } + // ensure!(config.verify(), Error::::InvalidLMPConfig); + // >::put(config); + // Ok(()) + // } + /// Set Fee Distribution #[pallet::call_index(21)] #[pallet::weight(10_000)]