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]] inline TER
179checkFrozen(ReadView const& view, AccountID const& account, Issue const& issue)
180{
181 return isFrozen(view, account, issue) ? (TER)tecFROZEN : (TER)tesSUCCESS;
182}
183
184[[nodiscard]] inline TER
186 ReadView const& view,
187 AccountID const& account,
188 MPTIssue const& mptIssue)
189{
190 return isFrozen(view, account, mptIssue) ? (TER)tecLOCKED : (TER)tesSUCCESS;
191}
192
193[[nodiscard]] inline TER
194checkFrozen(ReadView const& view, AccountID const& account, Asset const& asset)
195{
196 return std::visit(
197 [&](auto const& issue) { return checkFrozen(view, account, issue); },
198 asset.value());
199}
200
201[[nodiscard]] bool
203 ReadView const& view,
204 std::initializer_list<AccountID> const& accounts,
205 MPTIssue const& mptIssue,
206 int depth = 0);
207
208[[nodiscard]] inline bool
210 ReadView const& view,
211 std::initializer_list<AccountID> const& accounts,
212 Issue const& issue)
213{
214 for (auto const& account : accounts)
215 {
216 if (isFrozen(view, account, issue.currency, issue.account))
217 return true;
218 }
219 return false;
220}
221
222[[nodiscard]] inline bool
224 ReadView const& view,
225 std::initializer_list<AccountID> const& accounts,
226 Asset const& asset,
227 int depth = 0)
228{
229 return std::visit(
230 [&]<ValidIssueType TIss>(TIss const& issue) {
231 if constexpr (std::is_same_v<TIss, Issue>)
232 return isAnyFrozen(view, accounts, issue);
233 else
234 return isAnyFrozen(view, accounts, issue, depth);
235 },
236 asset.value());
237}
238
239[[nodiscard]] bool
241 ReadView const& view,
242 AccountID const& account,
243 Currency const& currency,
244 AccountID const& issuer);
245
246[[nodiscard]] bool
248 ReadView const& view,
249 AccountID const& account,
250 Issue const& asset,
251 Issue const& asset2);
252
253// Returns the amount an account can spend without going into debt.
254//
255// <-- saAmount: amount of currency held by account. May be negative.
256[[nodiscard]] STAmount
258 ReadView const& view,
259 AccountID const& account,
260 Currency const& currency,
261 AccountID const& issuer,
262 FreezeHandling zeroIfFrozen,
264
265[[nodiscard]] STAmount
267 ReadView const& view,
268 AccountID const& account,
269 Issue const& issue,
270 FreezeHandling zeroIfFrozen,
272
273[[nodiscard]] STAmount
275 ReadView const& view,
276 AccountID const& account,
277 MPTIssue const& mptIssue,
278 FreezeHandling zeroIfFrozen,
279 AuthHandling zeroIfUnauthorized,
281
282[[nodiscard]] STAmount
284 ReadView const& view,
285 AccountID const& account,
286 Asset const& asset,
287 FreezeHandling zeroIfFrozen,
288 AuthHandling zeroIfUnauthorized,
290
291// Returns the amount an account can spend of the currency type saDefault, or
292// returns saDefault if this account is the issuer of the currency in
293// question. Should be used in favor of accountHolds when questioning how much
294// an account can spend while also allowing currency issuers to spend
295// unlimited amounts of their own currency (since they can always issue more).
296[[nodiscard]] STAmount
298 ReadView const& view,
299 AccountID const& id,
300 STAmount const& saDefault,
301 FreezeHandling freezeHandling,
303
304// Return the account's liquid (not reserved) XRP. Generally prefer
305// calling accountHolds() over this interface. However, this interface
306// allows the caller to temporarily adjust the owner count should that be
307// necessary.
308//
309// @param ownerCountAdj positive to add to count, negative to reduce count.
310[[nodiscard]] XRPAmount
312 ReadView const& view,
313 AccountID const& id,
314 std::int32_t ownerCountAdj,
316
318void
320 ReadView const& view,
321 Keylet const& root,
322 std::function<void(std::shared_ptr<SLE const> const&)> const& f);
323
330bool
332 ReadView const& view,
333 Keylet const& root,
334 uint256 const& after,
335 std::uint64_t const hint,
336 unsigned int limit,
337 std::function<bool(std::shared_ptr<SLE const> const&)> const& f);
338
340inline void
342 ReadView const& view,
343 AccountID const& id,
344 std::function<void(std::shared_ptr<SLE const> const&)> const& f)
345{
346 return forEachItem(view, keylet::ownerDir(id), f);
347}
348
355inline bool
357 ReadView const& view,
358 AccountID const& id,
359 uint256 const& after,
360 std::uint64_t const hint,
361 unsigned int limit,
362 std::function<bool(std::shared_ptr<SLE const> const&)> const& f)
363{
364 return forEachItemAfter(view, keylet::ownerDir(id), after, hint, limit, f);
365}
366
372[[nodiscard]] Rate
373transferRate(ReadView const& view, AccountID const& issuer);
374
380[[nodiscard]] Rate
381transferRate(ReadView const& view, MPTID const& issuanceID);
382
387[[nodiscard]] Rate
388transferRate(ReadView const& view, STAmount const& amount);
389
393[[nodiscard]] bool
394dirIsEmpty(ReadView const& view, Keylet const& k);
395
396// Return the list of enabled amendments
397[[nodiscard]] std::set<uint256>
398getEnabledAmendments(ReadView const& view);
399
400// Return a map of amendments that have achieved majority
402[[nodiscard]] majorityAmendments_t
404
414[[nodiscard]] std::optional<uint256>
415hashOfSeq(ReadView const& ledger, LedgerIndex seq, beast::Journal journal);
416
429inline LedgerIndex
431{
432 return (requested + 255) & (~255);
433}
434
440[[nodiscard]] bool
442 ReadView const& validLedger,
443 ReadView const& testLedger,
445 char const* reason);
446
447[[nodiscard]] bool
449 uint256 const& validHash,
450 LedgerIndex validIndex,
451 ReadView const& testLedger,
453 char const* reason);
454
455//------------------------------------------------------------------------------
456//
457// Modifiers
458//
459//------------------------------------------------------------------------------
460
462void
464 ApplyView& view,
465 std::shared_ptr<SLE> const& sle,
466 std::int32_t amount,
468
484bool
486 ReadView const& view,
487 uint256 const& root,
489 unsigned int& index,
490 uint256& entry);
491
492bool
494 ApplyView& view,
495 uint256 const& root,
497 unsigned int& index,
498 uint256& entry);
516bool
518 ReadView const& view,
519 uint256 const& root,
521 unsigned int& index,
522 uint256& entry);
523
524bool
525dirNext(
526 ApplyView& view,
527 uint256 const& root,
529 unsigned int& index,
530 uint256& entry);
533[[nodiscard]] std::function<void(SLE::ref)>
534describeOwnerDir(AccountID const& account);
535
536[[nodiscard]] TER
537dirLink(ApplyView& view, AccountID const& owner, std::shared_ptr<SLE>& object);
538
540pseudoAccountAddress(ReadView const& view, uint256 const& pseudoOwnerKey);
541
550[[nodiscard]] Expected<std::shared_ptr<SLE>, TER>
552 ApplyView& view,
553 uint256 const& pseudoOwnerKey,
554 SField const& ownerField);
555
556// Returns true iff sleAcct is a pseudo-account.
557//
558// Returns false if sleAcct is
559// * NOT a pseudo-account OR
560// * NOT a ltACCOUNT_ROOT OR
561// * null pointer
562[[nodiscard]] bool
564
565[[nodiscard]] inline bool
566isPseudoAccount(ReadView const& view, AccountID accountId)
567{
568 return isPseudoAccount(view.read(keylet::account(accountId)));
569}
570
571[[nodiscard]] TER
573 ApplyView& view,
574 AccountID const& accountID,
575 XRPAmount priorBalance,
576 Issue const& issue,
577 beast::Journal journal);
578
579[[nodiscard]] TER
581 ApplyView& view,
582 AccountID const& accountID,
583 XRPAmount priorBalance,
584 MPTIssue const& mptIssue,
585 beast::Journal journal);
586
587[[nodiscard]] inline TER
589 ApplyView& view,
590 AccountID const& accountID,
591 XRPAmount priorBalance,
592 Asset const& asset,
593 beast::Journal journal)
594{
595 return std::visit(
596 [&]<ValidIssueType TIss>(TIss const& issue) -> TER {
597 return addEmptyHolding(
598 view, accountID, priorBalance, issue, journal);
599 },
600 asset.value());
601}
602
603// VFALCO NOTE Both STAmount parameters should just
604// be "Amount", a unit-less number.
605//
610[[nodiscard]] TER
612 ApplyView& view,
613 bool const bSrcHigh,
614 AccountID const& uSrcAccountID,
615 AccountID const& uDstAccountID,
616 uint256 const& uIndex, // --> ripple state entry
617 SLE::ref sleAccount, // --> the account being set.
618 bool const bAuth, // --> authorize account.
619 bool const bNoRipple, // --> others cannot ripple through
620 bool const bFreeze, // --> funds cannot leave
621 bool bDeepFreeze, // --> can neither receive nor send funds
622 STAmount const& saBalance, // --> balance of account being set.
623 // Issuer should be noAccount()
624 STAmount const& saLimit, // --> limit for account being set.
625 // Issuer should be the account being set.
626 std::uint32_t uSrcQualityIn,
627 std::uint32_t uSrcQualityOut,
629
630[[nodiscard]] TER
632 ApplyView& view,
633 AccountID const& accountID,
634 Issue const& issue,
635 beast::Journal journal);
636
637[[nodiscard]] TER
639 ApplyView& view,
640 AccountID const& accountID,
641 MPTIssue const& mptIssue,
642 beast::Journal journal);
643
644[[nodiscard]] inline TER
646 ApplyView& view,
647 AccountID const& accountID,
648 Asset const& asset,
649 beast::Journal journal)
650{
651 return std::visit(
652 [&]<ValidIssueType TIss>(TIss const& issue) -> TER {
653 return removeEmptyHolding(view, accountID, issue, journal);
654 },
655 asset.value());
656}
657
658[[nodiscard]] TER
660 ApplyView& view,
661 std::shared_ptr<SLE> const& sleRippleState,
662 AccountID const& uLowAccountID,
663 AccountID const& uHighAccountID,
665
672// [[nodiscard]] // nodiscard commented out so Flow, BookTip and others compile.
673TER
674offerDelete(ApplyView& view, std::shared_ptr<SLE> const& sle, beast::Journal j);
675
676//------------------------------------------------------------------------------
677
678//
679// Money Transfers
680//
681
682// Direct send w/o fees:
683// - Redeeming IOUs and/or sending sender's own IOUs.
684// - Create trust line of needed.
685// --> bCheckIssuer : normally require issuer to be involved.
686// [[nodiscard]] // nodiscard commented out so DirectStep.cpp compiles.
687
691TER
693 ApplyView& view,
694 AccountID const& uSenderID,
695 AccountID const& uReceiverID,
696 STAmount const& saAmount,
697 bool bCheckIssuer,
699
700TER
702 ApplyView& view,
703 AccountID const& uGrantorID,
704 STAmount const& saAmount,
706
707TER
709 ApplyView& view,
710 AccountID const& uGrantorID,
711 AccountID const& uGranteeID,
712 STAmount const& saAmount,
714
718[[nodiscard]] TER
720 ApplyView& view,
721 AccountID const& from,
722 AccountID const& to,
723 STAmount const& saAmount,
726
727[[nodiscard]] TER
729 ApplyView& view,
730 AccountID const& account,
731 STAmount const& amount,
732 Issue const& issue,
734
735[[nodiscard]] TER
737 ApplyView& view,
738 AccountID const& account,
739 STAmount const& amount,
740 Issue const& issue,
742
743[[nodiscard]] TER
745 ApplyView& view,
746 AccountID const& from,
747 AccountID const& to,
748 STAmount const& amount,
750
751/* Check if MPToken (for MPT) or trust line (for IOU) exists:
752 * - StrongAuth - before checking if authorization is required
753 * - WeakAuth
754 * for MPT - after checking lsfMPTRequireAuth flag
755 * for IOU - do not check if trust line exists
756 * - Legacy
757 * for MPT - before checking lsfMPTRequireAuth flag i.e. same as StrongAuth
758 * for IOU - do not check if trust line exists i.e. same as WeakAuth
759 */
761
779[[nodiscard]] TER
781 ReadView const& view,
782 Issue const& issue,
783 AccountID const& account,
784 AuthType authType = AuthType::Legacy);
785
808[[nodiscard]] TER
810 ReadView const& view,
811 MPTIssue const& mptIssue,
812 AccountID const& account,
813 AuthType authType = AuthType::Legacy,
814 int depth = 0);
815
816[[nodiscard]] TER inline requireAuth(
817 ReadView const& view,
818 Asset const& asset,
819 AccountID const& account,
820 AuthType authType = AuthType::Legacy)
821{
822 return std::visit(
823 [&]<ValidIssueType TIss>(TIss const& issue_) {
824 return requireAuth(view, issue_, account, authType);
825 },
826 asset.value());
827}
828
852[[nodiscard]] TER
854 ApplyView& view,
855 MPTID const& mptIssuanceID,
856 AccountID const& account,
857 XRPAmount const& priorBalance,
859
864[[nodiscard]] TER
866 ReadView const& view,
867 MPTIssue const& mptIssue,
868 AccountID const& from,
869 AccountID const& to);
870
877 uint256 const&,
886[[nodiscard]] TER
888 ApplyView& view,
889 Keylet const& ownerDirKeylet,
890 EntryDeleter const& deleter,
892 std::optional<std::uint16_t> maxNodesToDelete = std::nullopt);
893
898[[nodiscard]] TER
900 ApplyView& view,
901 std::shared_ptr<SLE> sleState,
902 std::optional<AccountID> const& ammAccountID,
904
905// From the perspective of a vault,
906// return the number of shares to give the depositor
907// when they deposit a fixed amount of assets.
908[[nodiscard]] STAmount
910 std::shared_ptr<SLE const> const& vault,
911 std::shared_ptr<SLE const> const& issuance,
912 STAmount const& assets);
913
914// From the perspective of a vault,
915// return the number of shares to demand from the depositor
916// when they ask to withdraw a fixed amount of assets.
917[[nodiscard]] STAmount
919 std::shared_ptr<SLE const> const& vault,
920 std::shared_ptr<SLE const> const& issuance,
921 STAmount const& assets);
922
923// From the perspective of a vault,
924// return the number of assets to give the depositor
925// when they redeem a fixed amount of shares.
926[[nodiscard]] STAmount
928 std::shared_ptr<SLE const> const& vault,
929 std::shared_ptr<SLE const> const& issuance,
930 STAmount const& shares);
931
938bool
940
941} // namespace ripple
942
943#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:33
AccountID account
Definition: Issue.h:36
Currency currency
Definition: Issue.h:35
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:25
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition: AccountID.h:48
TER rippleLockEscrowMPT(ApplyView &view, AccountID const &sender, STAmount const &amount, beast::Journal j)
Definition: View.cpp:2753
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
TER checkFrozen(ReadView const &view, AccountID const &account, Issue const &issue)
Definition: View.h:179
STAmount accountFunds(ReadView const &view, AccountID const &id, STAmount const &saDefault, FreezeHandling freezeHandling, beast::Journal j)
Definition: View.cpp:553
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType)
Check if the account lacks required authorization.
Definition: View.cpp:2301
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:2734
LedgerIndex getCandidateLedger(LedgerIndex requested)
Find a ledger index from which we could easily get the requested ledger.
Definition: View.h:430
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:2620
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
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
AuthType
Definition: View.h:760
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:2419
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:2522
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &sender, AccountID const &receiver, STAmount const &amount, beast::Journal j)
Definition: View.cpp:2850
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
@ tecFROZEN
Definition: TER.h:303
@ tecLOCKED
Definition: TER.h:358
@ tesSUCCESS
Definition: TER.h:244
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
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition: View.cpp:2997
STAmount assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
Definition: View.cpp:2715
TER cleanupOnAccountDelete(ApplyView &view, Keylet const &ownerDirKeylet, EntryDeleter const &deleter, beast::Journal j, std::optional< uint16_t > maxNodesToDelete)
Definition: View.cpp:2542
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:2697
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:2669
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)