mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Compare commits
12 Commits
ximinez/le
...
tapanito/l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4526d6b77b | ||
|
|
43a6f10050 | ||
|
|
e2e9582ff1 | ||
|
|
803380c53c | ||
|
|
7f7fda5fd2 | ||
|
|
335b9becd7 | ||
|
|
8e4be94f4a | ||
|
|
1f3ded7116 | ||
|
|
aa1234199a | ||
|
|
da9a483b79 | ||
|
|
f447827474 | ||
|
|
07497322de |
@@ -1271,7 +1271,8 @@ protected:
|
|||||||
verifyLoanStatus,
|
verifyLoanStatus,
|
||||||
issuer,
|
issuer,
|
||||||
lender,
|
lender,
|
||||||
borrower);
|
borrower,
|
||||||
|
PaymentParameters{.showStepBalances = true});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Runs through the complete lifecycle of a loan
|
/** Runs through the complete lifecycle of a loan
|
||||||
@@ -7193,15 +7194,15 @@ class LoanArbitrary_test : public LoanBatch_test
|
|||||||
.vaultDeposit = 10000,
|
.vaultDeposit = 10000,
|
||||||
.debtMax = 0,
|
.debtMax = 0,
|
||||||
.coverRateMin = TenthBips32{0},
|
.coverRateMin = TenthBips32{0},
|
||||||
// .managementFeeRate = TenthBips16{5919},
|
.managementFeeRate = TenthBips16{0},
|
||||||
.coverRateLiquidation = TenthBips32{0}};
|
.coverRateLiquidation = TenthBips32{0}};
|
||||||
LoanParameters const loanParams{
|
LoanParameters const loanParams{
|
||||||
.account = Account("lender"),
|
.account = Account("lender"),
|
||||||
.counter = Account("borrower"),
|
.counter = Account("borrower"),
|
||||||
.principalRequest = Number{10000, 0},
|
.principalRequest = Number{200000, -6},
|
||||||
// .interest = TenthBips32{0},
|
.interest = TenthBips32{50000},
|
||||||
// .payTotal = 5816,
|
.payTotal = 2,
|
||||||
.payInterval = 150};
|
.payInterval = 200};
|
||||||
|
|
||||||
runLoan(AssetType::XRP, brokerParams, loanParams);
|
runLoan(AssetType::XRP, brokerParams, loanParams);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -644,7 +644,7 @@ MPTTester::operator[](std::string const& name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
PrettyAmount
|
PrettyAmount
|
||||||
MPTTester::operator()(std::uint64_t amount) const
|
MPTTester::operator()(std::int64_t amount) const
|
||||||
{
|
{
|
||||||
return MPT("", issuanceID())(amount);
|
return MPT("", issuanceID())(amount);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ public:
|
|||||||
operator[](std::string const& name) const;
|
operator[](std::string const& name) const;
|
||||||
|
|
||||||
PrettyAmount
|
PrettyAmount
|
||||||
operator()(std::uint64_t amount) const;
|
operator()(std::int64_t amount) const;
|
||||||
|
|
||||||
operator Asset() const;
|
operator Asset() const;
|
||||||
|
|
||||||
|
|||||||
@@ -547,6 +547,14 @@ tryOverpayment(
|
|||||||
|
|
||||||
auto const deltas = rounded - newRounded;
|
auto const deltas = rounded - newRounded;
|
||||||
|
|
||||||
|
// The change in loan management fee is equal to the change between the old
|
||||||
|
// and the new outstanding management fees
|
||||||
|
XRPL_ASSERT_PARTS(
|
||||||
|
deltas.managementFee ==
|
||||||
|
rounded.managementFeeDue - managementFeeOutstanding,
|
||||||
|
"ripple::detail::tryOverpayment",
|
||||||
|
"no fee change");
|
||||||
|
|
||||||
auto const hypotheticalValueOutstanding =
|
auto const hypotheticalValueOutstanding =
|
||||||
rounded.valueOutstanding - deltas.principal;
|
rounded.valueOutstanding - deltas.principal;
|
||||||
|
|
||||||
@@ -561,7 +569,6 @@ tryOverpayment(
|
|||||||
"the loan. Ignore the overpayment";
|
"the loan. Ignore the overpayment";
|
||||||
return Unexpected(tesSUCCESS);
|
return Unexpected(tesSUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoanPaymentParts{
|
return LoanPaymentParts{
|
||||||
// Principal paid is the reduction in principal outstanding
|
// Principal paid is the reduction in principal outstanding
|
||||||
.principalPaid = deltas.principal,
|
.principalPaid = deltas.principal,
|
||||||
@@ -676,12 +683,6 @@ doOverpayment(
|
|||||||
"ripple::detail::doOverpayment",
|
"ripple::detail::doOverpayment",
|
||||||
"principal change agrees");
|
"principal change agrees");
|
||||||
|
|
||||||
XRPL_ASSERT_PARTS(
|
|
||||||
overpaymentComponents.trackedManagementFeeDelta ==
|
|
||||||
managementFeeOutstandingProxy - managementFeeOutstanding,
|
|
||||||
"ripple::detail::doOverpayment",
|
|
||||||
"no fee change");
|
|
||||||
|
|
||||||
// I'm not 100% sure the following asserts are correct. If in doubt, and
|
// I'm not 100% sure the following asserts are correct. If in doubt, and
|
||||||
// everything else works, remove any that cause trouble.
|
// everything else works, remove any that cause trouble.
|
||||||
|
|
||||||
@@ -712,13 +713,6 @@ doOverpayment(
|
|||||||
"ripple::detail::doOverpayment",
|
"ripple::detail::doOverpayment",
|
||||||
"principal payment matches");
|
"principal payment matches");
|
||||||
|
|
||||||
XRPL_ASSERT_PARTS(
|
|
||||||
loanPaymentParts.feePaid ==
|
|
||||||
overpaymentComponents.untrackedManagementFee +
|
|
||||||
overpaymentComponents.trackedManagementFeeDelta,
|
|
||||||
"ripple::detail::doOverpayment",
|
|
||||||
"fee payment matches");
|
|
||||||
|
|
||||||
// All validations passed, so update the proxy objects (which will
|
// All validations passed, so update the proxy objects (which will
|
||||||
// modify the actual Loan ledger object)
|
// modify the actual Loan ledger object)
|
||||||
totalValueOutstandingProxy = totalValueOutstanding;
|
totalValueOutstandingProxy = totalValueOutstanding;
|
||||||
|
|||||||
@@ -305,7 +305,13 @@ LoanPay::doApply()
|
|||||||
// change will be discarded.
|
// change will be discarded.
|
||||||
if (loanSle->isFlag(lsfLoanImpaired))
|
if (loanSle->isFlag(lsfLoanImpaired))
|
||||||
{
|
{
|
||||||
|
if (auto const ret =
|
||||||
LoanManage::unimpairLoan(view, loanSle, vaultSle, j_);
|
LoanManage::unimpairLoan(view, loanSle, vaultSle, j_);
|
||||||
|
ret != tesSUCCESS)
|
||||||
|
{
|
||||||
|
JLOG(j_.fatal()) << "Failed to unimpair loan before payment.";
|
||||||
|
return ret; // LCOV_EXCL_LINE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LoanPaymentType const paymentType = [&tx]() {
|
LoanPaymentType const paymentType = [&tx]() {
|
||||||
|
|||||||
Reference in New Issue
Block a user