mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-27 09:00:32 +00:00
Review feedback from @gregtatcam: seconds per year
- Define a constexpr secondsInYear in LedgerHelpers.h
This commit is contained in:
@@ -2388,7 +2388,7 @@ protected:
|
||||
// the below BEAST_EXPECTs may not hold across assets.
|
||||
Number const interval = state.paymentInterval;
|
||||
auto const periodicRate =
|
||||
interval * Number(12, -2) / (365 * 24 * 60 * 60);
|
||||
interval * Number(12, -2) / secondsInYear;
|
||||
BEAST_EXPECT(
|
||||
periodicRate ==
|
||||
Number(2283105022831050, -21, Number::unchecked{}));
|
||||
@@ -2620,7 +2620,7 @@ protected:
|
||||
// the below BEAST_EXPECTs may not hold across assets.
|
||||
Number const interval = state.paymentInterval;
|
||||
auto const periodicRate =
|
||||
interval * Number(12, -2) / (365 * 24 * 60 * 60);
|
||||
interval * Number(12, -2) / secondsInYear;
|
||||
BEAST_EXPECT(
|
||||
periodicRate ==
|
||||
Number(2283105022831050, -21, Number::unchecked{}));
|
||||
|
||||
@@ -12,6 +12,8 @@ struct PreflightContext;
|
||||
bool
|
||||
checkLendingProtocolDependencies(PreflightContext const& ctx);
|
||||
|
||||
static constexpr std::uint32_t secondsInYear = 365 * 24 * 60 * 60;
|
||||
|
||||
Number
|
||||
loanPeriodicRate(TenthBips32 interestRate, std::uint32_t paymentInterval);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ loanPeriodicRate(TenthBips32 interestRate, std::uint32_t paymentInterval)
|
||||
* other places.
|
||||
*/
|
||||
return tenthBipsOfValue(Number(paymentInterval), interestRate) /
|
||||
(365 * 24 * 60 * 60);
|
||||
secondsInYear;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
Reference in New Issue
Block a user