20 #ifndef RIPPLE_LEDGER_VIEW_H_INCLUDED
21 #define RIPPLE_LEDGER_VIEW_H_INCLUDED
23 #include <ripple/ledger/ApplyView.h>
24 #include <ripple/ledger/OpenView.h>
25 #include <ripple/ledger/RawView.h>
26 #include <ripple/ledger/ReadView.h>
27 #include <ripple/protocol/Protocol.h>
28 #include <ripple/protocol/Rate.h>
29 #include <ripple/protocol/Serializer.h>
30 #include <ripple/protocol/STLedgerEntry.h>
31 #include <ripple/protocol/STObject.h>
32 #include <ripple/protocol/STTx.h>
33 #include <ripple/protocol/TER.h>
34 #include <ripple/core/Config.h>
35 #include <ripple/beast/utility/Journal.h>
36 #include <boost/optional.hpp>
70 [[nodiscard]] STAmount
76 [[nodiscard]] STAmount
87 [[nodiscard]] XRPAmount
126 unsigned int& uDirEntry,
137 unsigned int& uDirEntry,
159 [[nodiscard]] boost::optional<uint256>
179 return (requested + 255) & (~255);
188 areCompatible (ReadView
const& validLedger, ReadView
const& testLedger,
214 unsigned int& uDirEntry,
225 unsigned int& uDirEntry,
233 boost::optional<std::uint64_t>
235 Keylet
const& uRootIndex,
256 const bool bNoRipple,
258 STAmount
const& saBalance,
260 STAmount
const& saLimit,
299 const STAmount & saAmount,
bool bCheckIssuer,
307 const STAmount & saAmount,
313 STAmount
const& amount,
320 STAmount
const& amount,
328 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)
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
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)
bool cdirFirst(ReadView const &view, uint256 const &uRootIndex, std::shared_ptr< SLE const > &sleNode, unsigned int &uDirEntry, uint256 &uEntryIndex, beast::Journal j)