20#include <xrpld/app/misc/AMMHelpers.h>
21#include <xrpld/app/misc/AMMUtils.h>
22#include <xrpld/app/misc/CredentialHelpers.h>
23#include <xrpld/app/tx/detail/InvariantCheck.h>
24#include <xrpld/app/tx/detail/NFTokenUtils.h>
25#include <xrpld/app/tx/detail/PermissionedDomainSet.h>
26#include <xrpld/ledger/ReadView.h>
27#include <xrpld/ledger/View.h>
29#include <xrpl/basics/Log.h>
30#include <xrpl/protocol/Feature.h>
31#include <xrpl/protocol/FeeUnits.h>
32#include <xrpl/protocol/STArray.h>
33#include <xrpl/protocol/SystemParameters.h>
34#include <xrpl/protocol/TxFormats.h>
35#include <xrpl/protocol/nftPageMask.h>
59 JLOG(j.
fatal()) <<
"Invariant failed: fee paid was negative: "
68 JLOG(j.
fatal()) <<
"Invariant failed: fee paid exceeds system limit: "
77 JLOG(j.
fatal()) <<
"Invariant failed: fee paid is " << fee.
drops()
78 <<
" exceeds fee specified in transaction.";
102 switch (before->getType())
105 drops_ -= (*before)[sfBalance].xrp().drops();
109 ((*before)[sfAmount] - (*before)[sfBalance]).xrp().drops();
112 if (
isXRP((*before)[sfAmount]))
113 drops_ -= (*before)[sfAmount].xrp().drops();
122 switch (
after->getType())
125 drops_ += (*after)[sfBalance].xrp().drops();
129 drops_ += ((*after)[sfAmount] - (*after)[sfBalance])
135 drops_ += (*after)[sfAmount].xrp().drops();
155 JLOG(j.
fatal()) <<
"Invariant failed: XRP net change was positive: "
163 JLOG(j.
fatal()) <<
"Invariant failed: XRP net change of " <<
drops_
164 <<
" doesn't match fee " << fee.
drops();
179 auto isBad = [](
STAmount const& balance) {
180 if (!balance.native())
183 auto const drops = balance.xrp();
197 if (before && before->getType() == ltACCOUNT_ROOT)
198 bad_ |= isBad((*before)[sfBalance]);
200 if (
after &&
after->getType() == ltACCOUNT_ROOT)
214 JLOG(j.
fatal()) <<
"Invariant failed: incorrect account XRP balance";
231 if (pays < beast::zero)
234 if (gets < beast::zero)
238 return pays.
native() && gets.native();
241 if (before && before->getType() == ltOFFER)
242 bad_ |= isBad((*before)[sfTakerPays], (*before)[sfTakerGets]);
245 bad_ |= isBad((*
after)[sfTakerPays], (*after)[sfTakerGets]);
258 JLOG(j.
fatal()) <<
"Invariant failed: offer with a bad amount";
273 auto isBad = [](
STAmount const& amount) {
286 if (amount.holds<
Issue>())
288 if (amount <= beast::zero)
298 if (amount <= beast::zero)
308 if (before && before->getType() == ltESCROW)
309 bad_ |= isBad((*before)[sfAmount]);
319 if (
after &&
after->getType() == ltMPTOKEN_ISSUANCE)
321 auto const outstanding = (*after)[sfOutstandingAmount];
322 checkAmount(outstanding);
323 if (
auto const locked = (*
after)[~sfLockedAmount])
325 checkAmount(*locked);
326 bad_ = outstanding < *locked;
332 auto const mptAmount = (*after)[sfMPTAmount];
333 checkAmount(mptAmount);
334 if (
auto const locked = (*
after)[~sfLockedAmount])
336 checkAmount(*locked);
351 JLOG(j.
fatal()) <<
"Invariant failed: escrow specifies invalid amount";
366 if (isDelete && before && before->getType() == ltACCOUNT_ROOT)
391 JLOG(j.
fatal()) <<
"Invariant failed: account deletion "
392 "succeeded without deleting an account";
394 JLOG(j.
fatal()) <<
"Invariant failed: account deletion "
395 "succeeded but deleted multiple accounts!";
410 JLOG(j.
fatal()) <<
"Invariant failed: an account root was deleted";
422 if (isDelete && before && before->getType() == ltACCOUNT_ROOT)
438 [[maybe_unused]]
bool const enforce =
441 auto const objectExists = [&view, enforce, &j](
auto const& keylet) {
443 if (
auto const sle = view.
read(keylet))
446 auto const typeName = [&sle]() {
451 return item->getName();
456 <<
"Invariant failed: account deletion left behind a "
457 << typeName <<
" object";
460 "ripple::AccountRootsDeletedClean::finalize::objectExists : "
461 "account deletion left no objects behind");
469 auto const accountID = accountSLE->getAccountID(sfAccount);
473 if (objectExists(
std::invoke(keyletfunc, accountID)) && enforce)
488 if (key && objectExists(
Keylet{ltNFTOKEN_PAGE, *key}) && enforce)
493 if (
auto const ammKey = accountSLE->at(~sfAMMID))
511 if (before &&
after && before->getType() !=
after->getType())
516 switch (
after->getType())
525 case ltLEDGER_HASHES:
531 case ltDEPOSIT_PREAUTH:
534 case ltNFTOKEN_OFFER:
537 case ltXCHAIN_OWNED_CLAIM_ID:
538 case ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID:
541 case ltMPTOKEN_ISSUANCE:
544 case ltPERMISSIONED_DOMAIN:
567 JLOG(j.
fatal()) <<
"Invariant failed: ledger entry type mismatch";
572 JLOG(j.
fatal()) <<
"Invariant failed: invalid ledger entry type added";
586 if (
after &&
after->getType() == ltRIPPLE_STATE)
608 JLOG(j.
fatal()) <<
"Invariant failed: an XRP trust line was created";
620 if (
after &&
after->getType() == ltRIPPLE_STATE)
630 (lowDeepFreeze && !lowFreeze) || (highDeepFreeze && !highFreeze);
645 JLOG(j.
fatal()) <<
"Invariant failed: a trust line with deep freeze flag "
646 "without normal freeze was created";
674 if (balanceChange.signum() == 0)
706 [[maybe_unused]]
bool const enforce =
711 auto const issuerSle =
findIssuer(issue.account, view);
718 "ripple::TransfersNotFrozen::finalize : enforce "
743 after,
"ripple::TransfersNotFrozen::isValidEntry : valid after.");
749 if (
after->getType() == ltACCOUNT_ROOT)
761 return after->getType() == ltRIPPLE_STATE &&
762 (!before || before->getType() == ltRIPPLE_STATE);
771 auto const getBalance = [](
auto const& line,
auto const& other,
bool zero) {
773 line ? line->at(sfBalance) : other->at(sfBalance).zeroed();
774 return zero ? amt.
zeroed() : amt;
782 auto const balanceBefore = getBalance(before,
after,
false);
789 auto const balanceAfter = getBalance(
after, before, isDelete);
791 return balanceAfter - balanceBefore;
799 "ripple::TransfersNotFrozen::recordBalance : valid trustline "
803 changes.senders.emplace_back(std::move(change));
805 changes.receivers.emplace_back(std::move(change));
813 auto const balanceChangeSign = balanceChange.
signum();
814 auto const currency =
after->at(sfBalance).getCurrency();
818 {currency,
after->at(sfHighLimit).getIssuer()},
819 {
after, balanceChangeSign});
823 {currency,
after->at(sfLowLimit).getIssuer()},
824 {
after, -balanceChangeSign});
866 for (
auto const& change : actors)
868 bool const high = change.line->at(sfLowLimit).getIssuer() ==
869 issuer->at(sfAccount);
872 change, high, tx, j, enforce, globalFreeze))
892 bool const deepFreeze =
894 bool const frozen = globalFreeze || deepFreeze || freeze;
904 if ((!isAMMLine || globalFreeze) && tx.
getTxnType() == ttAMM_CLAWBACK)
906 JLOG(j.
debug()) <<
"Invariant check allowing funds to be moved "
908 <<
" a frozen trustline for AMMClawback "
913 JLOG(j.
fatal()) <<
"Invariant failed: Attempting to move frozen funds for "
917 "ripple::TransfersNotFrozen::validateFrozenState : enforce "
936 if (!before &&
after->getType() == ltACCOUNT_ROOT)
958 JLOG(j.
fatal()) <<
"Invariant failed: multiple accounts "
959 "created in a single transaction";
966 tx.
getTxnType() == ttXCHAIN_ADD_CLAIM_ATTESTATION ||
967 tx.
getTxnType() == ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION) &&
970 bool const pseudoAccount =
973 if (pseudoAccount && tx.
getTxnType() != ttAMM_CREATE &&
976 JLOG(j.
fatal()) <<
"Invariant failed: pseudo-account created by a "
977 "wrong transaction type";
990 JLOG(j.
fatal()) <<
"Invariant failed: account created with "
991 "wrong starting sequence number";
1002 <<
"Invariant failed: pseudo-account created with "
1011 JLOG(j.
fatal()) <<
"Invariant failed: account root created illegally";
1024 static constexpr uint256 const accountBits = ~pageBits;
1026 if ((before && before->getType() != ltNFTOKEN_PAGE) ||
1027 (
after &&
after->getType() != ltNFTOKEN_PAGE))
1031 uint256 const account = sle->key() & accountBits;
1032 uint256 const hiLimit = sle->key() & pageBits;
1040 if (account != (*prev & accountBits))
1043 if (hiLimit <= (*prev & pageBits))
1047 if (
auto const next = (*sle)[~sfNextPageMin])
1049 if (account != (*next & accountBits))
1052 if (hiLimit >= (*next & pageBits))
1057 auto const& nftokens = sle->getFieldArray(sfNFTokens);
1060 if (
std::size_t const nftokenCount = nftokens.size();
1061 (!isDelete && nftokenCount == 0) ||
1068 prev ? *prev & pageBits :
uint256(beast::zero);
1072 for (
auto const& obj : nftokens)
1074 uint256 const tokenID = obj[sfNFTokenID];
1081 if (
uint256 const tokenPageBits = tokenID & pageBits;
1082 tokenPageBits < loLimit || tokenPageBits >= hiLimit)
1085 if (
auto uri = obj[~sfURI]; uri && uri->empty())
1099 before->isFieldPresent(sfPreviousPageMin))
1108 if (!isDelete && before &&
after)
1116 before->isFieldPresent(sfNextPageMin) &&
1117 !
after->isFieldPresent(sfNextPageMin))
1134 JLOG(j.
fatal()) <<
"Invariant failed: NFT page is improperly linked.";
1140 JLOG(j.
fatal()) <<
"Invariant failed: NFT found in incorrect page.";
1146 JLOG(j.
fatal()) <<
"Invariant failed: NFTs on page are not sorted.";
1152 JLOG(j.
fatal()) <<
"Invariant failed: NFT contains empty URI.";
1158 JLOG(j.
fatal()) <<
"Invariant failed: NFT page has invalid size.";
1166 JLOG(j.
fatal()) <<
"Invariant failed: Last NFT page deleted with "
1167 "non-empty directory.";
1172 JLOG(j.
fatal()) <<
"Invariant failed: Lost NextMinPage link.";
1187 if (before && before->getType() == ltACCOUNT_ROOT)
1193 if (
after &&
after->getType() == ltACCOUNT_ROOT)
1209 txType != ttNFTOKEN_MINT && txType != ttNFTOKEN_BURN)
1213 JLOG(j.
fatal()) <<
"Invariant failed: the number of minted tokens "
1214 "changed without a mint transaction!";
1220 JLOG(j.
fatal()) <<
"Invariant failed: the number of burned tokens "
1221 "changed without a burn transaction!";
1233 <<
"Invariant failed: successful minting didn't increase "
1234 "the number of minted tokens.";
1240 JLOG(j.
fatal()) <<
"Invariant failed: failed minting changed the "
1241 "number of minted tokens.";
1248 <<
"Invariant failed: minting changed the number of "
1261 <<
"Invariant failed: successful burning didn't increase "
1262 "the number of burned tokens.";
1269 JLOG(j.
fatal()) <<
"Invariant failed: failed burning changed the "
1270 "number of burned tokens.";
1277 <<
"Invariant failed: burning changed the number of "
1294 if (before && before->getType() == ltRIPPLE_STATE)
1297 if (before && before->getType() == ltMPTOKEN)
1317 <<
"Invariant failed: more than one trustline changed.";
1324 <<
"Invariant failed: more than one mptokens changed.";
1336 if (holderBalance.
signum() < 0)
1339 <<
"Invariant failed: trustline balance is negative";
1348 JLOG(j.
fatal()) <<
"Invariant failed: some trustlines were changed "
1349 "despite failure of the transaction.";
1355 JLOG(j.
fatal()) <<
"Invariant failed: some mptokens were changed "
1356 "despite failure of the transaction.";
1372 if (
after &&
after->getType() == ltMPTOKEN_ISSUANCE)
1399 if (tx.
getTxnType() == ttMPTOKEN_ISSUANCE_CREATE ||
1404 JLOG(j.
fatal()) <<
"Invariant failed: transaction "
1405 "succeeded without creating a MPT issuance";
1409 JLOG(j.
fatal()) <<
"Invariant failed: transaction "
1410 "succeeded while removing MPT issuances";
1414 JLOG(j.
fatal()) <<
"Invariant failed: transaction "
1415 "succeeded but created multiple issuances";
1421 if (tx.
getTxnType() == ttMPTOKEN_ISSUANCE_DESTROY ||
1426 JLOG(j.
fatal()) <<
"Invariant failed: MPT issuance deletion "
1427 "succeeded without removing a MPT issuance";
1431 JLOG(j.
fatal()) <<
"Invariant failed: MPT issuance deletion "
1432 "succeeded while creating MPT issuances";
1436 JLOG(j.
fatal()) <<
"Invariant failed: MPT issuance deletion "
1437 "succeeded but deleted multiple issuances";
1443 if (tx.
getTxnType() == ttMPTOKEN_AUTHORIZE ||
1450 JLOG(j.
fatal()) <<
"Invariant failed: MPT authorize "
1451 "succeeded but created MPT issuances";
1456 JLOG(j.
fatal()) <<
"Invariant failed: MPT authorize "
1457 "succeeded but deleted issuances";
1461 submittedByIssuer &&
1465 <<
"Invariant failed: MPT authorize submitted by issuer "
1466 "succeeded but created/deleted mptokens";
1470 !submittedByIssuer && (tx.
getTxnType() != ttVAULT_DEPOSIT) &&
1476 <<
"Invariant failed: MPT authorize submitted by holder "
1477 "succeeded but created/deleted bad number of mptokens";
1484 if (tx.
getTxnType() == ttMPTOKEN_ISSUANCE_SET)
1488 JLOG(j.
fatal()) <<
"Invariant failed: MPT issuance set "
1489 "succeeded while removing MPT issuances";
1493 JLOG(j.
fatal()) <<
"Invariant failed: MPT issuance set "
1494 "succeeded while creating MPT issuances";
1498 JLOG(j.
fatal()) <<
"Invariant failed: MPT issuance set "
1499 "succeeded while removing MPTokens";
1503 JLOG(j.
fatal()) <<
"Invariant failed: MPT issuance set "
1504 "succeeded while creating MPTokens";
1517 JLOG(j.
fatal()) <<
"Invariant failed: a MPT issuance was created";
1521 JLOG(j.
fatal()) <<
"Invariant failed: a MPT issuance was deleted";
1525 JLOG(j.
fatal()) <<
"Invariant failed: a MPToken was created";
1529 JLOG(j.
fatal()) <<
"Invariant failed: a MPToken was deleted";
1544 if (before && before->getType() != ltPERMISSIONED_DOMAIN)
1546 if (
after &&
after->getType() != ltPERMISSIONED_DOMAIN)
1551 auto const& credentials = sle->getFieldArray(sfAcceptedCredentials);
1562 for (
auto const& cred : sorted)
1564 auto const& credTx = credentials[i++];
1565 sleStatus.
isSorted_ = (cred.first == credTx[sfIssuer]) &&
1566 (cred.second == credTx[sfCredentialType]);
1600 JLOG(j.
fatal()) <<
"Invariant failed: permissioned domain with "
1608 JLOG(j.
fatal()) <<
"Invariant failed: permissioned domain bad "
1617 <<
"Invariant failed: permissioned domain credentials "
1625 <<
"Invariant failed: permissioned domain credentials "
1645 if (
after->isFieldPresent(sfDomainID))
1651 if (
after->isFieldPresent(sfDomainID))
1659 (!
after->isFieldPresent(sfDomainID) ||
1660 !
after->isFieldPresent(sfAdditionalBooks) ||
1661 after->getFieldArray(sfAdditionalBooks).size() > 1))
1675 if ((txType != ttPAYMENT && txType != ttOFFER_CREATE) ||
1683 JLOG(j.
fatal()) <<
"Invariant failed: hybrid offer is malformed";
1694 JLOG(j.
fatal()) <<
"Invariant failed: domain doesn't exist";
1704 JLOG(j.
fatal()) <<
"Invariant failed: transaction"
1705 " consumed wrong domains";
1712 JLOG(j.
fatal()) <<
"Invariant failed: domain transaction"
1713 " affected regular offers";
1731 auto const type =
after->getType();
1741 (type == ltACCOUNT_ROOT &&
after->isFieldPresent(sfAMMID)))
1750 if (before->getType() == ltAMM)
1764 bool const positive = amount > beast::zero && amount2 > beast::zero &&
1765 lptAMMBalance > beast::zero;
1768 (amount == beast::zero && amount2 == beast::zero &&
1769 lptAMMBalance == beast::zero);
1780 JLOG(j.
error()) <<
"AMMVote invariant failed: "
1799 JLOG(j.
error()) <<
"AMMBid invariant failed: pool changed";
1832 <<
"AMMCreate invariant failed: AMM object is not created";
1842 tx[sfAmount].get<Issue>(),
1843 tx[sfAmount2].get<Issue>(),
1854 JLOG(j.
error()) <<
"AMMCreate invariant failed: " << amount <<
" "
1871 ?
"AMM object is not deleted on tesSUCCESS"
1872 :
"AMM object is changed on tecINCOMPLETE";
1873 JLOG(j.
error()) <<
"AMMDelete invariant failed: " << msg;
1888 JLOG(j.
error()) <<
"AMM swap invariant failed: AMM object changed";
1907 tx[sfAsset].get<Issue>(),
1908 tx[sfAsset2].get<Issue>(),
1915 auto const poolProductMean =
root2(amount * amount2);
1916 bool const nonNegativeBalances =
1920 auto weakInvariantCheck = [&]() {
1925 if (!nonNegativeBalances ||
1926 (!strongInvariantCheck && !weakInvariantCheck()))
1931 <<
" " << poolProductMean <<
" "
1953 JLOG(j.
error()) <<
"AMMDeposit invariant failed: AMM object is deleted";
2005 case ttAMM_CLAWBACK:
2006 case ttAMM_WITHDRAW:
2015 case ttOFFER_CREATE:
A generic endpoint for log messages.
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
std::vector< std::shared_ptr< SLE const > > accountsDeleted_
std::uint32_t accountsDeleted_
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
A currency issued by an account.
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
std::uint32_t afterMintedTotal
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
std::uint32_t afterBurnedTotal
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
std::uint32_t beforeBurnedTotal
std::uint32_t beforeMintedTotal
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool deepFreezeWithoutFreeze_
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
virtual std::optional< key_type > succ(key_type const &key, std::optional< key_type > const &last=std::nullopt) const =0
Return the key of the next state item.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
LedgerIndex seq() const
Returns the sequence number of the base ledger.
virtual Rules const & rules() const =0
Returns the tx processing rules.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
Currency const & getCurrency() const
int signum() const noexcept
AccountID const & getIssuer() const
bool native() const noexcept
STAmount zeroed() const
Returns a zero value with the same issuer and currency.
AccountID getAccountID(SField const &field) const
STAmount const & getFieldAmount(SField const &field) const
uint256 getHash(HashPrefix prefix) const
bool isFieldPresent(SField const &field) const
uint256 getFieldH256(SField const &field) const
TxType getTxnType() const
uint256 getTransactionID() const
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
std::map< AccountID, std::shared_ptr< SLE const > const > possibleIssuers_
bool isValidEntry(std::shared_ptr< SLE const > const &before, std::shared_ptr< SLE const > const &after)
void recordBalance(Issue const &issue, BalanceChange change)
std::shared_ptr< SLE const > findIssuer(AccountID const &issuerID, ReadView const &view)
bool validateIssuerChanges(std::shared_ptr< SLE const > const &issuer, IssuerChanges const &changes, STTx const &tx, beast::Journal const &j, bool enforce)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
STAmount calculateBalanceChange(std::shared_ptr< SLE const > const &before, std::shared_ptr< SLE const > const &after, bool isDelete)
void recordBalanceChanges(std::shared_ptr< SLE const > const &after, STAmount const &balanceChange)
bool validateFrozenState(BalanceChange const &change, bool high, STTx const &tx, beast::Journal const &j, bool enforce, bool globalFreeze)
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
bool finalizeWithdraw(STTx const &, ReadView const &, bool enforce, beast::Journal const &) const
bool finalizeDEX(bool enforce, beast::Journal const &) const
std::optional< STAmount > lptAMMBalanceAfter_
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool finalizeBid(bool enforce, beast::Journal const &) const
std::optional< AccountID > ammAccount_
bool finalizeDelete(bool enforce, TER res, beast::Journal const &) const
bool finalizeCreate(STTx const &, ReadView const &, bool enforce, beast::Journal const &) const
bool finalizeVote(bool enforce, beast::Journal const &) const
bool finalizeDeposit(STTx const &, ReadView const &, bool enforce, beast::Journal const &) const
bool generalInvariant(STTx const &, ReadView const &, ZeroAllowed zeroAllowed, beast::Journal const &) const
std::optional< STAmount > lptAMMBalanceBefore_
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
std::uint32_t trustlinesChanged
std::uint32_t mptokensChanged
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
std::uint32_t mptIssuancesCreated_
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
std::uint32_t mptokensCreated_
std::uint32_t mptIssuancesDeleted_
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
std::uint32_t mptokensDeleted_
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
std::uint32_t accountsCreated_
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
std::uint32_t accountSeq_
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
hash_set< uint256 > domains_
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
std::optional< SleStatus > sleStatus_[2]
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
constexpr value_type drops() const
Returns the number of drops.
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
std::set< std::pair< AccountID, Slice > > makeSorted(STArray const &credentials)
Keylet permissionedDomain(AccountID const &account, std::uint32_t seq) noexcept
Keylet amm(Asset const &issue1, Asset const &issue2) noexcept
AMM entry.
Keylet account(AccountID const &id) noexcept
AccountID root.
Keylet nftpage_min(AccountID const &owner)
NFT page keylets.
Keylet nftpage_max(AccountID const &owner)
A keylet for the owner's last possible NFT page.
bool compareTokens(uint256 const &a, uint256 const &b)
uint256 constexpr pageMask(std::string_view("0000000000000000000000000000000000000000ffffffffffffffffffffffff"))
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
Currency const & badCurrency()
We deliberately disallow the currency that looks like "XRP" because too many people were using it ins...
bool isXRP(AccountID const &c)
TxType
Transaction type identifiers.
static bool validBalances(STAmount const &amount, STAmount const &amount2, STAmount const &lptAMMBalance, ValidAMM::ZeroAllowed zeroAllowed)
std::size_t constexpr maxPermissionedDomainCredentialsArraySize
The maximum number of credentials can be passed in array for permissioned domain.
std::uint64_t constexpr maxMPTokenAmount
The maximum amount of MPTokenIssuance.
constexpr XRPAmount INITIAL_XRP
Configure the native currency.
std::size_t constexpr dirMaxTokensPerPage
The maximum number of items in an NFT page.
std::array< keyletDesc< AccountID const & >, 6 > const directAccountKeylets
std::pair< STAmount, STAmount > ammPoolHolds(ReadView const &view, AccountID const &ammAccountID, Issue const &issue1, Issue const &issue2, FreezeHandling freezeHandling, beast::Journal const j)
Get AMM pool balances.
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
STAmount ammLPTokens(STAmount const &asset1, STAmount const &asset2, Issue const &lptIssue)
Calculate LP Tokens given AMM pool reserves.
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
@ transactionID
transaction plus signature to give transaction ID
bool withinRelativeDistance(Quality const &calcQuality, Quality const &reqQuality, Number const &dist)
Check if the relative distance between the qualities is within the requested distance.
bool isPseudoAccount(std::shared_ptr< SLE const > sleAcct)
A pair of SHAMap key and LedgerEntryType.
int const balanceChangeSign
std::shared_ptr< SLE const > const line
std::vector< BalanceChange > receivers
std::vector< BalanceChange > senders
std::size_t credentialsSize_