mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 03:26:01 +00:00
documents loanDeltas
This commit is contained in:
@@ -259,18 +259,40 @@ struct ExtendedPaymentComponents : public PaymentComponents
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Represents the differences between two loan states.
|
||||||
|
*
|
||||||
|
* This structure is used to capture the change in each component of a loan's
|
||||||
|
* state, typically when computing the difference between two LoanState objects
|
||||||
|
* (e.g., before and after a payment). It is a convenient way to capture changes
|
||||||
|
* in each component.
|
||||||
|
*
|
||||||
|
* LoanDeltas is primarily used for:
|
||||||
|
* - Computing the actual amounts paid during a payment transaction
|
||||||
|
* - Validating that loan state changes are correct
|
||||||
|
* - Applying incremental changes to a loan state
|
||||||
|
*
|
||||||
|
*/
|
||||||
struct LoanDeltas
|
struct LoanDeltas
|
||||||
{
|
{
|
||||||
|
// The difference in principal outstanding between two loan states.
|
||||||
Number principal;
|
Number principal;
|
||||||
|
|
||||||
|
// The difference in interest due between two loan states.
|
||||||
Number interest;
|
Number interest;
|
||||||
|
|
||||||
|
// The difference in management fee outstanding between two loan states.
|
||||||
Number managementFee;
|
Number managementFee;
|
||||||
|
|
||||||
|
/* Calculates the total change across all components.
|
||||||
|
* @return The sum of principal, interest, and management fee deltas.
|
||||||
|
*/
|
||||||
Number
|
Number
|
||||||
total() const
|
total() const
|
||||||
{
|
{
|
||||||
return principal + interest + managementFee;
|
return principal + interest + managementFee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensures all delta values are non-negative.
|
||||||
void
|
void
|
||||||
nonNegative();
|
nonNegative();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user