rippled
Loading...
Searching...
No Matches
View.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_LEDGER_VIEW_H_INCLUDED
21#define RIPPLE_LEDGER_VIEW_H_INCLUDED
22
23#include <xrpld/ledger/ApplyView.h>
24#include <xrpld/ledger/OpenView.h>
25#include <xrpld/ledger/ReadView.h>
26
27#include <xrpl/beast/utility/Journal.h>
28#include <xrpl/protocol/Indexes.h>
29#include <xrpl/protocol/MPTIssue.h>
30#include <xrpl/protocol/Protocol.h>
31#include <xrpl/protocol/Rate.h>
32#include <xrpl/protocol/STLedgerEntry.h>
33#include <xrpl/protocol/STObject.h>
34#include <xrpl/protocol/Serializer.h>
35#include <xrpl/protocol/TER.h>
36
37#include <functional>
38#include <initializer_list>
39#include <map>
40#include <utility>
41
42namespace ripple {
43
44enum class WaiveTransferFee : bool { No = false, Yes };
45enum class SkipEntry : bool { No = false, Yes };
46
47//------------------------------------------------------------------------------
48//
49// Observers
50//
51//------------------------------------------------------------------------------
52
74[[nodiscard]] bool
75hasExpired(ReadView const& view, std::optional<std::uint32_t> const& exp);
76
79
82
83[[nodiscard]] bool
84isGlobalFrozen(ReadView const& view, AccountID const& issuer);
85
86[[nodiscard]] bool
87isGlobalFrozen(ReadView const& view, MPTIssue const& mptIssue);
88
89[[nodiscard]] bool
90isGlobalFrozen(ReadView const& view, Asset const& asset);
91
92// Note, depth parameter is used to limit the recursion depth
93[[nodiscard]] bool
95 ReadView const& view,
96 AccountID const& account,
97 MPTIssue const& mptShare,
98 int depth);
99
100[[nodiscard]] bool
102 ReadView const& view,
103 AccountID const& account,
104 Currency const& currency,
105 AccountID const& issuer);
106
107[[nodiscard]] inline bool
109 ReadView const& view,
110 AccountID const& account,
111 Issue const& issue)
112{
113 return isIndividualFrozen(view, account, issue.currency, issue.account);
114}
115
116[[nodiscard]] bool
118 ReadView const& view,
119 AccountID const& account,
120 MPTIssue const& mptIssue);
121
122[[nodiscard]] inline bool
124 ReadView const& view,
125 AccountID const& account,
126 Asset const& asset)
127{
128 return std::visit(
129 [&](auto const& issue) {
130 return isIndividualFrozen(view, account, issue);
131 },
132 asset.value());
133}
134
135[[nodiscard]] bool
137 ReadView const& view,
138 AccountID const& account,
139 Currency const& currency,
140 AccountID const& issuer);
141
142[[nodiscard]] inline bool
144 ReadView const& view,
145 AccountID const& account,
146 Issue const& issue,
147 int = 0 /*ignored*/)
148{
149 return isFrozen(view, account, issue.currency, issue.account);
150}
151
152[[nodiscard]] bool
154 ReadView const& view,
155 AccountID const& account,
156 MPTIssue const& mptIssue,
157 int depth = 0);
158
164[[nodiscard]] inline bool
166 ReadView const& view,
167 AccountID const& account,
168 Asset const& asset,
169 int depth = 0)
170{
171 return std::visit(
172 [&](auto const& issue) {
173 return isFrozen(view, account, issue, depth);
174 },
175 asset.value());
176}
177
178[[nodiscard]] bool
180 ReadView const& view,
181 std::initializer_list<AccountID> const& accounts,
182 MPTIssue const& mptIssue,
183 int depth = 0);
184
185[[nodiscard]] inline bool
187 ReadView const& view,
188 std::initializer_list<AccountID> const& accounts,
189 Issue const& issue)
190{
191 for (auto const& account : accounts)
192 {
193 if (isFrozen(view, account, issue.currency, issue.account))
194 return true;
195 }
196 return false;
197}
198
199[[nodiscard]] inline bool
201 ReadView const& view,
202 std::initializer_list<AccountID> const& accounts,
203 Asset const& asset,
204 int depth = 0)
205{
206 return std::visit(
207 [&]<ValidIssueType TIss>(TIss const& issue) {
208 if constexpr (std::is_same_v<TIss, Issue>)
209 return isAnyFrozen(view, accounts, issue);
210 else
211 return isAnyFrozen(view, accounts, issue, depth);
212 },
213 asset.value());
214}
215
216[[nodiscard]] bool
218 ReadView const& view,
219 AccountID const& account,
220 Currency const& currency,
221 AccountID const& issuer);
222
223[[nodiscard]] bool
225 ReadView const& view,
226 AccountID const& account,
227 Issue const& asset,
228 Issue const& asset2);
229
230// Returns the amount an account can spend without going into debt.
231//
232// <-- saAmount: amount of currency held by account. May be negative.
233[[nodiscard]] STAmount
235 ReadView const& view,
236 AccountID const& account,
237 Currency const& currency,
238 AccountID const& issuer,
239 FreezeHandling zeroIfFrozen,
241
242[[nodiscard]] STAmount
244 ReadView const& view,
245 AccountID const& account,
246 Issue const& issue,
247 FreezeHandling zeroIfFrozen,
249
250[[nodiscard]] STAmount
252 ReadView const& view,
253 AccountID const& account,
254 MPTIssue const& mptIssue,
255 FreezeHandling zeroIfFrozen,
256 AuthHandling zeroIfUnauthorized,
258
259[[nodiscard]] STAmount
261 ReadView const& view,
262 AccountID const& account,
263 Asset const& asset,
264 FreezeHandling zeroIfFrozen,
265 AuthHandling zeroIfUnauthorized,
267
268// Returns the amount an account can spend of the currency type saDefault, or
269// returns saDefault if this account is the issuer of the currency in
270// question. Should be used in favor of accountHolds when questioning how much
271// an account can spend while also allowing currency issuers to spend
272// unlimited amounts of their own currency (since they can always issue more).
273[[nodiscard]] STAmount
275 ReadView const& view,
276 AccountID const& id,
277 STAmount const& saDefault,
278 FreezeHandling freezeHandling,
280
281// Return the account's liquid (not reserved) XRP. Generally prefer
282// calling accountHolds() over this interface. However, this interface
283// allows the caller to temporarily adjust the owner count should that be
284// necessary.
285//
286// @param ownerCountAdj positive to add to count, negative to reduce count.
287[[nodiscard]] XRPAmount
289 ReadView const& view,
290 AccountID const& id,
291 std::int32_t ownerCountAdj,
293
295void
297 ReadView const& view,
298 Keylet const& root,
299 std::function<void(std::shared_ptr<SLE const> const&)> const& f);
300
307bool
309 ReadView const& view,
310 Keylet const& root,
311 uint256 const& after,
312 std::uint64_t const hint,
313 unsigned int limit,
314 std::function<bool(std::shared_ptr<SLE const> const&)> const& f);
315
317inline void
319 ReadView const& view,
320 AccountID const& id,
321 std::function<void(std::shared_ptr<SLE const> const&)> const& f)
322{
323 return forEachItem(view, keylet::ownerDir(id), f);
324}
325
332inline bool
334 ReadView const& view,
335 AccountID const& id,
336 uint256 const& after,
337 std::uint64_t const hint,
338 unsigned int limit,
339 std::function<bool(std::shared_ptr<SLE const> const&)> const& f)
340{
341 return forEachItemAfter(view, keylet::ownerDir(id), after, hint, limit, f);
342}
343
349[[nodiscard]] Rate
350transferRate(ReadView const& view, AccountID const& issuer);
351
357[[nodiscard]] Rate
358transferRate(ReadView const& view, MPTID const& issuanceID);
359
364[[nodiscard]] Rate
365transferRate(ReadView const& view, STAmount const& amount);
366
370[[nodiscard]] bool
371dirIsEmpty(ReadView const& view, Keylet const& k);
372
373// Return the list of enabled amendments
374[[nodiscard]] std::set<uint256>
375getEnabledAmendments(ReadView const& view);
376
377// Return a map of amendments that have achieved majority
379[[nodiscard]] majorityAmendments_t
381
391[[nodiscard]] std::optional<uint256>
392hashOfSeq(ReadView const& ledger, LedgerIndex seq, beast::Journal journal);
393
406inline LedgerIndex
408{
409 return (requested + 255) & (~255);
410}
411
417[[nodiscard]] bool
419 ReadView const& validLedger,
420 ReadView const& testLedger,
422 char const* reason);
423
424[[nodiscard]] bool
426 uint256 const& validHash,
427 LedgerIndex validIndex,
428 ReadView const& testLedger,
430 char const* reason);
431
432//------------------------------------------------------------------------------
433//
434// Modifiers
435//
436//------------------------------------------------------------------------------
437
439void
441 ApplyView& view,
442 std::shared_ptr<SLE> const& sle,
443 std::int32_t amount,
445
461bool
463 ReadView const& view,
464 uint256 const& root,
466 unsigned int& index,
467 uint256& entry);
468
469bool
471 ApplyView& view,
472 uint256 const& root,
474 unsigned int& index,
475 uint256& entry);
493bool
495 ReadView const& view,
496 uint256 const& root,
498 unsigned int& index,
499 uint256& entry);
500
501bool
502dirNext(
503 ApplyView& view,
504 uint256 const& root,
506 unsigned int& index,
507 uint256& entry);
510[[nodiscard]] std::function<void(SLE::ref)>
511describeOwnerDir(AccountID const& account);
512
513[[nodiscard]] TER
514dirLink(ApplyView& view, AccountID const& owner, std::shared_ptr<SLE>& object);
515
517pseudoAccountAddress(ReadView const& view, uint256 const& pseudoOwnerKey);
518
527[[nodiscard]] Expected<std::shared_ptr<SLE>, TER>
529 ApplyView& view,
530 uint256 const& pseudoOwnerKey,
531 SField const& ownerField);
532
533// Returns true iff sleAcct is a pseudo-account.
534//
535// Returns false if sleAcct is
536// * NOT a pseudo-account OR
537// * NOT a ltACCOUNT_ROOT OR
538// * null pointer
539[[nodiscard]] bool
541
542[[nodiscard]] inline bool
543isPseudoAccount(ReadView const& view, AccountID accountId)
544{
545 return isPseudoAccount(view.read(keylet::account(accountId)));
546}
547
548[[nodiscard]] TER
550 ApplyView& view,
551 AccountID const& accountID,
552 XRPAmount priorBalance,
553 Issue const& issue,
554 beast::Journal journal);
555
556[[nodiscard]] TER
558 ApplyView& view,
559 AccountID const& accountID,
560 XRPAmount priorBalance,
561 MPTIssue const& mptIssue,
562 beast::Journal journal);
563
564[[nodiscard]] inline TER
566 ApplyView& view,
567 AccountID const& accountID,
568 XRPAmount priorBalance,
569 Asset const& asset,
570 beast::Journal journal)
571{
572 return std::visit(
573 [&]<ValidIssueType TIss>(TIss const& issue) -> TER {
574 return addEmptyHolding(
575 view, accountID, priorBalance, issue, journal);
576 },
577 asset.value());
578}
579
580// VFALCO NOTE Both STAmount parameters should just
581// be "Amount", a unit-less number.
582//
587[[nodiscard]] TER
589 ApplyView& view,
590 bool const bSrcHigh,
591 AccountID const& uSrcAccountID,
592 AccountID const& uDstAccountID,
593 uint256 const& uIndex, // --> ripple state entry
594 SLE::ref sleAccount, // --> the account being set.
595 bool const bAuth, // --> authorize account.
596 bool const bNoRipple, // --> others cannot ripple through
597 bool const bFreeze, // --> funds cannot leave
598 bool bDeepFreeze, // --> can neither receive nor send funds
599 STAmount const& saBalance, // --> balance of account being set.
600 // Issuer should be noAccount()
601 STAmount const& saLimit, // --> limit for account being set.
602 // Issuer should be the account being set.
603 std::uint32_t uSrcQualityIn,
604 std::uint32_t uSrcQualityOut,
606
607[[nodiscard]] TER
609 ApplyView& view,
610 AccountID const& accountID,
611 Issue const& issue,
612 beast::Journal journal);
613
614[[nodiscard]] TER
616 ApplyView& view,
617 AccountID const& accountID,
618 MPTIssue const& mptIssue,
619 beast::Journal journal);
620
621[[nodiscard]] inline TER
623 ApplyView& view,
624 AccountID const& accountID,
625 Asset const& asset,
626 beast::Journal journal)
627{
628 return std::visit(
629 [&]<ValidIssueType TIss>(TIss const& issue) -> TER {
630 return removeEmptyHolding(view, accountID, issue, journal);
631 },
632 asset.value());
633}
634
635[[nodiscard]] TER
637 ApplyView& view,
638 std::shared_ptr<SLE> const& sleRippleState,
639 AccountID const& uLowAccountID,
640 AccountID const& uHighAccountID,
642
649// [[nodiscard]] // nodiscard commented out so Flow, BookTip and others compile.
650TER
651offerDelete(ApplyView& view, std::shared_ptr<SLE> const& sle, beast::Journal j);
652
653//------------------------------------------------------------------------------
654
655//
656// Money Transfers
657//
658
659// Direct send w/o fees:
660// - Redeeming IOUs and/or sending sender's own IOUs.
661// - Create trust line of needed.
662// --> bCheckIssuer : normally require issuer to be involved.
663// [[nodiscard]] // nodiscard commented out so DirectStep.cpp compiles.
664
668TER
670 ApplyView& view,
671 AccountID const& uSenderID,
672 AccountID const& uReceiverID,
673 STAmount const& saAmount,
674 bool bCheckIssuer,
676
677TER
679 ApplyView& view,
680 AccountID const& uGrantorID,
681 STAmount const& saAmount,
683
684TER
686 ApplyView& view,
687 AccountID const& uGrantorID,
688 AccountID const& uGranteeID,
689 STAmount const& saAmount,
691
695[[nodiscard]] TER
697 ApplyView& view,
698 AccountID const& from,
699 AccountID const& to,
700 STAmount const& saAmount,
703
704[[nodiscard]] TER
706 ApplyView& view,
707 AccountID const& account,
708 STAmount const& amount,
709 Issue const& issue,
711
712[[nodiscard]] TER
714 ApplyView& view,
715 AccountID const& account,
716 STAmount const& amount,
717 Issue const& issue,
719
720[[nodiscard]] TER
722 ApplyView& view,
723 AccountID const& from,
724 AccountID const& to,
725 STAmount const& amount,
727
728/* Check if MPToken exists:
729 * - StrongAuth - before checking lsfMPTRequireAuth is set
730 * - WeakAuth - after checking if lsfMPTRequireAuth is set
731 */
732enum class MPTAuthType : bool { StrongAuth = true, WeakAuth = false };
733
739[[nodiscard]] TER
740requireAuth(ReadView const& view, Issue const& issue, AccountID const& account);
741
760[[nodiscard]] TER
762 ReadView const& view,
763 MPTIssue const& mptIssue,
764 AccountID const& account,
766 int depth = 0);
767
768[[nodiscard]] TER inline requireAuth(
769 ReadView const& view,
770 Asset const& asset,
771 AccountID const& account,
773{
774 return std::visit(
775 [&]<ValidIssueType TIss>(TIss const& issue_) {
776 if constexpr (std::is_same_v<TIss, Issue>)
777 return requireAuth(view, issue_, account);
778 else
779 return requireAuth(view, issue_, account, authType);
780 },
781 asset.value());
782}
783
807[[nodiscard]] TER
809 ApplyView& view,
810 MPTID const& mptIssuanceID,
811 AccountID const& account,
812 XRPAmount const& priorBalance,
814
819[[nodiscard]] TER
821 ReadView const& view,
822 MPTIssue const& mptIssue,
823 AccountID const& from,
824 AccountID const& to);
825
832 uint256 const&,
841[[nodiscard]] TER
843 ApplyView& view,
844 Keylet const& ownerDirKeylet,
845 EntryDeleter const& deleter,
847 std::optional<std::uint16_t> maxNodesToDelete = std::nullopt);
848
853[[nodiscard]] TER
855 ApplyView& view,
856 std::shared_ptr<SLE> sleState,
857 std::optional<AccountID> const& ammAccountID,
859
860// From the perspective of a vault,
861// return the number of shares to give the depositor
862// when they deposit a fixed amount of assets.
863[[nodiscard]] STAmount
865 std::shared_ptr<SLE const> const& vault,
866 std::shared_ptr<SLE const> const& issuance,
867 STAmount const& assets);
868
869// From the perspective of a vault,
870// return the number of shares to demand from the depositor
871// when they ask to withdraw a fixed amount of assets.
872[[nodiscard]] STAmount
874 std::shared_ptr<SLE const> const& vault,
875 std::shared_ptr<SLE const> const& issuance,
876 STAmount const& assets);
877
878// From the perspective of a vault,
879// return the number of assets to give the depositor
880// when they redeem a fixed amount of shares.
881[[nodiscard]] STAmount
883 std::shared_ptr<SLE const> const& vault,
884 std::shared_ptr<SLE const> const& issuance,
885 STAmount const& shares);
886
893bool
895
896} // namespace ripple
897
898#endif
Provide a light-weight way to check active() before string formatting.
Definition: Journal.h:205
A generic endpoint for log messages.
Definition: Journal.h:60
Writeable view to a ledger, for applying a transaction.
Definition: ApplyView.h:144
constexpr value_type const & value() const
Definition: Asset.h:156
A currency issued by an account.
Definition: Issue.h:36
AccountID account
Definition: Issue.h:39
Currency currency
Definition: Issue.h:38
A view into a ledger.
Definition: ReadView.h:52
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
std::shared_ptr< STLedgerEntry > const & ref
Definition: STLedgerEntry.h:38
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition: Indexes.cpp:184
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Definition: Indexes.cpp:374
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition: AccountID.h:49
TER rippleLockEscrowMPT(ApplyView &view, AccountID const &sender, STAmount const &amount, beast::Journal j)
Definition: View.cpp:2740
Expected< std::shared_ptr< SLE >, TER > createPseudoAccount(ApplyView &view, uint256 const &pseudoOwnerKey, SField const &ownerField)
Create pseudo-account, storing pseudoOwnerKey into ownerField.
Definition: View.cpp:1095
std::uint32_t LedgerIndex
A ledger index.
Definition: Protocol.h:130
STAmount accountFunds(ReadView const &view, AccountID const &id, STAmount const &saDefault, FreezeHandling freezeHandling, beast::Journal j)
Definition: View.cpp:553
FreezeHandling
Controls the treatment of frozen account balances.
Definition: View.h:78
@ fhZERO_IF_FROZEN
Definition: View.h:78
@ fhIGNORE_FREEZE
Definition: View.h:78
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.
Definition: View.cpp:147
STAmount sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
Definition: View.cpp:2721
LedgerIndex getCandidateLedger(LedgerIndex requested)
Find a ledger index from which we could easily get the requested ledger.
Definition: View.h:407
bool isIndividualFrozen(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer)
Definition: View.cpp:215
TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
Definition: View.cpp:2607
bool dirFirst(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
Definition: View.cpp:125
base_uint< 256 > uint256
Definition: base_uint.h:558
bool dirNext(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
Definition: View.cpp:136
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account)
Check if the account lacks required authorization.
Definition: View.cpp:2301
bool isDeepFrozen(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer)
Definition: View.cpp:349
std::optional< uint256 > hashOfSeq(ReadView const &ledger, LedgerIndex seq, beast::Journal journal)
Return the hash of a ledger by sequence.
Definition: View.cpp:960
Rate transferRate(ReadView const &view, AccountID const &issuer)
Returns IOU issuer transfer fee as Rate.
Definition: View.cpp:761
TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
Definition: View.cpp:2185
base_uint< 192 > MPTID
MPTID is a 192-bit value representing MPT Issuance ID, which is a concatenation of a 32-bit sequence ...
Definition: UintTypes.h:64
AuthHandling
Controls the treatment of unauthorized MPT balances.
Definition: View.h:81
@ ahZERO_IF_UNAUTHORIZED
Definition: View.h:81
@ ahIGNORE_AUTH
Definition: View.h:81
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
Definition: View.cpp:1049
SkipEntry
Definition: View.h:45
TER transferXRP(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &amount, beast::Journal j)
Definition: View.cpp:2258
TER enforceMPTokenAuthorization(ApplyView &view, MPTID const &mptIssuanceID, AccountID const &account, XRPAmount const &priorBalance, beast::Journal j)
Enforce account has MPToken to match its authorization.
Definition: View.cpp:2406
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
Definition: View.cpp:1471
bool isFrozen(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer)
Definition: View.cpp:249
std::set< uint256 > getEnabledAmendments(ReadView const &view)
Definition: View.cpp:920
TER canTransfer(ReadView const &view, MPTIssue const &mptIssue, AccountID const &from, AccountID const &to)
Check if the destination account is allowed to receive MPT.
Definition: View.cpp:2509
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &sender, AccountID const &receiver, STAmount const &amount, beast::Journal j)
Definition: View.cpp:2837
static bool adjustOwnerCount(ApplyContext &ctx, int count)
Definition: SetOracle.cpp:186
base_uint< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Definition: UintTypes.h:56
bool isVaultPseudoAccountFrozen(ReadView const &view, AccountID const &account, MPTIssue const &mptShare, int depth)
Definition: View.cpp:309
TER issueIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
Definition: View.cpp:2085
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.
Definition: View.cpp:158
WaiveTransferFee
Definition: View.h:44
TER trustCreate(ApplyView &view, bool const bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, bool const bAuth, bool const bNoRipple, bool const bFreeze, bool bDeepFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uQualityIn, std::uint32_t uQualityOut, beast::Journal j)
Create a trust line.
Definition: View.cpp:1227
TER trustDelete(ApplyView &view, std::shared_ptr< SLE > const &sleRippleState, AccountID const &uLowAccountID, AccountID const &uHighAccountID, beast::Journal j)
Definition: View.cpp:1431
TER addEmptyHolding(ApplyView &view, AccountID const &accountID, XRPAmount priorBalance, Issue const &issue, beast::Journal journal)
Definition: View.cpp:1154
AccountID pseudoAccountAddress(ReadView const &view, uint256 const &pseudoOwnerKey)
Definition: View.cpp:1068
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
Definition: View.cpp:386
bool isLPTokenFrozen(ReadView const &view, AccountID const &account, Issue const &asset, Issue const &asset2)
Definition: View.cpp:375
majorityAmendments_t getMajorityAmendments(ReadView const &view)
Definition: View.cpp:937
LedgerEntryType
Identifiers for on-ledger objects.
Definition: LedgerFormats.h:54
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.
Definition: View.cpp:683
MPTAuthType
Definition: View.h:732
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition: View.cpp:2984
STAmount assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
Definition: View.cpp:2702
TER cleanupOnAccountDelete(ApplyView &view, Keylet const &ownerDirKeylet, EntryDeleter const &deleter, beast::Journal j, std::optional< uint16_t > maxNodesToDelete)
Definition: View.cpp:2529
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.
Definition: View.cpp:655
Number root(Number f, unsigned d)
Definition: Number.cpp:636
STAmount assetsToSharesDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
Definition: View.cpp:2684
bool hasExpired(ReadView const &view, std::optional< std::uint32_t > const &exp)
Determines whether the given expiration time has passed.
Definition: View.cpp:175
TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
Definition: View.cpp:2656
bool isAnyFrozen(ReadView const &view, std::initializer_list< AccountID > const &accounts, MPTIssue const &mptIssue, int depth)
Definition: View.cpp:284
TERSubset< CanCvtToTER > TER
Definition: TER.h:645
TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
Definition: View.cpp:1346
bool areCompatible(ReadView const &validLedger, ReadView const &testLedger, beast::Journal::Stream &s, char const *reason)
Return false if the test ledger is provably incompatible with the valid ledger, that is,...
Definition: View.cpp:798
bool dirIsEmpty(ReadView const &view, Keylet const &k)
Returns true if the directory is empty.
Definition: View.cpp:906
bool isPseudoAccount(std::shared_ptr< SLE const > sleAcct)
Definition: View.cpp:1140
TER accountSend(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee)
Calls static accountSendIOU if saAmount represents Issue.
Definition: View.cpp:2011
TER dirLink(ApplyView &view, AccountID const &owner, std::shared_ptr< SLE > &object)
Definition: View.cpp:1057
XRPAmount xrpLiquid(ReadView const &view, AccountID const &id, std::int32_t ownerCountAdj, beast::Journal j)
Definition: View.cpp:617
bool isGlobalFrozen(ReadView const &view, AccountID const &issuer)
Definition: View.cpp:184
A pair of SHAMap key and LedgerEntryType.
Definition: Keylet.h:39
T visit(T... args)