Skip to content

Commit

Permalink
Updated lmp config ext (#919)
Browse files Browse the repository at this point in the history
## Describe your changes
Updated lmp config ext.
  • Loading branch information
Gauthamastro authored Mar 5, 2024
2 parents 6eb3045 + bf2eeba commit f65d1e4
Showing 1 changed file with 65 additions and 1 deletion.
66 changes: 65 additions & 1 deletion pallets/ocex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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<T>,
// total_liquidity_mining_rewards: Option<Compact<u128>>,
// total_trading_rewards: Option<Compact<u128>>,
// market_weightage: Option<BTreeMap<TradingPair, u128>>,
// min_fees_paid: Option<BTreeMap<TradingPair, u128>>,
// min_maker_volume: Option<BTreeMap<TradingPair, u128>>,
// max_accounts_rewarded: Option<u16>,
// claim_safety_period: Option<u32>,
// ) -> DispatchResult {
// T::GovernanceOrigin::ensure_origin(origin)?;
// let mut config = <ExpectedLMPConfig<T>>::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!(
// <TradingPairs<T>>::get(market.base, market.quote).is_some(),
// Error::<T>::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::<T>::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::<T>::InvalidLMPConfig);
// <ExpectedLMPConfig<T>>::put(config);
// Ok(())
// }

/// Set Fee Distribution
#[pallet::call_index(21)]
#[pallet::weight(10_000)]
Expand Down

0 comments on commit f65d1e4

Please sign in to comment.