Move protocol.h values into namespace Lending

This commit is contained in:
Ed Hennis
2025-11-21 17:20:43 -05:00
parent b76cd60a12
commit 1cec91e72d
7 changed files with 17 additions and 0 deletions

View File

@@ -110,6 +110,7 @@ tenthBipsOfValue(T value, TenthBips<TBips> 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;

View File

@@ -638,6 +638,7 @@ class LoanBroker_test : public beast::unit_test::suite
}
using namespace loanBroker;
using namespace ripple::Lending;
TenthBips32 const tenthBipsZero{0};

View File

@@ -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"};

View File

@@ -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)

View File

@@ -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))

View File

@@ -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))

View File

@@ -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