From 8a7571f16f432868929219a1c70c5529fa845080 Mon Sep 17 00:00:00 2001 From: lemunozm Date: Tue, 12 Sep 2023 11:10:18 +0200 Subject: [PATCH] update runtime --- runtime/common/src/lib.rs | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 749516013e..51076b26ee 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -398,21 +398,21 @@ pub mod oracle { pub mod changes { use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::RuntimeDebug; - use pallet_loans::ChangeOf as LoansChangeOf; + use pallet_loans::entities::changes::Change as LoansChange; use pallet_pool_system::pool_types::changes::PoolChangeProposal; use scale_info::TypeInfo; use sp_runtime::DispatchError; #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] pub enum RuntimeChange { - Loan(LoansChangeOf), + Loan(LoansChange), } #[cfg(not(feature = "runtime-benchmarks"))] impl From> for PoolChangeProposal { fn from(RuntimeChange::Loan(loans_change): RuntimeChange) -> Self { use cfg_primitives::SECONDS_PER_WEEK; - use pallet_loans::types::{InternalMutation, LoanMutation}; + use pallet_loans::entities::changes::{InternalMutation, LoanMutation}; use pallet_pool_system::pool_types::changes::Requirement; use sp_std::vec; @@ -423,7 +423,7 @@ pub mod changes { let requirements = match loans_change { // Requirements gathered from // - LoansChangeOf::::Loan(_, loan_mutation) => match loan_mutation { + LoansChange::::Loan(_, loan_mutation) => match loan_mutation { LoanMutation::Maturity(_) => vec![week, blocked], LoanMutation::MaturityExtension(_) => vec![], LoanMutation::InterestPayments(_) => vec![week, blocked], @@ -436,7 +436,8 @@ pub mod changes { InternalMutation::DiscountRate(_) => vec![epoch], }, }, - LoansChangeOf::::Policy(_) => vec![week, blocked], + LoansChange::::Policy(_) => vec![week, blocked], + LoansChange::::TransferDebt(_, _, _, _) => vec![epoch, blocked], }; PoolChangeProposal::new(requirements) @@ -457,17 +458,17 @@ pub mod changes { } /// Used for building CfgChanges in pallet-loans - impl From> for RuntimeChange { - fn from(loan_change: LoansChangeOf) -> RuntimeChange { + impl From> for RuntimeChange { + fn from(loan_change: LoansChange) -> RuntimeChange { RuntimeChange::Loan(loan_change) } } /// Used for recovering LoanChange in pallet-loans - impl TryInto> for RuntimeChange { + impl TryInto> for RuntimeChange { type Error = DispatchError; - fn try_into(self) -> Result, DispatchError> { + fn try_into(self) -> Result, DispatchError> { let RuntimeChange::Loan(loan_change) = self; Ok(loan_change) } @@ -497,17 +498,17 @@ pub mod changes { } /// Used for building CfgChanges in pallet-loans - impl From> for RuntimeChange { - fn from(loan_change: LoansChangeOf) -> RuntimeChange { + impl From> for RuntimeChange { + fn from(loan_change: LoansChange) -> RuntimeChange { Self(loan_change.into()) } } /// Used for recovering LoanChange in pallet-loans - impl TryInto> for RuntimeChange { + impl TryInto> for RuntimeChange { type Error = DispatchError; - fn try_into(self) -> Result, DispatchError> { + fn try_into(self) -> Result, DispatchError> { self.0.try_into() } }