20 #ifndef RIPPLE_LEDGER_VIEW_H_INCLUDED
21 #define RIPPLE_LEDGER_VIEW_H_INCLUDED
23 #include <ripple/beast/utility/Journal.h>
24 #include <ripple/core/Config.h>
25 #include <ripple/ledger/ApplyView.h>
26 #include <ripple/ledger/OpenView.h>
27 #include <ripple/ledger/RawView.h>
28 #include <ripple/ledger/ReadView.h>
29 #include <ripple/protocol/Protocol.h>
30 #include <ripple/protocol/Rate.h>
31 #include <ripple/protocol/STLedgerEntry.h>
32 #include <ripple/protocol/STObject.h>
33 #include <ripple/protocol/STTx.h>
34 #include <ripple/protocol/Serializer.h>
35 #include <ripple/protocol/TER.h>
91 [[nodiscard]]
inline bool
102 ReadView
const& view,
107 [[nodiscard]]
inline bool
116 [[nodiscard]] STAmount
118 ReadView
const& view,
125 [[nodiscard]] STAmount
127 ReadView
const& view,
138 [[nodiscard]] STAmount
140 ReadView
const& view,
142 STAmount
const& saDefault,
152 [[nodiscard]] XRPAmount
154 ReadView
const& view,
162 ReadView
const& view,
174 ReadView
const& view,
216 dirIsEmpty(ReadView
const& view, Keylet
const& k);
254 return (requested + 255) & (~255);
264 ReadView
const& validLedger,
265 ReadView
const& testLedger,
273 ReadView
const& testLedger,
308 ReadView
const& view,
340 ReadView
const& view,
374 const bool bNoRipple,
376 STAmount
const& saBalance,
378 STAmount
const& saLimit,
418 const STAmount& saAmount,
427 const STAmount& saAmount,
435 STAmount
const& amount,
443 STAmount
const& amount,
452 STAmount
const& amount,
480 Keylet const& ownerDirKeylet,
TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
std::function< std::pair< TER, SkipEntry >(LedgerEntryType, uint256 const &, std::shared_ptr< SLE > &)> EntryDeleter
Deleter function prototype.
Rate transferRate(ReadView const &view, AccountID const &issuer)
bool cdirNext(ReadView const &view, uint256 const &root, std::shared_ptr< SLE const > &page, unsigned int &index, uint256 &entry)
Returns the next entry in the directory, advancing the index.
bool dirNext(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
majorityAmendments_t getMajorityAmendments(ReadView const &view)
A pair of SHAMap key and LedgerEntryType.
std::uint32_t LedgerIndex
A ledger index.
std::set< uint256 > getEnabledAmendments(ReadView const &view)
A currency issued by an account.
bool forEachItemAfter(ReadView const &view, Keylet const &root, uint256 const &after, std::uint64_t const hint, unsigned int limit, std::function< bool(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items after an item in the given directory.
TER accountSend(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee)
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
bool hasExpired(ReadView const &view, std::optional< std::uint32_t > const &exp)
Determines whether the given expiration time has passed.
TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
FreezeHandling
Controls the treatment of frozen account balances.
AccountID ammAccountID(std::uint16_t prefix, uint256 const &parentHash, uint256 const &ammID)
Calculate AMM account ID.
Writeable view to a ledger, for applying a transaction.
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account)
Check if the account requires authorization.
Integers of any length that is a multiple of 32-bits.
bool isGlobalFrozen(ReadView const &view, AccountID const &issuer)
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
TERSubset< CanCvtToTER > TER
Provide a light-weight way to check active() before string formatting.
XRPAmount xrpLiquid(ReadView const &view, AccountID const &id, std::int32_t ownerCountAdj, beast::Journal j)
std::optional< uint256 > hashOfSeq(ReadView const &ledger, LedgerIndex seq, beast::Journal journal)
Return the hash of a ledger by sequence.
A generic endpoint for log messages.
TER trustDelete(ApplyView &view, std::shared_ptr< SLE > const &sleRippleState, AccountID const &uLowAccountID, AccountID const &uHighAccountID, beast::Journal j)
TER cleanupOnAccountDelete(ApplyView &view, Keylet const &ownerDirKeylet, EntryDeleter const &deleter, beast::Journal j, std::optional< uint16_t > maxNodesToDelete)
bool areCompatible(ReadView const &validLedger, ReadView const &testLedger, beast::Journal::Stream &s, const char *reason)
Return false if the test ledger is provably incompatible with the valid ledger, that is,...
STAmount accountFunds(ReadView const &view, AccountID const &id, STAmount const &saDefault, FreezeHandling freezeHandling, beast::Journal j)
TER transferXRP(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &amount, beast::Journal j)
TER issueIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
bool dirIsEmpty(ReadView const &view, Keylet const &k)
Returns true if the directory is empty.
base_uint< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool dirFirst(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
bool isIndividualFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
TER trustCreate(ApplyView &view, const bool bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, const bool bAuth, const bool bNoRipple, const bool bFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uQualityIn, std::uint32_t uQualityOut, beast::Journal j)
Create a trust line.
LedgerEntryType
Identifiers for on-ledger objects.
TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
void forEachItem(ReadView const &view, Keylet const &root, std::function< void(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items in the given directory.
static bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
LedgerIndex getCandidateLedger(LedgerIndex requested)
Find a ledger index from which we could easily get the requested ledger.
bool cdirFirst(ReadView const &view, uint256 const &root, std::shared_ptr< SLE const > &page, unsigned int &index, uint256 &entry)
Returns the first entry in the directory, advancing the index.
const std::shared_ptr< STLedgerEntry > & ref
bool isFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Number root(Number f, unsigned d)