Start adding transaction layouts, flags, and fields

(Does not compile)
This commit is contained in:
Ed Hennis
2025-03-18 20:37:16 -04:00
parent 9d1b98a5a4
commit 319e7a6bcb
5 changed files with 73 additions and 7 deletions

View File

@@ -194,6 +194,11 @@ enum LedgerSpecificFlags {
// ltVAULT // ltVAULT
lsfVaultPrivate = 0x00010000, lsfVaultPrivate = 0x00010000,
// ltLOAN
lsfLoanDefault = 0x00010000,
lsfLoanImpaired = 0x00020000,
lsfLoanOverpayment = 0x00040000, // True, loan allows overpayments
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -230,6 +230,11 @@ constexpr std::uint32_t const tfVaultPrivate = 0x00010000;
static_assert(tfVaultPrivate == lsfVaultPrivate); static_assert(tfVaultPrivate == lsfVaultPrivate);
constexpr std::uint32_t const tfVaultShareNonTransferable = 0x00020000; constexpr std::uint32_t const tfVaultShareNonTransferable = 0x00020000;
constexpr std::uint32_t const tfVaultCreateMask = ~(tfUniversal | tfVaultPrivate | tfVaultShareNonTransferable); constexpr std::uint32_t const tfVaultCreateMask = ~(tfUniversal | tfVaultPrivate | tfVaultShareNonTransferable);
// LoanSet flags:
// True, indicates the load supports overpayments
constexpr std::uint32_t const tfLoanOverpayment = 0x00010000;
constexpr std::uint32_t const tfLoanSetMask = ~(tfUniversal | tfLoanOverpayment);
// clang-format on // clang-format on
} // namespace ripple } // namespace ripple

View File

@@ -126,6 +126,7 @@ TYPED_SFIELD(sfGracePeriod, UINT32, 54)
TYPED_SFIELD(sfPreviousPaymentDate, UINT32, 55) TYPED_SFIELD(sfPreviousPaymentDate, UINT32, 55)
TYPED_SFIELD(sfNextPaymentDueDate, UINT32, 56) TYPED_SFIELD(sfNextPaymentDueDate, UINT32, 56)
TYPED_SFIELD(sfPaymentRemaining, UINT32, 57) TYPED_SFIELD(sfPaymentRemaining, UINT32, 57)
TYPED_SFIELD(sfPaymentTotal, UINT32, 58)
// 64-bit integers (common) // 64-bit integers (common)
TYPED_SFIELD(sfIndexNext, UINT64, 1) TYPED_SFIELD(sfIndexNext, UINT64, 1)
@@ -226,6 +227,7 @@ TYPED_SFIELD(sfLatePaymentFee, NUMBER, 11)
TYPED_SFIELD(sfClosePaymentFee, NUMBER, 12) TYPED_SFIELD(sfClosePaymentFee, NUMBER, 12)
TYPED_SFIELD(sfOverpaymentFee, NUMBER, 13) TYPED_SFIELD(sfOverpaymentFee, NUMBER, 13)
TYPED_SFIELD(sfPrincipalOutstanding, NUMBER, 14) TYPED_SFIELD(sfPrincipalOutstanding, NUMBER, 14)
TYPED_SFIELD(sfPrincipalRequested, NUMBER, 15)
// currency amount (common) // currency amount (common)
TYPED_SFIELD(sfAmount, AMOUNT, 1) TYPED_SFIELD(sfAmount, AMOUNT, 1)
@@ -321,6 +323,7 @@ TYPED_SFIELD(sfLockingChainDoor, ACCOUNT, 22)
TYPED_SFIELD(sfIssuingChainDoor, ACCOUNT, 23) TYPED_SFIELD(sfIssuingChainDoor, ACCOUNT, 23)
TYPED_SFIELD(sfSubject, ACCOUNT, 24) TYPED_SFIELD(sfSubject, ACCOUNT, 24)
TYPED_SFIELD(sfBorrower, ACCOUNT, 25) TYPED_SFIELD(sfBorrower, ACCOUNT, 25)
TYPED_SFIELD(sfCounterparty, ACCOUNT, 26)
// vector of 256-bit // vector of 256-bit
TYPED_SFIELD(sfIndexes, VECTOR256, 1, SField::sMD_Never) TYPED_SFIELD(sfIndexes, VECTOR256, 1, SField::sMD_Never)
@@ -380,6 +383,7 @@ UNTYPED_SFIELD(sfXChainClaimAttestationCollectionElement, OBJECT, 30)
UNTYPED_SFIELD(sfXChainCreateAccountAttestationCollectionElement, OBJECT, 31) UNTYPED_SFIELD(sfXChainCreateAccountAttestationCollectionElement, OBJECT, 31)
UNTYPED_SFIELD(sfPriceData, OBJECT, 32) UNTYPED_SFIELD(sfPriceData, OBJECT, 32)
UNTYPED_SFIELD(sfCredential, OBJECT, 33) UNTYPED_SFIELD(sfCredential, OBJECT, 33)
UNTYPED_SFIELD(sfCounterpartySignature, OBJECT, 34)
// array of objects (common) // array of objects (common)
// ARRAY/1 is reserved for end of array // ARRAY/1 is reserved for end of array

