diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index ef7bdc2..67bd207 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -286,6 +286,15 @@ fn testnet_genesis( "moveModule": { "changeDefaultMoveStdlibBundleTo": Option::>::None, "changeDefaultSubstrateStdlibBundleTo": Option::>::None, + }, + "liquidation":{ + "adminKey": Some(root.clone()), + "systemRatio": 20_000_0000, + "treasuryRatio": 33_000_0000, + "operationRatio": 25_000_0000, + "collatorRatio": 22_000_0000, + "minLiquidationThreshold": 20_000_000_000_000_000u128, + "profitDistributionCycle": 10, } }) } diff --git a/pallets/liquidation/src/lib.rs b/pallets/liquidation/src/lib.rs index 2ca4b5a..f8cab12 100644 --- a/pallets/liquidation/src/lib.rs +++ b/pallets/liquidation/src/lib.rs @@ -13,12 +13,15 @@ use frame_support::{ weights::WeightToFeePolynomial, Twox64Concat, }; -use frame_system::pallet_prelude::{BlockNumberFor, OriginFor}; +use frame_system::{ + ensure_signed_or_root, + pallet_prelude::{BlockNumberFor, OriginFor}, +}; use mp_system::BASE_ACCOUNT; pub use pallet::*; use sp_runtime::{ traits::{StaticLookup, Zero}, - AccountId32, Perbill, Saturating, + AccountId32, Percent, Saturating, }; use sp_std::{prelude::*, sync::Arc, vec}; @@ -35,6 +38,7 @@ type BalanceOf = pub type Balance = u128; pub const PARACHAIN_TO_RELAYCHAIN_UNIT: u128 = 1_000_000; +pub const PERCENT_UNIT: u128 = 1_000_0000; #[frame_support::pallet] pub mod pallet { @@ -77,26 +81,10 @@ pub mod pallet { ///get real weight cost from coreTime placeOrder pallet type OrderGasCost: OrderGasCost; - ///profit distribute ratio to treasury account - #[pallet::constant] - type SystemRatio: Get; - - ///profit distribute ratio to treasury account - #[pallet::constant] - type TreasuryRatio: Get; - - /// profit distribute ratio to operation account - #[pallet::constant] - type OperationRatio: Get; - /// ED necessitate the account to exist #[pallet::constant] type ExistentialDeposit: Get; - ///minimum liquidation threshold - #[pallet::constant] - type MinLiquidationThreshold: Get; - /// system accountId #[pallet::constant] type SystemAccountName: Get<&'static str>; @@ -108,10 +96,6 @@ pub mod pallet { /// operation accountId #[pallet::constant] type OperationAccountName: Get<&'static str>; - - ///how many blocks to distribute a profit distribution - #[pallet::constant] - type ProfitDistributionCycle: Get>; } #[pallet::storage] @@ -135,6 +119,80 @@ pub mod pallet { #[pallet::getter(fn block_count)] pub type DistributionBlockCount = StorageValue<_, BlockNumberFor, ValueQuery>; + #[pallet::storage] + #[pallet::getter(fn system_ratio)] + pub type SystemRatio = StorageValue<_, u32, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn treasury_ratio)] + pub type TreasuryRatio = StorageValue<_, u32, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn operation_ratio)] + pub type OperationRatio = StorageValue<_, u32, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn collator_ratio)] + pub type CollatorRatio = StorageValue<_, u32, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn min_liquidation_threshold)] + pub type MinLiquidationThreshold = StorageValue<_, Balance, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn profit_distribution_cycle)] + pub type ProfitDistributionCycle = StorageValue<_, BlockNumberFor, ValueQuery>; + + /// The pallet admin key. + #[pallet::storage] + #[pallet::getter(fn admin_key)] + pub type Admin = StorageValue<_, T::AccountId>; + + #[pallet::genesis_config] + #[derive(frame_support::DefaultNoBound)] + pub struct GenesisConfig { + /// The `AccountId` of the admin key. + pub admin_key: Option, + pub system_ratio: u32, + pub treasury_ratio: u32, + pub operation_ratio: u32, + pub collator_ratio: u32, + pub min_liquidation_threshold: Balance, + pub profit_distribution_cycle: BlockNumberFor, + } + + #[pallet::genesis_build] + impl BuildGenesisConfig for GenesisConfig { + fn build(&self) { + assert!( + self.system_ratio + + self.treasury_ratio + + self.operation_ratio + + self.collator_ratio + <= 100 * (PERCENT_UNIT as u32), + "Ratio sum must be <= 100%" + ); + assert!( + self.min_liquidation_threshold > ::ExistentialDeposit::get(), + "MinLiquidationThreshold must be greater than ExistentialDeposit" + ); + assert!( + self.profit_distribution_cycle > 1u32.into(), + "ProfitDistributionCycle must be greater than 1" + ); + + if let Some(key) = &self.admin_key { + >::put(key.clone()); + } + SystemRatio::::put(self.system_ratio); + TreasuryRatio::::put(self.treasury_ratio); + OperationRatio::::put(self.operation_ratio); + CollatorRatio::::put(self.collator_ratio); + MinLiquidationThreshold::::put(self.min_liquidation_threshold); + ProfitDistributionCycle::::put(self.profit_distribution_cycle); + } + } + #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { @@ -157,6 +215,27 @@ pub mod pallet { /// collators compensated CollatorsCompensated(Balance, Balance), + /// set admin(account_id) + SetAdmin(T::AccountId), + + /// Set system ratio + SystemRatioSet(u32), + + /// Set treasury ratio + TreasuryRatioSet(u32), + + /// Set operation ratio + OperationRatioSet(u32), + + ///Set collator ratio + CollatorRatioSet(u32), + + /// Set min liquidation threshold + MinLiquidationThresholdSet(Balance), + + /// Set profit distribution cycle + ProfitDistributionCycleSet(BlockNumberFor), + /// error occurred Error(Error), } @@ -176,6 +255,18 @@ pub mod pallet { ///failed to process liquidation ProcessLiquidationError, + /// Require admin authority + RequireAdmin, + + /// Invalid ratio sum (must be <= 100%) + InvalidRatio, + + /// MinLiquidationThreshold must be greater than ExistentialDeposit + InvalidMinLiquidationThreshold, + + /// ProfitDistributionCycle must be greater than 1 + InvalidProfitDistributionCycle, + ///xcm error XcmError, } @@ -255,13 +346,11 @@ pub mod pallet { }); let min_liquidation_threshold: Balance = - ::MinLiquidationThreshold::get() - .try_into() - .unwrap_or_else(|_| 0); + MinLiquidationThreshold::::get().try_into().unwrap_or_else(|_| 0); let profit = TotalIncome::::get().saturating_sub(TotalCost::::get()); if profit >= min_liquidation_threshold - && count % T::ProfitDistributionCycle::get() == Zero::zero() + && count % ProfitDistributionCycle::::get() == Zero::zero() { DistributionBlockCount::::put(BlockNumberFor::::zero()); match Self::distribute_profit() { @@ -385,13 +474,14 @@ pub mod pallet { Error::::GetPotAccountError })?; - let system_ratio = T::SystemRatio::get(); - let treasury_ratio = T::TreasuryRatio::get(); - let operation_ratio = T::OperationRatio::get(); + let system_ratio = SystemRatio::::get(); + let treasury_ratio = TreasuryRatio::::get(); + let operation_ratio = OperationRatio::::get(); - let treasury_amount = treasury_ratio * total_profit / PARACHAIN_TO_RELAYCHAIN_UNIT; - let operation_amount = operation_ratio * total_profit; - let system_amount = system_ratio * total_profit; + let treasury_amount = (treasury_ratio as u128) / PERCENT_UNIT * total_profit + / PARACHAIN_TO_RELAYCHAIN_UNIT; + let operation_amount = (operation_ratio as u128) / PERCENT_UNIT * total_profit; + let system_amount = (system_ratio as u128) / PERCENT_UNIT * total_profit; let total_collators_profit = total_profit.saturating_sub(treasury_amount + operation_amount + system_amount); @@ -416,7 +506,7 @@ pub mod pallet { transfers.push((operation_account, operation_account_profit)); for (collator, collator_cost) in CollatorRealGasCosts::::iter() { - let collator_ratio = Perbill::from_rational(collator_cost, total_cost); + let collator_ratio = Percent::from_rational(collator_cost, total_cost); let collator_profit = collator_ratio * total_collators_profit; let collator_addr_profit = @@ -481,4 +571,178 @@ pub mod pallet { Ok(()) } } + + #[pallet::call] + impl Pallet { + #[pallet::call_index(0)] + #[pallet::weight(Weight::from_parts(10_000, 0) + T::DbWeight::get().writes(1))] + pub fn set_admin( + origin: OriginFor, + new_admin: ::Source, + ) -> DispatchResultWithPostInfo { + let require = match ensure_signed_or_root(origin) { + Ok(s) if s == Self::admin_key() => true, + Ok(None) => true, + _ => false, + }; + + ensure!(require, Error::::RequireAdmin); + + let new_admin = T::Lookup::lookup(new_admin)?; + + Admin::::mutate(|admin| *admin = Some(new_admin.clone())); + + Self::deposit_event(Event::SetAdmin(new_admin)); + + Ok(Pays::No.into()) + } + + #[pallet::call_index(1)] + #[pallet::weight(Weight::from_parts(10_000, 0) + T::DbWeight::get().writes(1))] + pub fn set_system_ratio(origin: OriginFor, ratio: u32) -> DispatchResultWithPostInfo { + ensure_root_or_admin::(origin)?; + + let treasury_ratio = TreasuryRatio::::get(); + let operation_ratio = OperationRatio::::get(); + let collator_ratio = CollatorRatio::::get(); + + let total_ratio = treasury_ratio + ratio + operation_ratio + collator_ratio; + log::info!("1 +++++++++ set system ratio, total ratio:{:?}, treasury_ratio:{:?}, operation_ratio:{:?}, collator_ratio:{:?}, system_ratio:{:?}", + total_ratio, treasury_ratio, operation_ratio, collator_ratio, ratio); + ensure_total_ratio_not_exceed_one::( + ratio, + treasury_ratio, + operation_ratio, + collator_ratio, + )?; + + SystemRatio::::put(ratio); + Self::deposit_event(Event::SystemRatioSet(ratio)); + Ok(Pays::No.into()) + } + + #[pallet::call_index(2)] + #[pallet::weight(Weight::from_parts(10_000, 0) + T::DbWeight::get().writes(1))] + pub fn set_treasury_ratio(origin: OriginFor, ratio: u32) -> DispatchResultWithPostInfo { + ensure_root_or_admin::(origin)?; + + let system_ratio = SystemRatio::::get(); + let operation_ratio = OperationRatio::::get(); + let collator_ratio = CollatorRatio::::get(); + + let total_ratio = system_ratio + ratio + operation_ratio + collator_ratio; + log::info!("2 =========== set treasury ratio, total ratio:{:?}, system_ratio:{:?}, operation_ratio:{:?}, collator_ratio:{:?}, treasury_ratio:{:?}", + total_ratio, system_ratio, operation_ratio, collator_ratio, ratio); + + ensure_total_ratio_not_exceed_one::( + system_ratio, + ratio, + operation_ratio, + collator_ratio, + )?; + + TreasuryRatio::::put(ratio); + Self::deposit_event(Event::TreasuryRatioSet(ratio)); + Ok(Pays::No.into()) + } + + #[pallet::call_index(3)] + #[pallet::weight(Weight::from_parts(10_000, 0) + T::DbWeight::get().writes(1))] + pub fn set_operation_ratio(origin: OriginFor, ratio: u32) -> DispatchResultWithPostInfo { + ensure_root_or_admin::(origin)?; + + let system_ratio = SystemRatio::::get(); + let treasury_ratio = TreasuryRatio::::get(); + let collator_ratio = CollatorRatio::::get(); + + let total_ratio = system_ratio + treasury_ratio + ratio + collator_ratio; + log::info!("3 -+-+-+-+-+ set operation ratio, total ratio:{:?}, system_ratio:{:?}, treasury_ratio:{:?}, collator_ratio:{:?}, operation_ratio:{:?}", + total_ratio, system_ratio, treasury_ratio, collator_ratio, ratio); + ensure_total_ratio_not_exceed_one::( + system_ratio, + treasury_ratio, + ratio, + collator_ratio, + )?; + + OperationRatio::::put(ratio); + Self::deposit_event(Event::OperationRatioSet(ratio)); + Ok(Pays::No.into()) + } + + #[pallet::call_index(4)] + #[pallet::weight(Weight::from_parts(10_000, 0) + T::DbWeight::get().writes(1))] + pub fn set_collator_ratio(origin: OriginFor, ratio: u32) -> DispatchResultWithPostInfo { + crate::pallet::ensure_root_or_admin::(origin)?; + + let system_ratio = SystemRatio::::get(); + let treasury_ratio = TreasuryRatio::::get(); + let operation_ratio = OperationRatio::::get(); + + let total_ratio = system_ratio + treasury_ratio + ratio + operation_ratio; + log::info!("4. *********** set collator ratio, total ratio:{:?}, system_ratio:{:?}, treasury_ratio:{:?}, operation_ratio:{:?}, collator_ratio:{:?}", + total_ratio, system_ratio, treasury_ratio, operation_ratio, ratio); + ensure_total_ratio_not_exceed_one::( + system_ratio, + treasury_ratio, + operation_ratio, + ratio, + )?; + + CollatorRatio::::put(ratio); + Self::deposit_event(Event::CollatorRatioSet(ratio)); + Ok(Pays::No.into()) + } + + #[pallet::call_index(5)] + #[pallet::weight(Weight::from_parts(10_000, 0) + T::DbWeight::get().writes(1))] + pub fn set_min_liquidation_threshold( + origin: OriginFor, + threshold: Balance, + ) -> DispatchResultWithPostInfo { + ensure_root_or_admin::(origin)?; + + let existential_deposit = ::ExistentialDeposit::get(); + ensure!(threshold > existential_deposit, Error::::InvalidMinLiquidationThreshold); + + MinLiquidationThreshold::::put(threshold); + Self::deposit_event(Event::MinLiquidationThresholdSet(threshold)); + Ok(Pays::No.into()) + } + + #[pallet::call_index(6)] + #[pallet::weight(Weight::from_parts(10_000, 0) + T::DbWeight::get().writes(1))] + pub fn set_profit_distribution_cycle( + origin: OriginFor, + cycle: BlockNumberFor, + ) -> DispatchResultWithPostInfo { + ensure_root_or_admin::(origin)?; + + ensure!(cycle > 1u32.into(), Error::::InvalidProfitDistributionCycle); + + ProfitDistributionCycle::::put(cycle); + Self::deposit_event(Event::ProfitDistributionCycleSet(cycle)); + Ok(Pays::No.into()) + } + } + + /// Ensure the origin is either root or admin. + fn ensure_root_or_admin(origin: OriginFor) -> DispatchResult { + match ensure_signed_or_root(origin) { + Ok(s) if s == Pallet::::admin_key() => Ok(()), + Ok(None) => Ok(()), + _ => Err(Error::::RequireAdmin.into()), + } + } + + fn ensure_total_ratio_not_exceed_one( + system_ratio: u32, + treasury_ratio: u32, + operation_ratio: u32, + collator_ratio: u32, + ) -> DispatchResult { + let total_ratio = system_ratio + treasury_ratio + operation_ratio + collator_ratio; + ensure!((total_ratio as u128) <= 100 * PERCENT_UNIT, Error::::InvalidRatio); + Ok(()) + } } diff --git a/pallets/liquidation/src/mock.rs b/pallets/liquidation/src/mock.rs index 1308232..89cbb1d 100644 --- a/pallets/liquidation/src/mock.rs +++ b/pallets/liquidation/src/mock.rs @@ -33,7 +33,6 @@ use xcm_builder::{ use xcm_executor::XcmExecutor; type Balance = u128; -type BlockNumber = u32; type Block = frame_system::mocking::MockBlock; pub const UNIT: Balance = 1_000_000_000_000_000_000; @@ -68,18 +67,6 @@ const SYSTEM_ACCOUNT: AccountId32 = AccountId32::new(SYSTEM_ACCOUNT_BYTES); /// The existential deposit. Set to 1/10 of the Connected Relay Chain. pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT; -parameter_types! { - pub const SystemRatio: Perbill = Perbill::from_percent(20); // 20% for system - pub const TreasuryRatio: Perbill = Perbill::from_percent(33); // 33% for treasury - pub const OperationRatio: Perbill = Perbill::from_percent(25); // 25% for maintenance - pub const ProfitDistributionCycle: BlockNumber = 10; - pub const ExistDeposit: Balance = EXISTENTIAL_DEPOSIT; - pub const MinLiquidationThreshold: Balance = MILLIUNIT * 20; - pub const SystemAccountName: &'static str = "system"; - pub const TreasuryAccountName: &'static str = "treasury"; - pub const OperationAccountName: &'static str = "maintenance"; -} - impl system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); @@ -109,6 +96,9 @@ impl system::Config for Test { parameter_types! { pub const ExistentialDeposit: u128 = EXISTENTIAL_DEPOSIT; + pub const SystemAccountName: &'static str = "system"; + pub const TreasuryAccountName: &'static str = "treasury"; + pub const OperationAccountName: &'static str = "maintenance"; } impl pallet_balances::Config for Test { @@ -281,15 +271,10 @@ impl pallet_liquidation::Config for Test { type XcmSender = XcmRouter; type WeightToFee = WeightToFee; type OrderGasCost = MockOrderGasCostHandler; - type SystemRatio = SystemRatio; - type TreasuryRatio = TreasuryRatio; - type OperationRatio = OperationRatio; - type ExistentialDeposit = ExistDeposit; - type MinLiquidationThreshold = MinLiquidationThreshold; + type ExistentialDeposit = ExistentialDeposit; type SystemAccountName = SystemAccountName; type TreasuryAccountName = TreasuryAccountName; type OperationAccountName = OperationAccountName; - type ProfitDistributionCycle = ProfitDistributionCycle; } pub struct WeightToFee; @@ -323,11 +308,25 @@ where pub struct ExtBuilder { existential_deposit: u128, + system_ratio: u32, + treasury_ratio: u32, + operation_ratio: u32, + collator_ratio: u32, + min_liquidation_threshold: Balance, + profit_distribution_cycle: u64, } impl Default for ExtBuilder { fn default() -> Self { - Self { existential_deposit: 1 } + Self { + existential_deposit: 1, + system_ratio: 20_000_0000, + treasury_ratio: 33_000_0000, + operation_ratio: 25_000_0000, + collator_ratio: 22_000_0000, + min_liquidation_threshold: MILLIUNIT * 20, + profit_distribution_cycle: 10, + } } } @@ -337,6 +336,36 @@ impl ExtBuilder { self } + pub fn system_ratio(mut self, ratio: u32) -> Self { + self.system_ratio = ratio; + self + } + + pub fn treasury_ratio(mut self, ratio: u32) -> Self { + self.treasury_ratio = ratio; + self + } + + pub fn operation_ratio(mut self, ratio: u32) -> Self { + self.operation_ratio = ratio; + self + } + + pub fn collator_ratio(mut self, ratio: u32) -> Self { + self.collator_ratio = ratio; + self + } + + pub fn min_liquidation_threshold(mut self, threshold: Balance) -> Self { + self.min_liquidation_threshold = threshold; + self + } + + pub fn profit_distribution_cycle(mut self, cycle: u64) -> Self { + self.profit_distribution_cycle = cycle; + self + } + pub fn build(self) -> sp_io::TestExternalities { let mut storage = frame_system::GenesisConfig::::default().build_storage().unwrap(); @@ -345,6 +374,17 @@ impl ExtBuilder { }; balances_config.assimilate_storage(&mut storage).unwrap(); + let liquidation_config = pallet_liquidation::GenesisConfig:: { + admin_key: Some(SYSTEM_ACCOUNT), + system_ratio: self.system_ratio, + treasury_ratio: self.treasury_ratio, + operation_ratio: self.operation_ratio, + collator_ratio: self.collator_ratio, + min_liquidation_threshold: self.min_liquidation_threshold, + profit_distribution_cycle: self.profit_distribution_cycle, + }; + liquidation_config.assimilate_storage(&mut storage).unwrap(); + let mut ext = sp_io::TestExternalities::new(storage); ext.execute_with(|| System::set_block_number(1)); ext diff --git a/pallets/liquidation/src/tests.rs b/pallets/liquidation/src/tests.rs index a1d30a0..9e5b1c8 100644 --- a/pallets/liquidation/src/tests.rs +++ b/pallets/liquidation/src/tests.rs @@ -5,27 +5,36 @@ use sp_runtime::traits::Zero; #[test] fn distribute_profit_should_work() { - ExtBuilder::default().existential_deposit(100).build().execute_with(|| { - for n in 1..=::ProfitDistributionCycle::get() { - frame_system::Pallet::::set_block_number(n.into()); - } + ExtBuilder::default() + .existential_deposit(100) + .system_ratio(20_000_0000) + .treasury_ratio(33_000_0000) + .operation_ratio(25_000_0000) + .collator_ratio(22_000_0000) + .min_liquidation_threshold(20_000_000_000) + .profit_distribution_cycle(10) + .build() + .execute_with(|| { + for n in 1..=ProfitDistributionCycle::::get() { + frame_system::Pallet::::set_block_number(n.into()); + } - assert_ok!(Liquidation::test_distribute_profit()); - let events = frame_system::Pallet::::events() - .into_iter() - .map(|record| record.event) - .filter_map(|event| { - if let RuntimeEvent::Liquidation(inner_event) = event { - Some(inner_event) - } else { - None - } - }) - .collect::>(); + assert_ok!(Liquidation::test_distribute_profit()); + let events = frame_system::Pallet::::events() + .into_iter() + .map(|record| record.event) + .filter_map(|event| { + if let RuntimeEvent::Liquidation(inner_event) = event { + Some(inner_event) + } else { + None + } + }) + .collect::>(); - assert!(events.iter().any(expected_event)); - assert_eq!(>::get(), Zero::zero()); - assert_eq!(>::get(), Zero::zero()); - assert!(>::iter().next().is_none()); - }); + assert!(events.iter().any(expected_event)); + assert_eq!(>::get(), Zero::zero()); + assert_eq!(>::get(), Zero::zero()); + assert!(>::iter().next().is_none()); + }); } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 3c8ad05..3baf209 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -371,13 +371,13 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 2 seconds of compute with a 6 second average block time. const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( - WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), + WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, ); /// Maximum number of blocks simultaneously accepted by the Runtime, not yet included /// into the relay chain. -const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3; +const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; /// How many parachain blocks are processed by the relay chain per parent. Limits the /// number of blocks authored per slot. const BLOCK_PROCESSING_VELOCITY: u32 = 1; @@ -664,7 +664,7 @@ impl pallet_aura::Config for Runtime { type AuthorityId = AuraId; type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; - type AllowMultipleBlocksPerSlot = ConstBool; + type AllowMultipleBlocksPerSlot = ConstBool; #[cfg(feature = "experimental")] type SlotDuration = ConstU64; } @@ -973,15 +973,10 @@ impl pallet_liquidation::Config for Runtime { type XcmSender = xcm_config::XcmRouter; type WeightToFee = WeightToFee; type OrderGasCost = OrderGasCostHandler; - type SystemRatio = SystemRatio; - type TreasuryRatio = TreasuryRatio; - type OperationRatio = OperationRatio; type ExistentialDeposit = ExistDeposit; - type MinLiquidationThreshold = MinLiquidationThreshold; type SystemAccountName = SystemAccountName; type TreasuryAccountName = TreasuryAccountName; type OperationAccountName = OperationAccountName; - type ProfitDistributionCycle = ProfitDistributionCycle; } parameter_types! {