-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
156 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use cfg_primitives::Moment; | ||
use cfg_traits::interest::InterestRate; | ||
use codec::{Decode, Encode, MaxEncodedLen}; | ||
use frame_support::{storage::bounded_vec::BoundedVec, RuntimeDebug}; | ||
use scale_info::TypeInfo; | ||
|
||
use crate::{ | ||
entities::pricing::{PricingAmount, RepaidPricingAmount}, | ||
pallet::Config, | ||
types::{ | ||
policy::WriteOffRule, valuation::ValuationMethod, InterestPayments, Maturity, | ||
PayDownSchedule, | ||
}, | ||
}; | ||
|
||
/// Active loan mutation for internal pricing | ||
#[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo, RuntimeDebug, MaxEncodedLen)] | ||
pub enum InternalMutation<Rate> { | ||
ValuationMethod(ValuationMethod<Rate>), | ||
ProbabilityOfDefault(Rate), | ||
LossGivenDefault(Rate), | ||
DiscountRate(InterestRate<Rate>), | ||
} | ||
|
||
/// Active loan mutation | ||
#[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo, RuntimeDebug, MaxEncodedLen)] | ||
pub enum LoanMutation<Rate> { | ||
Maturity(Maturity), | ||
MaturityExtension(Moment), | ||
InterestRate(InterestRate<Rate>), | ||
InterestPayments(InterestPayments), | ||
PayDownSchedule(PayDownSchedule), | ||
Internal(InternalMutation<Rate>), | ||
} | ||
|
||
/// Change description | ||
#[derive(Encode, Decode, Clone, PartialEq, Eq, TypeInfo, RuntimeDebug, MaxEncodedLen)] | ||
#[scale_info(skip_type_params(T))] | ||
pub enum Change<T: Config> { | ||
Loan(T::LoanId, LoanMutation<T::Rate>), | ||
Policy(BoundedVec<WriteOffRule<T::Rate>, T::MaxWriteOffPolicySize>), | ||
TransferDebt( | ||
T::LoanId, | ||
T::LoanId, | ||
RepaidPricingAmount<T>, | ||
PricingAmount<T>, | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters