[WIP] Define remaining transactions, start implementing LoanBrokerSet

- Does not build
- Transactions: LoanDelete, LoanManage, LoanDraw, LoanPay
- LoanBrokerSet creation mostly done. Need update.
- Also added a lookup table for pseudo account fields.
This commit is contained in:
Ed Hennis
2025-03-21 20:03:22 -04:00
parent 009ae8183f
commit 24374c548b
11 changed files with 355 additions and 16 deletions

View File

@@ -82,6 +82,26 @@ std::size_t constexpr maxDeletableTokenOfferEntries = 500;
*/
std::uint16_t constexpr maxTransferFee = 50000;
/** The maximum management fee rate allowed in lending.
TODO: Is this a good name?
Valid values for the the management fee charged by the Lending Protocol are
between 0 and 10000 inclusive. A value of 1 is equivalent to 1/10 basis
point fee or 0.001%.
*/
std::uint16_t constexpr maxFeeRate = 10'000;
/** The maximum coverage rate allowed in lending.
TODO: Is this a good name?
Valid values for the coverage rate charged by the Lending Protocol for first
loss capital operations are between 0 and 100000 inclusive. A value of 1 is
equivalent to 1/10 bps or 0.001%.
*/
std::uint16_t constexpr maxCoverRate = 100'000;
/** The maximum length of a URI inside an NFT */
std::size_t constexpr maxTokenURILength = 256;

View File

@@ -237,6 +237,13 @@ constexpr std::uint32_t const tfVaultCreateMask = ~(tfUniversal | tfVaultPrivate
// True, indicates the load supports overpayments
constexpr std::uint32_t const tfLoanOverpayment = 0x00010000;
constexpr std::uint32_t const tfLoanSetMask = ~(tfUniversal | tfLoanOverpayment);
// LoanManage flags:
constexpr std::uint32_t const tfLoanDefault = 0x00010000;
constexpr std::uint32_t const tfLoanImpair = 0x00010000;
constexpr std::uint32_t const tfLoanUnimpair = 0x00010000;
constexpr std::uint32_t const tfLoanManageMask = ~(tfUniversal | tfLoanDefault | tfLoanImpair | tfLoanUnimpair);
// clang-format on
} // namespace ripple

View File

@@ -501,12 +501,12 @@ LEDGER_ENTRY(ltLOAN_BROKER, 0x0084, LoanBroker, loan_broker, ({
{sfOwner, soeREQUIRED},
{sfData, soeDEFAULT},
{sfManagementFeeRate, soeDEFAULT},
{sfOwnerCount, soeREQUIRED},
{sfDebtTotal, soeREQUIRED},
{sfDebtMaximum, soeREQUIRED},
{sfCoverAvailable, soeREQUIRED},
{sfCoverRateMinimum, soeREQUIRED},
{sfCoverRateLiquidation, soeREQUIRED},
{sfOwnerCount, soeDEFAULT},
{sfDebtTotal, soeDEFAULT},
{sfDebtMaximum, soeDEFAULT},
{sfCoverAvailable, soeDEFAULT},
{sfCoverRateMinimum, soeDEFAULT},
{sfCoverRateLiquidation, soeDEFAULT},
}))
/** A ledger object representing a loan between a Borrower and a Loan Broker

View File

@@ -211,6 +211,7 @@ TYPED_SFIELD(sfHookSetTxnID, UINT256, 33)
TYPED_SFIELD(sfDomainID, UINT256, 34)
TYPED_SFIELD(sfVaultID, UINT256, 35)
TYPED_SFIELD(sfLoanBrokerID, UINT256, 36)
TYPED_SFIELD(sfLoanID, UINT256, 37)
// number (common)
TYPED_SFIELD(sfNumber, NUMBER, 1)

View File

@@ -508,7 +508,6 @@ TRANSACTION(ttVAULT_CLAWBACK, 69, VaultClawback, ({
{sfAmount, soeOPTIONAL, soeMPTSupported},
}))
#if 0
/** This transaction creates and updates a Loan Broker */
TRANSACTION(ttLOAN_BROKER_SET, 70, LoanBrokerSet, ({
{sfVaultID, soeREQUIRED},
@@ -520,6 +519,7 @@ TRANSACTION(ttLOAN_BROKER_SET, 70, LoanBrokerSet, ({
{sfCoverRateLiquidation, soeDEFAULT},
}))
#if 0
/** This transaction deletes a Loan Broker */
TRANSACTION(ttLOAN_BROKER_DELETE, 71, LoanBrokerDelete, ({
{sfLoanBrokerID, soeREQUIRED},
@@ -556,6 +556,28 @@ TRANSACTION(ttLOAN_SET, 74, LoanSet, ({
{sfPaymentInterval, soeOPTIONAL},
{sfGracePeriod, soeOPTIONAL},
}))
/** This transaction deletes an existing Loan */
TRANSACTION(ttLOAN_DELETE, 75, LoanDelete, ({
{sfLoanID, soeREQUIRED},
}))
/** This transaction is used to change the delinquency status of an existing Loan */
TRANSACTION(ttLOAN_MANAGE, 76, LoanManage, ({
{sfLoanID, soeREQUIRED},
}))
/** The Borrower uses this transaction to draws funds from the Loan. */
TRANSACTION(ttLOAN_DRAW, 77, LoanDraw, ({
{sfLoanID, soeREQUIRED},
{sfAmount, soeREQUIRED},
}))
/** The Borrower uses this transaction to make a Payment on the Loan. */
TRANSACTION(ttLOAN_PAY, 77, LoanPay, ({
{sfLoanID, soeREQUIRED},
{sfAmount, soeREQUIRED},
}))
#endif
/** This system-generated transaction type is used to update the status of the various amendments.