View File

@@ -508,6 +508,54 @@ TRANSACTION(ttVAULT_CLAWBACK, 69, VaultClawback, ({
{sfAmount, soeOPTIONAL, soeMPTSupported}, {sfAmount, soeOPTIONAL, soeMPTSupported},
})) }))
/** This transaction creates and updates a Loan Broker */
TRANSACTION(ttLOAN_BROKER_SET, 70, LoanBrokerSet, ({
{sfVaultID, soeREQUIRED},
{sfLoanBrokerID, soeOPTIONAL},
{sfData, soeOPTIONAL},
{sfManagementFeeRate, soeDEFAULT},
{sfDebtMaximum, soeDEFAULT},
{sfCoverRateMinimum, soeDEFAULT},
{sfCoverRateLiquidation, soeDEFAULT},
}))
/** This transaction deletes a Loan Broker */
TRANSACTION(ttLOAN_BROKER_DELETE, 71, LoanBrokerDelete, ({
{sfLoanBrokerID, soeREQUIRED},
}))
/** This transaction deposits First Loss Capital into a Loan Broker */
TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 72, LoanBrokerCoverDeposit, ({
{sfLoanBrokerID, soeREQUIRED},
{sfNumber, soeREQUIRED},
}))
/** This transaction withdraws First Loss Capital from a Loan Broker */
TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 73, LoanBrokerCoverWithdraw, ({
{sfLoanBrokerID, soeREQUIRED},
{sfNumber, soeREQUIRED},
}))
/** This transaction creates a Loan */
TRANSACTION(ttLOAN_CREATE, 74, LoanCreate, ({
{sfLoanBrokerID, soeREQUIRED},
{sfData, soeOPTIONAL},
{sfCounterparty, soeOPTIONAL},
{sfCounterpartySignature, soeREQUIRED},
{sfLoanOriginationFee, soeDEFAULT},
{sfLoanServiceFee, soeDEFAULT},
{sfLatePaymentFee, soeDEFAULT},
{sfClosePaymentFee, soeDEFAULT},
{sfInterestRate, soeDEFAULT},
{sfLateInterestRate, soeDEFAULT},
{sfCloseInterestRate, soeDEFAULT},
{sfPrincipalRequested, soeREQUIRED},
{sfStartDate, soeREQUIRED},
{sfPaymentTotal, soeOPTIONAL},
{sfPaymentInterval, soeOPTIONAL},
{sfGracePeriod, soeOPTIONAL},
}))
/** This system-generated transaction type is used to update the status of the various amendments. /** This system-generated transaction type is used to update the status of the various amendments.
For details, see: https://xrpl.org/amendments.html For details, see: https://xrpl.org/amendments.html

View File

@@ -28,6 +28,12 @@ InnerObjectFormats::InnerObjectFormats()
// inner objects with the default fields have to be // inner objects with the default fields have to be
// constructed with STObject::makeInnerObject() // constructed with STObject::makeInnerObject()
std::initializer_list<SOElement> const signingFields = {
{sfAccount, soeREQUIRED},
{sfSigningPubKey, soeREQUIRED},
{sfTxnSignature, soeREQUIRED},
};
add(sfSignerEntry.jsonName, add(sfSignerEntry.jsonName,
sfSignerEntry.getCode(), sfSignerEntry.getCode(),
{ {
@@ -36,13 +42,7 @@ InnerObjectFormats::InnerObjectFormats()
{sfWalletLocator, soeOPTIONAL}, {sfWalletLocator, soeOPTIONAL},
}); });
add(sfSigner.jsonName, add(sfSigner.jsonName, sfSigner.getCode(), signingFields);
sfSigner.getCode(),
{
{sfAccount, soeREQUIRED},
{sfSigningPubKey, soeREQUIRED},
{sfTxnSignature, soeREQUIRED},
});
add(sfMajority.jsonName, add(sfMajority.jsonName,
sfMajority.getCode(), sfMajority.getCode(),
@@ -154,6 +154,10 @@ InnerObjectFormats::InnerObjectFormats()
{sfIssuer, soeREQUIRED}, {sfIssuer, soeREQUIRED},
{sfCredentialType, soeREQUIRED}, {sfCredentialType, soeREQUIRED},
}); });
add(sfCounterpartySignature.jsonName,
sfCounterpartySignature.getCode(),
signingFields);
} }
InnerObjectFormats const& InnerObjectFormats const&