From 1cec91e72d94508d881f6a4a396aa8a8ac8cd82a Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Fri, 21 Nov 2025 17:20:43 -0500 Subject: [PATCH] Move protocol.h values into namespace Lending --- include/xrpl/protocol/Protocol.h | 2 ++ src/test/app/LoanBroker_test.cpp | 1 + src/test/app/Loan_test.cpp | 6 ++++++ src/xrpld/app/misc/detail/LendingHelpers.cpp | 2 ++ src/xrpld/app/tx/detail/LoanBrokerSet.cpp | 2 ++ src/xrpld/app/tx/detail/LoanPay.cpp | 2 ++ src/xrpld/app/tx/detail/LoanSet.cpp | 2 ++ 7 files changed, 17 insertions(+) diff --git a/include/xrpl/protocol/Protocol.h b/include/xrpl/protocol/Protocol.h index 2487d29c9b..ded16cad6d 100644 --- a/include/xrpl/protocol/Protocol.h +++ b/include/xrpl/protocol/Protocol.h @@ -110,6 +110,7 @@ tenthBipsOfValue(T value, TenthBips bips) return value * bips.value() / tenthBipsPerUnity.value(); } +namespace Lending { /** The maximum management fee rate allowed by a loan broker in 1/10 bips. Valid values are between 0 and 10% inclusive. @@ -197,6 +198,7 @@ static constexpr int loanPaymentsPerFeeIncrement = 5; * without an amendment */ static constexpr int loanMaximumPaymentsPerTransaction = 100; +} // namespace Lending /** The maximum length of a URI inside an NFT */ std::size_t constexpr maxTokenURILength = 256; diff --git a/src/test/app/LoanBroker_test.cpp b/src/test/app/LoanBroker_test.cpp index aa5b5519b9..a73621aa85 100644 --- a/src/test/app/LoanBroker_test.cpp +++ b/src/test/app/LoanBroker_test.cpp @@ -638,6 +638,7 @@ class LoanBroker_test : public beast::unit_test::suite } using namespace loanBroker; + using namespace ripple::Lending; TenthBips32 const tenthBipsZero{0}; diff --git a/src/test/app/Loan_test.cpp b/src/test/app/Loan_test.cpp index fa4ed233b4..584f8d6890 100644 --- a/src/test/app/Loan_test.cpp +++ b/src/test/app/Loan_test.cpp @@ -1639,6 +1639,7 @@ protected: int interestExponent) { using namespace jtx; + using namespace Lending; auto const& asset = broker.asset.raw(); auto const currencyLabel = getCurrencyLabel(asset); @@ -4843,6 +4844,7 @@ protected: using namespace jtx; using namespace std::chrono_literals; + using namespace Lending; Env env(*this, all); Account const issuer{"issuer"}; @@ -5016,6 +5018,7 @@ protected: using namespace jtx; using namespace std::chrono_literals; + using namespace Lending; Env env(*this, all); Account const issuer{"issuer"}; @@ -5099,6 +5102,7 @@ protected: using namespace jtx; using namespace std::chrono_literals; + using namespace Lending; Env env(*this, all); Account const issuer{"issuer"}; @@ -5211,6 +5215,7 @@ protected: using namespace jtx; using namespace std::chrono_literals; + using namespace Lending; Env env(*this, all); Account const issuer{"issuer"}; @@ -5305,6 +5310,7 @@ protected: using namespace jtx; using namespace std::chrono_literals; + using namespace Lending; Env env(*this, all); Account const issuer{"issuer"}; diff --git a/src/xrpld/app/misc/detail/LendingHelpers.cpp b/src/xrpld/app/misc/detail/LendingHelpers.cpp index e5eac77c1b..b558a24a15 100644 --- a/src/xrpld/app/misc/detail/LendingHelpers.cpp +++ b/src/xrpld/app/misc/detail/LendingHelpers.cpp @@ -1457,6 +1457,8 @@ loanMakePayment( LoanPaymentType const paymentType, beast::Journal j) { + using namespace Lending; + /* * This function is an implementation of the XLS-66 spec, * section 3.2.4.3 (Transaction Pseudo-code) diff --git a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp b/src/xrpld/app/tx/detail/LoanBrokerSet.cpp index c5b6891cb8..0e89cc6533 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerSet.cpp @@ -13,6 +13,8 @@ LoanBrokerSet::checkExtraFeatures(PreflightContext const& ctx) NotTEC LoanBrokerSet::preflight(PreflightContext const& ctx) { + using namespace Lending; + auto const& tx = ctx.tx; if (auto const data = tx[~sfData]; data && !data->empty() && !validDataLength(tx[~sfData], maxDataPayloadLength)) diff --git a/src/xrpld/app/tx/detail/LoanPay.cpp b/src/xrpld/app/tx/detail/LoanPay.cpp index 39a93f634a..58fb2739d6 100644 --- a/src/xrpld/app/tx/detail/LoanPay.cpp +++ b/src/xrpld/app/tx/detail/LoanPay.cpp @@ -52,6 +52,8 @@ LoanPay::preflight(PreflightContext const& ctx) XRPAmount LoanPay::calculateBaseFee(ReadView const& view, STTx const& tx) { + using namespace Lending; + auto const normalCost = Transactor::calculateBaseFee(view, tx); if (tx.isFlag(tfLoanFullPayment) || tx.isFlag(tfLoanLatePayment)) diff --git a/src/xrpld/app/tx/detail/LoanSet.cpp b/src/xrpld/app/tx/detail/LoanSet.cpp index d9e5f8b981..2f174ff0c8 100644 --- a/src/xrpld/app/tx/detail/LoanSet.cpp +++ b/src/xrpld/app/tx/detail/LoanSet.cpp @@ -21,6 +21,8 @@ LoanSet::getFlagsMask(PreflightContext const& ctx) NotTEC LoanSet::preflight(PreflightContext const& ctx) { + using namespace Lending; + auto const& tx = ctx.tx; // Special case for Batch inner transactions