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[[nodiscard]] TER
605 ApplyView& view,
606 XRPAmount const& priorBalance,
607 MPTID const& mptIssuanceID,
608 AccountID const& account,
609 beast::Journal journal,
610 std::uint32_t flags = 0,
611 std::optional<AccountID> holderID = std::nullopt);
612
613// VFALCO NOTE Both STAmount parameters should just
614// be "Amount", a unit-less number.
615//
620[[nodiscard]] TER
622 ApplyView& view,
623 bool const bSrcHigh,
624 AccountID const& uSrcAccountID,
625 AccountID const& uDstAccountID,
626 uint256 const& uIndex, // --> ripple state entry
627 SLE::ref sleAccount, // --> the account being set.
628 bool const bAuth, // --> authorize account.
629 bool const bNoRipple, // --> others cannot ripple through
630 bool const bFreeze, // --> funds cannot leave
631 bool bDeepFreeze, // --> can neither receive nor send funds
632 STAmount const& saBalance, // --> balance of account being set.
633 // Issuer should be noAccount()
634 STAmount const& saLimit, // --> limit for account being set.
635 // Issuer should be the account being set.
636 std::uint32_t uSrcQualityIn,
637 std::uint32_t uSrcQualityOut,
639
640[[nodiscard]] TER
642 ApplyView& view,
643 AccountID const& accountID,
644 Issue const& issue,
645 beast::Journal journal);
646
647[[nodiscard]] TER
649 ApplyView& view,
650 AccountID const& accountID,
651 MPTIssue const& mptIssue,
652 beast::Journal journal);
653
654[[nodiscard]] inline TER
656 ApplyView& view,
657 AccountID const& accountID,
658 Asset const& asset,
659 beast::Journal journal)
660{
661 return std::visit(
662 [&]<ValidIssueType TIss>(TIss const& issue) -> TER {
663 return removeEmptyHolding(view, accountID, issue, journal);
664 },
665 asset.value());
666}
667
668[[nodiscard]] TER
670 ApplyView& view,
671 std::shared_ptr<SLE> const& sleRippleState,
672 AccountID const& uLowAccountID,
673 AccountID const& uHighAccountID,
675
682// [[nodiscard]] // nodiscard commented out so Flow, BookTip and others compile.
683TER
684offerDelete(ApplyView& view, std::shared_ptr<SLE> const& sle, beast::Journal j);
685
686//------------------------------------------------------------------------------
687
688//
689// Money Transfers
690//
691
692// Direct send w/o fees:
693// - Redeeming IOUs and/or sending sender's own IOUs.
694// - Create trust line of needed.
695// --> bCheckIssuer : normally require issuer to be involved.
696// [[nodiscard]] // nodiscard commented out so DirectStep.cpp compiles.
697
701TER
703 ApplyView& view,
704 AccountID const& uSenderID,
705 AccountID const& uReceiverID,
706 STAmount const& saAmount,
707 bool bCheckIssuer,
709
710TER
712 ApplyView& view,
713 AccountID const& uGrantorID,
714 STAmount const& saAmount,
716
717TER
719 ApplyView& view,
720 AccountID const& uGrantorID,
721 AccountID const& uGranteeID,
722 STAmount const& saAmount,
724
728[[nodiscard]] TER
730 ApplyView& view,
731 AccountID const& from,
732 AccountID const& to,
733 STAmount const& saAmount,
736
737[[nodiscard]] TER
739 ApplyView& view,
740 AccountID const& account,
741 STAmount const& amount,
742 Issue const& issue,
744
745[[nodiscard]] TER
747 ApplyView& view,
748 AccountID const& account,
749 STAmount const& amount,
750 Issue const& issue,
752
753[[nodiscard]] TER
755 ApplyView& view,
756 AccountID const& from,
757 AccountID const& to,
758 STAmount const& amount,
760
761/* Check if MPToken (for MPT) or trust line (for IOU) exists:
762 * - StrongAuth - before checking if authorization is required
763 * - WeakAuth
764 * for MPT - after checking lsfMPTRequireAuth flag
765 * for IOU - do not check if trust line exists
766 * - Legacy
767 * for MPT - before checking lsfMPTRequireAuth flag i.e. same as StrongAuth
768 * for IOU - do not check if trust line exists i.e. same as WeakAuth
769 */
771
789[[nodiscard]] TER
791 ReadView const& view,
792 Issue const& issue,
793 AccountID const& account,
794 AuthType authType = AuthType::Legacy);
795
818[[nodiscard]] TER
820 ReadView const& view,
821 MPTIssue const& mptIssue,
822 AccountID const& account,
823 AuthType authType = AuthType::Legacy,
824 int depth = 0);
825
826[[nodiscard]] TER inline requireAuth(
827 ReadView const& view,
828 Asset const& asset,
829 AccountID const& account,
830 AuthType authType = AuthType::Legacy)
831{
832 return std::visit(
833 [&]<ValidIssueType TIss>(TIss const& issue_) {
834 return requireAuth(view, issue_, account, authType);
835 },
836 asset.value());
837}
838
862[[nodiscard]] TER
864 ApplyView& view,
865 MPTID const& mptIssuanceID,
866 AccountID const& account,
867 XRPAmount const& priorBalance,
869
874[[nodiscard]] TER
876 ReadView const& view,
877 MPTIssue const& mptIssue,
878 AccountID const& from,
879 AccountID const& to);
880
887 uint256 const&,
896[[nodiscard]] TER
898 ApplyView& view,
899 Keylet const& ownerDirKeylet,
900 EntryDeleter const& deleter,
902 std::optional<std::uint16_t> maxNodesToDelete = std::nullopt);
903
908[[nodiscard]] TER
910 ApplyView& view,
911 std::shared_ptr<SLE> sleState,
912 std::optional<AccountID> const& ammAccountID,
914
915// From the perspective of a vault,
916// return the number of shares to give the depositor
917// when they deposit a fixed amount of assets.
918[[nodiscard]] STAmount
920 std::shared_ptr<SLE const> const& vault,
921 std::shared_ptr<SLE const> const& issuance,
922 STAmount const& assets);
923
924// From the perspective of a vault,
925// return the number of shares to demand from the depositor
926// when they ask to withdraw a fixed amount of assets.
927[[nodiscard]] STAmount
929 std::shared_ptr<SLE const> const& vault,
930 std::shared_ptr<SLE const> const& issuance,
931 STAmount const& assets);
932
933// From the perspective of a vault,
934// return the number of assets to give the depositor
935// when they redeem a fixed amount of shares.
936[[nodiscard]] STAmount
938 std::shared_ptr<SLE const> const& vault,
939 std::shared_ptr<SLE const> const& issuance,
940 STAmount const& shares);
941
948bool
950
951} // namespace ripple
952
953#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:2853
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:1094
std::uint32_t LedgerIndex
A ledger index.
Definition: Protocol.h:129
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:552
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType)
Check if the account lacks required authorization.
Definition: View.cpp:2404
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:146
STAmount sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
Definition: View.cpp:2834
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:214
TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
Definition: View.cpp:2720
bool dirFirst(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
Definition: View.cpp:124
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:135
bool isDeepFrozen(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer)
Definition: View.cpp:348
std::optional< uint256 > hashOfSeq(ReadView const &ledger, LedgerIndex seq, beast::Journal journal)
Return the hash of a ledger by sequence.
Definition: View.cpp:959
Rate transferRate(ReadView const &view, AccountID const &issuer)
Returns IOU issuer transfer fee as Rate.
Definition: View.cpp:760
TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
Definition: View.cpp:2288
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:770
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:1048
SkipEntry
Definition: View.h:45
TER transferXRP(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &amount, beast::Journal j)
Definition: View.cpp:2361
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:2522
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
Definition: View.cpp:1574
bool isFrozen(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer)
Definition: View.cpp:248
std::set< uint256 > getEnabledAmendments(ReadView const &view)
Definition: View.cpp:919
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:2622
TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags, std::optional< AccountID > holderID)
Definition: View.cpp:1221
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &sender, AccountID const &receiver, STAmount const &amount, beast::Journal j)
Definition: View.cpp:2950
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:308
TER issueIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
Definition: View.cpp:2188
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:157
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:1329
TER trustDelete(ApplyView &view, std::shared_ptr< SLE > const &sleRippleState, AccountID const &uLowAccountID, AccountID const &uHighAccountID, beast::Journal j)
Definition: View.cpp:1534
@ 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:1153
AccountID pseudoAccountAddress(ReadView const &view, uint256 const &pseudoOwnerKey)
Definition: View.cpp:1067
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
Definition: View.cpp:385
bool isLPTokenFrozen(ReadView const &view, AccountID const &account, Issue const &asset, Issue const &asset2)
Definition: View.cpp:374
majorityAmendments_t getMajorityAmendments(ReadView const &view)
Definition: View.cpp:936
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:682
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition: View.cpp:3097
STAmount assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
Definition: View.cpp:2815
TER cleanupOnAccountDelete(ApplyView &view, Keylet const &ownerDirKeylet, EntryDeleter const &deleter, beast::Journal j, std::optional< uint16_t > maxNodesToDelete)
Definition: View.cpp:2642
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:654
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:2797
bool hasExpired(ReadView const &view, std::optional< std::uint32_t > const &exp)
Determines whether the given expiration time has passed.
Definition: View.cpp:174
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:2769
bool isAnyFrozen(ReadView const &view, std::initializer_list< AccountID > const &accounts, MPTIssue const &mptIssue, int depth)
Definition: View.cpp:283
TERSubset< CanCvtToTER > TER
Definition: TER.h:645
TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
Definition: View.cpp:1448
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:797
bool dirIsEmpty(ReadView const &view, Keylet const &k)
Returns true if the directory is empty.
Definition: View.cpp:905
bool isPseudoAccount(std::shared_ptr< SLE const > sleAcct)
Definition: View.cpp:1139
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:2114
TER dirLink(ApplyView &view, AccountID const &owner, std::shared_ptr< SLE > &object)
Definition: View.cpp:1056
XRPAmount xrpLiquid(ReadView const &view, AccountID const &id, std::int32_t ownerCountAdj, beast::Journal j)
Definition: View.cpp:616
bool isGlobalFrozen(ReadView const &view, AccountID const &issuer)
Definition: View.cpp:183
A pair of SHAMap key and LedgerEntryType.
Definition: Keylet.h:39
T visit(T... args)