mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
- Spec: XLS-66
Fix overpayment asserts (#6084)
MPTTester::operator() parameter should be std::int64_t
- Originally defined as uint64_t, but the testIssuerLoan() test called
it with a negative number, causing an overflow to a very large number
that in some circumstances could be silently cast back to an int64_t,
but might not be. I believe this is UB, and we don't want to rely on
that.
Review feedback from @Tapanito: overpayment value change
- In overpayment results, the management fee was being calculated twice:
once as part of the value change, and as part of the fees paid.
Exclude it from the value change.
Fix Overpayment Calculation (#6087)
- Adds additional unit tests to cover math calculations.
- Removes unused methods.
Review feedback from @shawnxie999: even more rounding
- Round the initial total value computation upward, unless there is
0-interest.
- Rename getVaultScale to getAssetsTotalScale, and convert one incorrect
computation to use it.
- Use adjustImpreciseNumber for LossUnrealized.
- Add some logging to computeLoanProperties.
Fix LoanBrokerSet debtMaximum limits (#6116)
Fix some minor bugs in Lending Protocol (#6101)
- add nodiscard to unimpairLoan, and check result in LoanPay
- add a check to verify that issuer exists
- improve LoanManage error code for dust amounts
Check permissions in LoanSet and LoanPay (#6108)
Disallow pseudo accounts to be Destination for LoanBrokerCoverWithdraw (#6106)
Ensure vault asset cap is not exceeded (#6124)
Fix Overpayment ValueChange calculation in Lending Protocol (#6114)
- Adds loan state to LoanProperties.
- Cleans up computeLoanProperties.
- Fixes missing management fee from overpayment.
fix: Enable LP Deposits when the broker is the asset issuer (#6119)
* Replace accountHolds with accountSpendable when checking
for account funds in VaultDeposit and LoanBrokerCoverDeposit
Add a few minor changes (#6158)
- Updates or fixes a couple of things I noticed while reviewing changes
to the spec.
- Rename sfPreviousPaymentDate to sfPreviousPaymentDueDate.
- Make the vault asset cap check added in #6124 a little more robust:
1. Check in preflight if the vault is _already_ over the limit.
2. Prevent overflow when checking with the loan value. (Subtract
instead of adding, in case the values are near maxint. Both return
the same result. Also add a unit test so each case is covered.
Add minimum grace period validation (#6133)
Fix bugs: frozen pseudo-account, and FLC cutoff (#6170)
refactor: Rename raw state to theoretical state (#6187)
Check if a withdrawal amount exceeds any applicable receiving limit. (#6117)
Fix overpayment result calculation (#6195)
Address review feedback from Lending Protocol re-review (#6161)
---------
Co-authored-by: Gregory Tsipenyuk <gregtatcam@users.noreply.github.com>
Co-authored-by: Bronek Kozicki <brok@incorrekt.com>
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
Co-authored-by: Shawn Xie <35279399+shawnxie999@users.noreply.github.com>
Co-authored-by: Jingchen <a1q123456@users.noreply.github.com>
608 lines
22 KiB
Plaintext
608 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::nftpage_min, keylet::nftpage_max, 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::ticket
|
|
*/
|
|
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
|
|
{sfTakerGetsCurrency, soeOPTIONAL}, // order book directories
|
|
{sfTakerGetsIssuer, 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},
|
|
{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 ripple::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
|