mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 16:56:48 +00:00
611 lines
22 KiB
Plaintext
611 lines
22 KiB
Plaintext
#if !defined(LEDGER_ENTRY)
|
|
#error "undefined macro: LEDGER_ENTRY"
|
|
#endif
|
|
|
|
#ifndef LEDGER_ENTRY_DUPLICATE
|
|
// The EXPAND macro is needed for Windows
|
|
// https://stackoverflow.com/questions/5134523/msvc-doesnt-expand-va-args-correctly
|
|
#define EXPAND(x) x
|
|
|
|
// The `LEDGER_ENTRY_DUPLICATE macro is needed to avoid JSS conflicts
|
|
// Since some transactions and ledger entries have the same name (like `DepositPreauth`)
|
|
// The compiler won't accept two instances of `JSS(DepositPreauth)`
|
|
#define LEDGER_ENTRY_DUPLICATE(...) EXPAND(LEDGER_ENTRY(__VA_ARGS__))
|
|
#endif
|
|
|
|
/**
|
|
* These objects are listed in order of increasing ledger type ID.
|
|
* There are many gaps between these IDs.
|
|
* You are welcome to fill them with new object types.
|
|
*/
|
|
|
|
/** A ledger object which identifies an offer to buy or sell an NFT.
|
|
|
|
\sa keylet::nftoffer
|
|
*/
|
|
LEDGER_ENTRY(ltNFTOKEN_OFFER, 0x0037, NFTokenOffer, nft_offer, ({
|
|
{sfOwner, SoeRequired},
|
|
{sfNFTokenID, SoeRequired},
|
|
{sfAmount, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfNFTokenOfferNode, SoeRequired},
|
|
{sfDestination, SoeOptional},
|
|
{sfExpiration, SoeOptional},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object which describes a check.
|
|
|
|
\sa keylet::check
|
|
*/
|
|
LEDGER_ENTRY(ltCHECK, 0x0043, Check, check, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfDestination, SoeRequired},
|
|
{sfSendMax, SoeRequired},
|
|
{sfSequence, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfDestinationNode, SoeRequired},
|
|
{sfExpiration, SoeOptional},
|
|
{sfInvoiceID, SoeOptional},
|
|
{sfSourceTag, SoeOptional},
|
|
{sfDestinationTag, SoeOptional},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** The ledger object which tracks the DID.
|
|
|
|
\sa keylet::did
|
|
*/
|
|
LEDGER_ENTRY(ltDID, 0x0049, DID, did, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfDIDDocument, SoeOptional},
|
|
{sfURI, SoeOptional},
|
|
{sfData, SoeOptional},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** The ledger object which tracks the current negative UNL state.
|
|
|
|
\note This is a singleton: only one such object exists in the ledger.
|
|
|
|
\sa keylet::negativeUNL
|
|
*/
|
|
LEDGER_ENTRY(ltNEGATIVE_UNL, 0x004e, NegativeUNL, nunl, ({
|
|
{sfDisabledValidators, SoeOptional},
|
|
{sfValidatorToDisable, SoeOptional},
|
|
{sfValidatorToReEnable, SoeOptional},
|
|
{sfPreviousTxnID, SoeOptional},
|
|
{sfPreviousTxnLgrSeq, SoeOptional},
|
|
}))
|
|
|
|
/** A ledger object which contains a list of NFTs
|
|
|
|
\sa keylet::nftpageMin, keylet::nftpageMax, keylet::nftpage
|
|
*/
|
|
LEDGER_ENTRY(ltNFTOKEN_PAGE, 0x0050, NFTokenPage, nft_page, ({
|
|
{sfPreviousPageMin, SoeOptional},
|
|
{sfNextPageMin, SoeOptional},
|
|
{sfNFTokens, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object which contains a signer list for an account.
|
|
|
|
\sa keylet::signers
|
|
*/
|
|
// All fields are SoeRequired because there is always a SignerEntries.
|
|
// If there are no SignerEntries the node is deleted.
|
|
LEDGER_ENTRY(ltSIGNER_LIST, 0x0053, SignerList, signer_list, ({
|
|
{sfOwner, SoeOptional},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfSignerQuorum, SoeRequired},
|
|
{sfSignerEntries, SoeRequired},
|
|
{sfSignerListID, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object which describes a ticket.
|
|
|
|
\sa keylet::kTicket
|
|
*/
|
|
LEDGER_ENTRY(ltTICKET, 0x0054, Ticket, ticket, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfTicketSequence, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object which describes an account.
|
|
|
|
\sa keylet::account
|
|
*/
|
|
LEDGER_ENTRY(ltACCOUNT_ROOT, 0x0061, AccountRoot, account, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfSequence, SoeRequired},
|
|
{sfBalance, SoeRequired},
|
|
{sfOwnerCount, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
{sfAccountTxnID, SoeOptional},
|
|
{sfRegularKey, SoeOptional},
|
|
{sfEmailHash, SoeOptional},
|
|
{sfWalletLocator, SoeOptional},
|
|
{sfWalletSize, SoeOptional},
|
|
{sfMessageKey, SoeOptional},
|
|
{sfTransferRate, SoeOptional},
|
|
{sfDomain, SoeOptional},
|
|
{sfTickSize, SoeOptional},
|
|
{sfTicketCount, SoeOptional},
|
|
{sfNFTokenMinter, SoeOptional},
|
|
{sfMintedNFTokens, SoeDefault},
|
|
{sfBurnedNFTokens, SoeDefault},
|
|
{sfFirstNFTokenSequence, SoeOptional},
|
|
{sfAMMID, SoeOptional}, // pseudo-account designator
|
|
{sfVaultID, SoeOptional}, // pseudo-account designator
|
|
{sfLoanBrokerID, SoeOptional}, // pseudo-account designator
|
|
}))
|
|
|
|
/** A ledger object which contains a list of object identifiers.
|
|
|
|
\sa keylet::page, keylet::quality, keylet::book, keylet::next and
|
|
keylet::ownerDir
|
|
*/
|
|
LEDGER_ENTRY(ltDIR_NODE, 0x0064, DirectoryNode, directory, ({
|
|
{sfOwner, SoeOptional}, // for owner directories
|
|
{sfTakerPaysCurrency, SoeOptional}, // order book directories
|
|
{sfTakerPaysIssuer, SoeOptional}, // order book directories
|
|
{sfTakerPaysMPT, SoeOptional}, // order book directories
|
|
{sfTakerGetsCurrency, SoeOptional}, // order book directories
|
|
{sfTakerGetsIssuer, SoeOptional}, // order book directories
|
|
{sfTakerGetsMPT, SoeOptional}, // order book directories
|
|
{sfExchangeRate, SoeOptional}, // order book directories
|
|
{sfIndexes, SoeRequired},
|
|
{sfRootIndex, SoeRequired},
|
|
{sfIndexNext, SoeOptional},
|
|
{sfIndexPrevious, SoeOptional},
|
|
{sfNFTokenID, SoeOptional},
|
|
{sfPreviousTxnID, SoeOptional},
|
|
{sfPreviousTxnLgrSeq, SoeOptional},
|
|
{sfDomainID, SoeOptional} // order book directories
|
|
}))
|
|
|
|
/** The ledger object which lists details about amendments on the network.
|
|
|
|
\note This is a singleton: only one such object exists in the ledger.
|
|
|
|
\sa keylet::amendments
|
|
*/
|
|
LEDGER_ENTRY(ltAMENDMENTS, 0x0066, Amendments, amendments, ({
|
|
{sfAmendments, SoeOptional}, // Enabled
|
|
{sfMajorities, SoeOptional},
|
|
{sfPreviousTxnID, SoeOptional},
|
|
{sfPreviousTxnLgrSeq, SoeOptional},
|
|
}))
|
|
|
|
/** A ledger object that contains a list of ledger hashes.
|
|
|
|
This type is used to store the ledger hashes which the protocol uses
|
|
to implement skip lists that allow for efficient backwards (and, in
|
|
theory, forward) forward iteration across large ledger ranges.
|
|
|
|
\sa keylet::skip
|
|
*/
|
|
LEDGER_ENTRY(ltLEDGER_HASHES, 0x0068, LedgerHashes, hashes, ({
|
|
{sfFirstLedgerSequence, SoeOptional},
|
|
{sfLastLedgerSequence, SoeOptional},
|
|
{sfHashes, SoeRequired},
|
|
}))
|
|
|
|
/** The ledger object which lists details about sidechains.
|
|
|
|
\sa keylet::bridge
|
|
*/
|
|
LEDGER_ENTRY(ltBRIDGE, 0x0069, Bridge, bridge, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfSignatureReward, SoeRequired},
|
|
{sfMinAccountCreateAmount, SoeOptional},
|
|
{sfXChainBridge, SoeRequired},
|
|
{sfXChainClaimID, SoeRequired},
|
|
{sfXChainAccountCreateCount, SoeRequired},
|
|
{sfXChainAccountClaimCount, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object which describes an offer on the DEX.
|
|
|
|
\sa keylet::offer
|
|
*/
|
|
LEDGER_ENTRY(ltOFFER, 0x006f, Offer, offer, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfSequence, SoeRequired},
|
|
{sfTakerPays, SoeRequired},
|
|
{sfTakerGets, SoeRequired},
|
|
{sfBookDirectory, SoeRequired},
|
|
{sfBookNode, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
{sfExpiration, SoeOptional},
|
|
{sfDomainID, SoeOptional},
|
|
{sfAdditionalBooks, SoeOptional},
|
|
}))
|
|
|
|
/** A ledger object which describes a deposit pre-authorization.
|
|
|
|
\sa keylet::depositPreauth
|
|
*/
|
|
LEDGER_ENTRY_DUPLICATE(ltDEPOSIT_PREAUTH, 0x0070, DepositPreauth, deposit_preauth, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfAuthorize, SoeOptional},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
{sfAuthorizeCredentials, SoeOptional},
|
|
}))
|
|
|
|
/** A claim id for a cross chain transaction.
|
|
|
|
\sa keylet::xChainClaimID
|
|
*/
|
|
LEDGER_ENTRY(ltXCHAIN_OWNED_CLAIM_ID, 0x0071, XChainOwnedClaimID, xchain_owned_claim_id, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfXChainBridge, SoeRequired},
|
|
{sfXChainClaimID, SoeRequired},
|
|
{sfOtherChainSource, SoeRequired},
|
|
{sfXChainClaimAttestations, SoeRequired},
|
|
{sfSignatureReward, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object which describes a bidirectional trust line.
|
|
|
|
@note Per Vinnie Falco this should be renamed to ltTRUST_LINE
|
|
|
|
\sa keylet::line
|
|
*/
|
|
LEDGER_ENTRY(ltRIPPLE_STATE, 0x0072, RippleState, state, ({
|
|
{sfBalance, SoeRequired},
|
|
{sfLowLimit, SoeRequired},
|
|
{sfHighLimit, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
{sfLowNode, SoeOptional},
|
|
{sfLowQualityIn, SoeOptional},
|
|
{sfLowQualityOut, SoeOptional},
|
|
{sfHighNode, SoeOptional},
|
|
{sfHighQualityIn, SoeOptional},
|
|
{sfHighQualityOut, SoeOptional},
|
|
}))
|
|
|
|
/** The ledger object which lists the network's fee settings.
|
|
|
|
\note This is a singleton: only one such object exists in the ledger.
|
|
|
|
\sa keylet::fees
|
|
*/
|
|
LEDGER_ENTRY(ltFEE_SETTINGS, 0x0073, FeeSettings, fee, ({
|
|
// Old version uses raw numbers
|
|
{sfBaseFee, SoeOptional},
|
|
{sfReferenceFeeUnits, SoeOptional},
|
|
{sfReserveBase, SoeOptional},
|
|
{sfReserveIncrement, SoeOptional},
|
|
// New version uses Amounts
|
|
{sfBaseFeeDrops, SoeOptional},
|
|
{sfReserveBaseDrops, SoeOptional},
|
|
{sfReserveIncrementDrops, SoeOptional},
|
|
{sfPreviousTxnID, SoeOptional},
|
|
{sfPreviousTxnLgrSeq, SoeOptional},
|
|
}))
|
|
|
|
/** A claim id for a cross chain create account transaction.
|
|
|
|
\sa keylet::xChainCreateAccountClaimID
|
|
*/
|
|
LEDGER_ENTRY(ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID, 0x0074, XChainOwnedCreateAccountClaimID, xchain_owned_create_account_claim_id, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfXChainBridge, SoeRequired},
|
|
{sfXChainAccountCreateCount, SoeRequired},
|
|
{sfXChainCreateAccountAttestations, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object describing a single escrow.
|
|
|
|
\sa keylet::escrow
|
|
*/
|
|
LEDGER_ENTRY(ltESCROW, 0x0075, Escrow, escrow, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfSequence, SoeOptional},
|
|
{sfDestination, SoeRequired},
|
|
{sfAmount, SoeRequired},
|
|
{sfCondition, SoeOptional},
|
|
{sfCancelAfter, SoeOptional},
|
|
{sfFinishAfter, SoeOptional},
|
|
{sfSourceTag, SoeOptional},
|
|
{sfDestinationTag, SoeOptional},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
{sfDestinationNode, SoeOptional},
|
|
{sfTransferRate, SoeOptional},
|
|
{sfIssuerNode, SoeOptional},
|
|
}))
|
|
|
|
/** A ledger object describing a single unidirectional XRP payment channel.
|
|
|
|
\sa keylet::payChan
|
|
*/
|
|
LEDGER_ENTRY(ltPAYCHAN, 0x0078, PayChannel, payment_channel, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfDestination, SoeRequired},
|
|
{sfSequence, SoeOptional},
|
|
{sfAmount, SoeRequired},
|
|
{sfBalance, SoeRequired},
|
|
{sfPublicKey, SoeRequired},
|
|
{sfSettleDelay, SoeRequired},
|
|
{sfExpiration, SoeOptional},
|
|
{sfCancelAfter, SoeOptional},
|
|
{sfSourceTag, SoeOptional},
|
|
{sfDestinationTag, SoeOptional},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
{sfDestinationNode, SoeOptional},
|
|
}))
|
|
|
|
/** The ledger object which tracks the AMM.
|
|
|
|
\sa keylet::amm
|
|
*/
|
|
LEDGER_ENTRY(ltAMM, 0x0079, AMM, amm, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfTradingFee, SoeDefault},
|
|
{sfVoteSlots, SoeOptional},
|
|
{sfAuctionSlot, SoeOptional},
|
|
{sfLPTokenBalance, SoeRequired},
|
|
{sfAsset, SoeRequired},
|
|
{sfAsset2, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeOptional},
|
|
{sfPreviousTxnLgrSeq, SoeOptional},
|
|
}))
|
|
|
|
/** A ledger object which tracks MPTokenIssuance
|
|
\sa keylet::mptIssuance
|
|
*/
|
|
LEDGER_ENTRY(ltMPTOKEN_ISSUANCE, 0x007e, MPTokenIssuance, mpt_issuance, ({
|
|
{sfIssuer, SoeRequired},
|
|
{sfSequence, SoeRequired},
|
|
{sfTransferFee, SoeDefault},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfAssetScale, SoeDefault},
|
|
{sfMaximumAmount, SoeOptional},
|
|
{sfOutstandingAmount, SoeRequired},
|
|
{sfLockedAmount, SoeOptional},
|
|
{sfMPTokenMetadata, SoeOptional},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
{sfDomainID, SoeOptional},
|
|
{sfMutableFlags, SoeDefault},
|
|
}))
|
|
|
|
/** A ledger object which tracks MPToken
|
|
\sa keylet::mptoken
|
|
*/
|
|
LEDGER_ENTRY(ltMPTOKEN, 0x007f, MPToken, mptoken, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfMPTokenIssuanceID, SoeRequired},
|
|
{sfMPTAmount, SoeDefault},
|
|
{sfLockedAmount, SoeOptional},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object which tracks Oracle
|
|
\sa keylet::oracle
|
|
*/
|
|
LEDGER_ENTRY(ltORACLE, 0x0080, Oracle, oracle, ({
|
|
{sfOwner, SoeRequired},
|
|
{sfOracleDocumentID, SoeOptional},
|
|
{sfProvider, SoeRequired},
|
|
{sfPriceDataSeries, SoeRequired},
|
|
{sfAssetClass, SoeRequired},
|
|
{sfLastUpdateTime, SoeRequired},
|
|
{sfURI, SoeOptional},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object which tracks Credential
|
|
\sa keylet::credential
|
|
*/
|
|
LEDGER_ENTRY(ltCREDENTIAL, 0x0081, Credential, credential, ({
|
|
{sfSubject, SoeRequired},
|
|
{sfIssuer, SoeRequired},
|
|
{sfCredentialType, SoeRequired},
|
|
{sfExpiration, SoeOptional},
|
|
{sfURI, SoeOptional},
|
|
{sfIssuerNode, SoeRequired},
|
|
{sfSubjectNode, SoeOptional},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object which tracks PermissionedDomain
|
|
\sa keylet::permissionedDomain
|
|
*/
|
|
LEDGER_ENTRY(ltPERMISSIONED_DOMAIN, 0x0082, PermissionedDomain, permissioned_domain, ({
|
|
{sfOwner, SoeRequired},
|
|
{sfSequence, SoeRequired},
|
|
{sfAcceptedCredentials, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object representing permissions an account has delegated to another account.
|
|
\sa keylet::delegate
|
|
*/
|
|
LEDGER_ENTRY(ltDELEGATE, 0x0083, Delegate, delegate, ({
|
|
{sfAccount, SoeRequired},
|
|
{sfAuthorize, SoeRequired},
|
|
{sfPermissions, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfDestinationNode, SoeOptional},
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
}))
|
|
|
|
/** A ledger object representing a single asset vault.
|
|
\sa keylet::vault
|
|
*/
|
|
LEDGER_ENTRY(ltVAULT, 0x0084, Vault, vault, ({
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
{sfSequence, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfOwner, SoeRequired},
|
|
{sfAccount, SoeRequired},
|
|
{sfData, SoeOptional},
|
|
{sfAsset, SoeRequired},
|
|
{sfAssetsTotal, SoeDefault},
|
|
{sfAssetsAvailable, SoeDefault},
|
|
{sfAssetsMaximum, SoeDefault},
|
|
{sfLossUnrealized, SoeDefault},
|
|
{sfShareMPTID, SoeRequired},
|
|
{sfWithdrawalPolicy, SoeRequired},
|
|
{sfScale, SoeDefault},
|
|
// no SharesTotal ever (use MPTIssuance.sfOutstandingAmount)
|
|
// no PermissionedDomainID ever (use MPTIssuance.sfDomainID)
|
|
}))
|
|
|
|
/** Reserve 0x0084-0x0087 for future Vault-related objects. */
|
|
|
|
/** A ledger object representing a loan broker
|
|
|
|
\sa keylet::loanbroker
|
|
*/
|
|
LEDGER_ENTRY(ltLOAN_BROKER, 0x0088, LoanBroker, loan_broker, ({
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
{sfSequence, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfVaultNode, SoeRequired},
|
|
{sfVaultID, SoeRequired},
|
|
{sfAccount, SoeRequired},
|
|
{sfOwner, SoeRequired},
|
|
{sfLoanSequence, SoeRequired},
|
|
{sfData, SoeDefault},
|
|
{sfManagementFeeRate, SoeDefault},
|
|
{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
|
|
|
|
\sa keylet::loan
|
|
*/
|
|
LEDGER_ENTRY(ltLOAN, 0x0089, Loan, loan, ({
|
|
{sfPreviousTxnID, SoeRequired},
|
|
{sfPreviousTxnLgrSeq, SoeRequired},
|
|
{sfOwnerNode, SoeRequired},
|
|
{sfLoanBrokerNode, SoeRequired},
|
|
{sfLoanBrokerID, SoeRequired},
|
|
{sfLoanSequence, SoeRequired},
|
|
{sfBorrower, SoeRequired},
|
|
{sfLoanOriginationFee, SoeDefault},
|
|
{sfLoanServiceFee, SoeDefault},
|
|
{sfLatePaymentFee, SoeDefault},
|
|
{sfClosePaymentFee, SoeDefault},
|
|
{sfOverpaymentFee, SoeDefault},
|
|
{sfInterestRate, SoeDefault},
|
|
{sfLateInterestRate, SoeDefault},
|
|
{sfCloseInterestRate, SoeDefault},
|
|
{sfOverpaymentInterestRate, SoeDefault},
|
|
{sfStartDate, SoeRequired},
|
|
{sfPaymentInterval, SoeRequired},
|
|
{sfGracePeriod, SoeDefault},
|
|
{sfPreviousPaymentDueDate, SoeDefault},
|
|
{sfNextPaymentDueDate, SoeDefault},
|
|
// The loan object tracks these values:
|
|
//
|
|
// - PaymentRemaining: The number of payments left in the loan. When it
|
|
// reaches 0, the loan is paid off, and all other relevant values
|
|
// must also be 0.
|
|
//
|
|
// - PeriodicPayment: The fixed, unrounded amount to be paid each
|
|
// interval. Stored with as much precision as possible.
|
|
// Payment transactions must round this value *UP*.
|
|
//
|
|
// - TotalValueOutstanding: The rounded total amount owed by the
|
|
// borrower to the lender / vault.
|
|
//
|
|
// - PrincipalOutstanding: The rounded portion of the
|
|
// TotalValueOutstanding that is from the principal borrowed.
|
|
//
|
|
// - ManagementFeeOutstanding: The rounded portion of the
|
|
// TotalValueOutstanding that represents management fees
|
|
// specifically owed to the broker based on the initial
|
|
// loan parameters.
|
|
//
|
|
// There are additional values that can be computed from these:
|
|
//
|
|
// - InterestOutstanding = TotalValueOutstanding - PrincipalOutstanding
|
|
// The total amount of interest still pending on the loan,
|
|
// independent of management fees.
|
|
//
|
|
// - InterestOwedToVault = InterestOutstanding - ManagementFeeOutstanding
|
|
// The amount of the total interest that is owed to the vault, and
|
|
// will be sent to it as part of a payment.
|
|
//
|
|
// - TrueTotalLoanValue = PaymentRemaining * PeriodicPayment
|
|
// The unrounded true total value of the loan.
|
|
//
|
|
// - TrueTotalPrincipalOutstanding can be computed using the algorithm
|
|
// in the xrpl::detail::loanPrincipalFromPeriodicPayment function.
|
|
//
|
|
// - TrueTotalInterestOutstanding = TrueTotalLoanValue -
|
|
// TrueTotalPrincipalOutstanding
|
|
// The unrounded true total interest remaining.
|
|
//
|
|
// - TrueTotalManagementFeeOutstanding = TrueTotalInterestOutstanding *
|
|
// LoanBroker.ManagementFeeRate
|
|
// The unrounded true total fee still owed to the broker.
|
|
//
|
|
// Note the the "True" values may differ significantly from the tracked
|
|
// rounded values.
|
|
{sfPaymentRemaining, SoeDefault},
|
|
{sfPeriodicPayment, SoeRequired},
|
|
{sfPrincipalOutstanding, SoeDefault},
|
|
{sfTotalValueOutstanding, SoeDefault},
|
|
{sfManagementFeeOutstanding, SoeDefault},
|
|
// Based on the computed total value at creation, used for
|
|
// rounding calculated values so they are all on a
|
|
// consistent scale - that is, they all have the same
|
|
// number of digits after the decimal point (excluding
|
|
// trailing zeros).
|
|
{sfLoanScale, SoeDefault},
|
|
}))
|
|
|
|
#undef EXPAND
|
|
#undef LEDGER_ENTRY_DUPLICATE
|