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>
36 #include <boost/optional.hpp>
68 [[nodiscard]] STAmount
77 [[nodiscard]] STAmount
81 STAmount
const& saDefault,
91 [[nodiscard]] XRPAmount
101 ReadView
const& view,
113 ReadView
const& view,
127 dirIsEmpty(ReadView
const& view, Keylet
const& k);
134 ReadView
const& view,
137 unsigned int& uDirEntry,
146 ReadView
const& view,
149 unsigned int& uDirEntry,
171 [[nodiscard]] boost::optional<uint256>
189 return (requested + 255) & (~255);
199 ReadView
const& validLedger,
200 ReadView
const& testLedger,
208 ReadView
const& testLedger,
234 unsigned int& uDirEntry,
246 unsigned int& uDirEntry,
254 boost::optional<std::uint64_t>
257 Keylet
const& uRootIndex,
279 const bool bNoRipple,
281 STAmount
const& saBalance,
283 STAmount
const& saLimit,
323 const STAmount& saAmount,
332 const STAmount& saAmount,
339 STAmount
const& amount,
347 STAmount
const& amount,
356 STAmount
const& amount,
TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Rate transferRate(ReadView const &view, AccountID const &issuer)
majorityAmendments_t getMajorityAmendments(ReadView const &view)
std::uint32_t LedgerIndex
A ledger index.
std::set< uint256 > getEnabledAmendments(ReadView const &view)
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
bool cdirNext(ReadView const &view, uint256 const &uRootIndex, std::shared_ptr< SLE const > &sleNode, unsigned int &uDirEntry, uint256 &uEntryIndex, beast::Journal j)
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
bool dirNext(ApplyView &view, uint256 const &uRootIndex, std::shared_ptr< SLE > &sleNode, unsigned int &uDirEntry, uint256 &uEntryIndex, beast::Journal j)
FreezeHandling
Controls the treatment of frozen account balances.
void forEachItem(ReadView const &view, AccountID const &id, std::function< void(std::shared_ptr< SLE const > const &)> f)
Iterate all items in an account's owner directory.
bool dirFirst(ApplyView &view, uint256 const &uRootIndex, std::shared_ptr< SLE > &sleNode, unsigned int &uDirEntry, uint256 &uEntryIndex, beast::Journal j)
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
TER accountSend(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, beast::Journal j)
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)
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)
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)
boost::optional< std::uint64_t > dirAdd(ApplyView &view, Keylet const &dir, uint256 const &uLedgerIndex, bool strictOrder, std::function< void(SLE::ref)> fDescriber, beast::Journal j)
boost::optional< uint256 > hashOfSeq(ReadView const &ledger, LedgerIndex seq, beast::Journal journal)
Return the hash of a ledger by sequence.
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.
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.
TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
bool forEachItemAfter(ReadView const &view, AccountID const &id, uint256 const &after, std::uint64_t const hint, unsigned int limit, std::function< bool(std::shared_ptr< SLE const > const &)> f)
Iterate all items after an item in an owner 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.
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.
bool cdirFirst(ReadView const &view, uint256 const &uRootIndex, std::shared_ptr< SLE const > &sleNode, unsigned int &uDirEntry, uint256 &uEntryIndex, beast::Journal j)