1#include <test/jtx/AMM.h>
2#include <test/jtx/AMMTest.h>
3#include <test/jtx/Account.h>
4#include <test/jtx/Env.h>
5#include <test/jtx/TestHelpers.h>
6#include <test/jtx/amount.h>
7#include <test/jtx/balance.h>
8#include <test/jtx/credentials.h>
9#include <test/jtx/domain.h>
10#include <test/jtx/fee.h>
11#include <test/jtx/jtx_json.h>
12#include <test/jtx/ledgerStateFix.h>
13#include <test/jtx/offer.h>
14#include <test/jtx/owners.h>
15#include <test/jtx/paths.h>
16#include <test/jtx/pay.h>
17#include <test/jtx/permissioned_dex.h>
18#include <test/jtx/permissioned_domains.h>
19#include <test/jtx/sendmax.h>
20#include <test/jtx/ter.h>
21#include <test/jtx/trust.h>
22#include <test/jtx/txflags.h>
24#include <xrpl/basics/Slice.h>
25#include <xrpl/basics/base_uint.h>
26#include <xrpl/beast/unit_test/suite.h>
27#include <xrpl/beast/utility/Journal.h>
28#include <xrpl/ledger/OpenView.h>
29#include <xrpl/protocol/Book.h>
30#include <xrpl/protocol/Feature.h>
31#include <xrpl/protocol/Indexes.h>
32#include <xrpl/protocol/Issue.h>
33#include <xrpl/protocol/Keylet.h>
34#include <xrpl/protocol/LedgerFormats.h>
35#include <xrpl/protocol/SField.h>
36#include <xrpl/protocol/STAmount.h>
37#include <xrpl/protocol/STArray.h>
38#include <xrpl/protocol/STLedgerEntry.h>
39#include <xrpl/protocol/SeqProxy.h>
40#include <xrpl/protocol/TER.h>
41#include <xrpl/protocol/TxFlags.h>
42#include <xrpl/protocol/jss.h>
61 [[nodiscard]]
static bool
64 return static_cast<bool>(
68 [[nodiscard]]
static bool
75 uint32_t
const flags = 0,
76 bool const domainOffer =
false)
79 uint64_t
const pageIndex,
85 if (domain != (*page)[~sfDomainID])
88 auto const& indexes = page->getFieldV256(sfIndexes);
97 if (sle->getFieldAmount(sfTakerGets) != takerGets)
99 if (sle->getFieldAmount(sfTakerPays) != takerPays)
101 if (sle->getFlags() != flags)
103 if (domainOffer && !sle->isFieldPresent(sfDomainID))
105 if (!domainOffer && sle->isFieldPresent(sfDomainID))
108 sle->getFieldH256(sfBookDirectory),
109 sle->getFieldU64(sfBookNode),
110 (*sle)[~sfDomainID]))
113 if (sle->isFlag(lsfHybrid))
115 if (!sle->isFieldPresent(sfDomainID))
117 if (!sle->isFieldPresent(sfAdditionalBooks))
119 if (sle->getFieldArray(sfAdditionalBooks).size() != 1)
122 auto const& additionalBookDirs = sle->getFieldArray(sfAdditionalBooks);
124 for (
auto const& bookDir : additionalBookDirs)
126 auto const& dirIndex = bookDir.getFieldH256(sfBookDirectory);
127 auto const& dirNode = bookDir.getFieldU64(sfBookNode);
131 if (!offerInDir(dirIndex, dirNode, std::nullopt))
137 if (sle->isFieldPresent(sfAdditionalBooks))
154 return Keylet(ltDIR_NODE, (*sle)[sfBookDirectory]).
key;
159 [[nodiscard]]
static bool
167 auto const page = env.
le(
172 pageIndex = (*page)[~sfIndexNext];
173 dirCnt += (*page)[sfIndexes].size();
175 }
while (pageIndex.
value_or(0) != 0u);
177 return dirCnt == dirSize;
183 bool const fixEnabled = features[fixCleanup3_4_0];
186 << (fixEnabled ?
" (Cleanup3_4_0 enabled)" :
" (Cleanup3_4_0 disabled)");
190 Env env(*
this, features - featurePermissionedDEX);
191 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
207 if (features[fixCleanup3_2_0])
209 Env env(*
this, features);
210 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
219 Env env(*
this, features);
220 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
227 env.
trust(usd(1000), devin);
229 env(
pay(gw, devin, usd(100)));
252 Env env(*
this, features);
253 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
260 env.
trust(usd(1000), devin);
262 env(
pay(gw, devin, usd(100)));
266 uint32_t
const t = env.
current()->header().parentCloseTime.time_since_epoch().count();
267 jv[sfExpiration.jsonName] = t + 20;
283 env(
offer(devin,
XRP(10), usd(10)),
Domain(domainID),
Ter(expectedExpiredCredTer));
289 Env env(*
this, features);
290 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
293 "F10D0CC9A0F9A3CBF585B80BE09A186483668FDBDD39AA7E3370F3649CE134"
303 Env env(*
this, features);
304 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
310 auto const bobOfferSeq{env.
seq(bob)};
314 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), 0,
true));
320 Env env(*
this, features);
321 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
327 auto const bobOfferSeq{env.
seq(bob)};
331 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq, usd(10),
XRP(10), 0,
true));
336 Env env(*
this, features);
337 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
340 auto const bobOfferSeq{env.
seq(bob)};
344 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), 0,
true));
348 env(
offer(carol, usd(10),
XRP(10)));
351 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), 0,
true));
353 auto const aliceOfferSeq{env.
seq(alice)};
357 BEAST_EXPECT(!
offerExists(env, alice, aliceOfferSeq));
364 Env env(*
this, features);
365 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
371 for (
size_t i = 0; i <= 100; i++)
373 auto const bobOfferSeq{env.
seq(bob)};
378 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), 0,
true));
381 for (
auto const offerSeq : offerSeqs)
397 Env env(*
this, features - featurePermissionedDEX);
398 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
401 env(
pay(bob, alice, usd(10)),
422 if (features[fixCleanup3_2_0])
424 Env env(*
this, features);
425 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
428 env(
pay(bob, alice, usd(10)),
438 Env env(*
this, features);
439 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
442 "F10D0CC9A0F9A3CBF585B80BE09A186483668FDBDD39AA7E3370F3649CE134"
445 env(
pay(bob, alice, usd(10)),
455 Env env(*
this, features);
456 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
466 env.
trust(usd(1000), devin);
468 env(
pay(gw, devin, usd(100)));
472 env(
pay(alice, devin, usd(10)),
484 env(
pay(alice, devin, usd(10)),
501 Env env(*
this, features);
502 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
512 env.
trust(usd(1000), devin);
514 env(
pay(gw, devin, usd(100)));
518 env(
pay(devin, alice, usd(10)),
530 env(
pay(devin, alice, usd(10)),
547 Env env(*
this, features);
548 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
574 Env env(*
this, features);
575 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
579 auto const regularOfferSeq{env.
seq(bob)};
582 BEAST_EXPECT(
checkOffer(env, bob, regularOfferSeq,
XRP(10), usd(10)));
585 BEAST_EXPECT(regularDirKey);
587 env, *regularDirKey, 1));
590 env(
pay(alice, carol, usd(10)),
598 auto const domainOfferSeq{env.
seq(bob)};
602 BEAST_EXPECT(
checkOffer(env, bob, domainOfferSeq,
XRP(10), usd(10), 0,
true));
605 BEAST_EXPECT(domainDirKey);
607 env, *domainDirKey, 1));
613 BEAST_EXPECT(!
offerExists(env, bob, domainOfferSeq));
614 BEAST_EXPECT(
checkOffer(env, bob, regularOfferSeq,
XRP(10), usd(10)));
618 env, *domainDirKey, 0));
620 env, *regularDirKey, 1));
625 Env env(*
this, features);
626 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
629 auto const eur = gw[
"EUR"];
630 env.
trust(eur(1000), alice);
632 env.
trust(eur(1000), bob);
634 env.
trust(eur(1000), carol);
636 env(
pay(gw, bob, eur(100)));
640 auto const usdOfferSeq{env.
seq(bob)};
644 BEAST_EXPECT(
checkOffer(env, bob, usdOfferSeq,
XRP(10), usd(10), 0,
true));
647 env(
pay(alice, carol, eur(10)),
653 BEAST_EXPECT(
checkOffer(env, bob, usdOfferSeq,
XRP(10), usd(10), 0,
true));
656 auto const regularOfferSeq{env.
seq(bob)};
657 env(
offer(bob, usd(10), eur(10)));
659 BEAST_EXPECT(
checkOffer(env, bob, regularOfferSeq, usd(10), eur(10)));
663 env(
pay(alice, carol, eur(10)),
671 auto const eurOfferSeq{env.
seq(bob)};
672 env(
offer(bob, usd(10), eur(10)),
Domain(domainID));
674 BEAST_EXPECT(
checkOffer(env, bob, eurOfferSeq, usd(10), eur(10), 0,
true));
680 BEAST_EXPECT(
checkOffer(env, bob, usdOfferSeq,
XRP(5), usd(5), 0,
true));
681 BEAST_EXPECT(
checkOffer(env, bob, eurOfferSeq, usd(5), eur(5), 0,
true));
692 BEAST_EXPECT(
checkOffer(env, bob, regularOfferSeq, usd(10), eur(10)));
697 Env env(*
this, features);
698 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
702 Account const badDomainOwner(
"badDomainOwner");
704 env.
fund(
XRP(1000), badDomainOwner, devin);
706 env.
trust(usd(1000), devin);
708 env(
pay(gw, devin, usd(100)));
711 auto const badCredType =
"badCred";
713 {.issuer = badDomainOwner, .credType = badCredType},
718 auto const badDomainID = objects.begin()->first;
729 env(
pay(alice, carol, usd(10)),
737 auto const bobOfferSeq{env.
seq(bob)};
740 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), 0,
true));
753 Env env(*
this, features);
754 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
779 Env env(*
this, features);
780 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
787 env.
trust(usd(1000), devin);
789 env(
pay(gw, devin, usd(100)));
793 uint32_t
const t = env.
current()->header().parentCloseTime.time_since_epoch().count();
794 jv[sfExpiration.jsonName] = t + 20;
801 auto const offerSeq{env.
seq(devin)};
808 BEAST_EXPECT(
checkOffer(env, devin, offerSeq,
XRP(5), usd(5), 0,
true));
814 env(
pay(alice, carol, usd(5)),
820 BEAST_EXPECT(
checkOffer(env, devin, offerSeq,
XRP(5), usd(5), 0,
true));
825 Env env(*
this, features);
826 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
829 auto const offerSeq{env.
seq(bob)};
836 BEAST_EXPECT(
checkOffer(env, bob, offerSeq,
XRP(5), usd(5), 0,
true));
843 env(
pay(alice, carol, usd(5)),
849 BEAST_EXPECT(
checkOffer(env, bob, offerSeq,
XRP(5), usd(5), 0,
true));
861 Env env(*
this, features);
862 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
865 auto const eura = alice[
"EUR"];
866 auto const eurb = bob[
"EUR"];
868 env.
trust(eura(100), bob);
869 env.
trust(eurb(100), carol);
883 env(
trust(carol, bob[
"EUR"](0), bob, tfSetNoRipple));
895 testcase(
"Offer token issuer in domain");
899 Env env(*
this, features);
900 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
904 auto const bobOffer1Seq{env.
seq(bob)};
909 auto const bobOffer2Seq{env.
seq(bob)};
913 BEAST_EXPECT(
checkOffer(env, bob, bobOffer1Seq,
XRP(10), usd(10), 0,
true));
914 BEAST_EXPECT(
checkOffer(env, bob, bobOffer2Seq, usd(10),
XRP(10), lsfPassive,
true));
924 BEAST_EXPECT(!
offerExists(env, bob, bobOffer1Seq));
930 BEAST_EXPECT(!
offerExists(env, bob, bobOffer2Seq));
940 Env env(*
this, features);
941 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
944 auto const aliceOfferSeq{env.
seq(alice)};
948 auto const bobOfferSeq{env.
seq(bob)};
952 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(20), usd(20), 0,
true));
953 BEAST_EXPECT(
checkOffer(env, alice, aliceOfferSeq,
XRP(100), usd(100), 0,
true));
956 BEAST_EXPECT(domainDirKey);
958 env, *domainDirKey, 2));
967 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), 0,
true));
970 BEAST_EXPECT(!
offerExists(env, alice, aliceOfferSeq));
972 env, *domainDirKey, 1));
980 Env env(*
this, features);
981 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
983 AMM const amm(env, alice,
XRP(10), usd(50));
986 env(
pay(bob, carol, usd(5)),
998 auto [xrp, usdBalance, lpt] =
amm.balances(
XRP, usd);
999 BEAST_EXPECT(usdBalance == usd(45));
1005 bool const excludesAmmFromDomainQuality = features[fixCleanup3_3_0];
1007 testcase <<
"AMM quality not leaked into domain BookStep"
1008 << (excludesAmmFromDomainQuality ?
" (Cleanup3_3_0 enabled)"
1009 :
" (Cleanup3_3_0 disabled)");
1011 Env env(*
this, features);
1012 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1014 auto const eur = gw[
"EUR"];
1016 env.trust(eur(1000), bob, domainOwner);
1018 env(
pay(gw, bob, eur(100)));
1021 env(
pay(gw, alice, usd(500)));
1027 AMM const amm(env, alice,
XRP(10), usd(500));
1029 auto const directOfferSeq{env.seq(bob)};
1033 auto const xrpEurOfferSeq{env.seq(bob)};
1037 auto const eurUsdOfferSeq{env.seq(domainOwner)};
1038 env(
offer(domainOwner, eur(20), usd(20)),
Domain(domainID));
1041 auto const carolBalBefore = env.balance(carol, usd);
1048 env(
pay(alice, carol, usd(100)),
1052 Txflags(tfPartialPayment | tfNoRippleDirect),
1056 auto const delivered = env.balance(carol, usd) - carolBalBefore;
1057 if (excludesAmmFromDomainQuality)
1059 BEAST_EXPECT(delivered == usd(20));
1061 BEAST_EXPECT(
checkOffer(env, bob, directOfferSeq,
XRP(10), usd(10), 0,
true));
1062 BEAST_EXPECT(!
offerExists(env, bob, xrpEurOfferSeq));
1063 BEAST_EXPECT(!
offerExists(env, domainOwner, eurUsdOfferSeq));
1067 BEAST_EXPECT(delivered == usd(10));
1069 BEAST_EXPECT(!
offerExists(env, bob, directOfferSeq));
1070 BEAST_EXPECT(
checkOffer(env, bob, xrpEurOfferSeq,
XRP(10), eur(20), 0,
true));
1071 BEAST_EXPECT(
checkOffer(env, domainOwner, eurUsdOfferSeq, eur(20), usd(20), 0,
true));
1074 auto [xrp, usdBalance, lpt] =
amm.balances(
XRP, usd);
1075 BEAST_EXPECT(xrp ==
XRP(10));
1076 BEAST_EXPECT(usdBalance == usd(500));
1086 Env env(*
this, features - featurePermissionedDEX);
1087 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1107 auto const offerSeq{env.
seq(bob)};
1110 BEAST_EXPECT(
checkOffer(env, bob, offerSeq,
XRP(10), usd(10), lsfHybrid,
true));
1115 Env env(*
this, features);
1116 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1119 auto const bobOfferSeq{env.
seq(bob)};
1123 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), lsfHybrid,
true));
1127 auto const aliceOfferSeq{env.
seq(alice)};
1131 BEAST_EXPECT(!
offerExists(env, alice, aliceOfferSeq));
1132 BEAST_EXPECT(!
offerExists(env, bob, bobOfferSeq));
1138 Env env(*
this, features);
1139 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1142 auto const bobOfferSeq{env.
seq(bob)};
1148 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), lsfHybrid,
true));
1150 auto const aliceOfferSeq{env.
seq(alice)};
1151 env(
offer(alice, usd(10),
XRP(10)));
1154 BEAST_EXPECT(!
offerExists(env, alice, aliceOfferSeq));
1155 BEAST_EXPECT(!
offerExists(env, bob, bobOfferSeq));
1162 Env env(*
this, features);
1163 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1166 auto const bobOfferSeq{env.
seq(bob)};
1170 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), 0,
true));
1174 auto const aliceOfferSeq{env.
seq(alice)};
1178 BEAST_EXPECT(!
offerExists(env, alice, aliceOfferSeq));
1179 BEAST_EXPECT(!
offerExists(env, bob, bobOfferSeq));
1186 Env env(*
this, features);
1187 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1190 auto const bobOfferSeq{env.
seq(bob)};
1194 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), 0,
false));
1198 auto const aliceOfferSeq{env.
seq(alice)};
1202 BEAST_EXPECT(
offerExists(env, alice, aliceOfferSeq));
1204 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), 0,
false));
1205 BEAST_EXPECT(
checkOffer(env, alice, aliceOfferSeq, usd(10),
XRP(10), lsfHybrid,
true));
1218 Env env(*
this, features);
1219 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1222 auto const hybridOfferSeq{env.
seq(bob)};
1232 env(
pay(alice, carol, usd(5)),
1238 BEAST_EXPECT(
checkOffer(env, bob, hybridOfferSeq,
XRP(50), usd(50), lsfHybrid,
true));
1240 if (features[fixCleanup3_3_0])
1244 auto const carolBalBefore = env.
balance(carol, usd);
1247 BEAST_EXPECT(env.
balance(carol, usd) - carolBalBefore == usd(5));
1248 BEAST_EXPECT(
checkOffer(env, bob, hybridOfferSeq,
XRP(45), usd(45), lsfHybrid,
true));
1251 auto const regularOfferSeq{env.
seq(bob)};
1254 BEAST_EXPECT(
checkOffer(env, bob, regularOfferSeq,
XRP(10), usd(10)));
1256 auto const sleHybridOffer =
1258 if (!BEAST_EXPECT(sleHybridOffer))
1260 auto const openDir =
1261 sleHybridOffer->getFieldArray(sfAdditionalBooks)[0].getFieldH256(sfBookDirectory);
1270 BEAST_EXPECT(
checkOffer(env, bob, hybridOfferSeq,
XRP(40), usd(40), lsfHybrid,
true));
1271 BEAST_EXPECT(
checkOffer(env, bob, regularOfferSeq,
XRP(10), usd(10)));
1281 BEAST_EXPECT(
checkOffer(env, bob, hybridOfferSeq,
XRP(50), usd(50), lsfHybrid,
true));
1284 auto const regularOfferSeq{env.
seq(bob)};
1287 BEAST_EXPECT(
offerExists(env, bob, regularOfferSeq));
1288 BEAST_EXPECT(
checkOffer(env, bob, regularOfferSeq,
XRP(10), usd(10)));
1290 auto const sleHybridOffer =
1292 if (!BEAST_EXPECT(sleHybridOffer))
1294 auto const openDir =
1295 sleHybridOffer->getFieldArray(sfAdditionalBooks)[0].getFieldH256(sfBookDirectory);
1304 BEAST_EXPECT(!
offerExists(env, bob, hybridOfferSeq));
1305 BEAST_EXPECT(
checkOffer(env, bob, regularOfferSeq,
XRP(5), usd(5)));
1317 Env env(*
this, features);
1318 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1321 auto const hybridOfferSeq{env.
seq(bob)};
1327 BEAST_EXPECT(
checkOffer(env, bob, hybridOfferSeq,
XRP(5), usd(5), lsfHybrid,
true));
1333 BEAST_EXPECT(!
offerExists(env, bob, hybridOfferSeq));
1339 Env env(*
this, features);
1340 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1344 Account const badDomainOwner(
"badDomainOwner");
1346 env.
fund(
XRP(1000), badDomainOwner, devin);
1349 auto const badCredType =
"badCred";
1351 {.issuer = badDomainOwner, .credType = badCredType},
1356 auto const badDomainID = objects.begin()->first;
1363 auto const hybridOfferSeq{env.
seq(bob)};
1368 env(
pay(devin, badDomainOwner, usd(5)),
1374 BEAST_EXPECT(
checkOffer(env, bob, hybridOfferSeq,
XRP(10), usd(10), lsfHybrid,
true));
1378 BEAST_EXPECT(
checkOffer(env, bob, hybridOfferSeq,
XRP(5), usd(5), lsfHybrid,
true));
1384 BEAST_EXPECT(!
offerExists(env, bob, hybridOfferSeq));
1389 Env env(*
this, features);
1390 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1393 auto const eur = gw[
"EUR"];
1394 env.
trust(eur(1000), alice);
1396 env.
trust(eur(1000), bob);
1398 env.
trust(eur(1000), carol);
1400 env(
pay(gw, bob, eur(100)));
1403 auto const usdOfferSeq{env.
seq(bob)};
1407 BEAST_EXPECT(
checkOffer(env, bob, usdOfferSeq,
XRP(10), usd(10), 0,
true));
1410 env(
pay(alice, carol, eur(5)),
1416 BEAST_EXPECT(
checkOffer(env, bob, usdOfferSeq,
XRP(10), usd(10), 0,
true));
1419 auto const eurOfferSeq{env.
seq(bob)};
1422 BEAST_EXPECT(
checkOffer(env, bob, eurOfferSeq, usd(10), eur(10), lsfHybrid,
true));
1428 BEAST_EXPECT(
checkOffer(env, bob, usdOfferSeq,
XRP(5), usd(5), 0,
true));
1429 BEAST_EXPECT(
checkOffer(env, bob, eurOfferSeq, usd(5), eur(5), lsfHybrid,
true));
1434 Env env(*
this, features);
1435 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1438 auto const eur = gw[
"EUR"];
1439 env.
trust(eur(1000), alice);
1441 env.
trust(eur(1000), bob);
1443 env.
trust(eur(1000), carol);
1445 env(
pay(gw, bob, eur(100)));
1449 auto const usdOfferSeq{env.
seq(bob)};
1453 BEAST_EXPECT(
checkOffer(env, bob, usdOfferSeq,
XRP(10), usd(10), 0,
false));
1456 auto const eurOfferSeq{env.
seq(bob)};
1459 BEAST_EXPECT(
checkOffer(env, bob, eurOfferSeq, usd(10), eur(10), lsfHybrid,
true));
1465 BEAST_EXPECT(
checkOffer(env, bob, usdOfferSeq,
XRP(5), usd(5), 0,
false));
1466 BEAST_EXPECT(
checkOffer(env, bob, eurOfferSeq, usd(5), eur(5), lsfHybrid,
true));
1477 testcase(
"Hybrid open book after credential expiry");
1479 Env env(*
this, features);
1480 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1486 env.
trust(usd(1000), devin);
1488 env(
pay(gw, devin, usd(100)));
1494 uint32_t
const t = env.
current()->header().parentCloseTime.time_since_epoch().count();
1495 jv[sfExpiration.jsonName] = t + 100;
1503 auto const hybridOfferSeq{env.
seq(devin)};
1507 BEAST_EXPECT(
checkOffer(env, devin, hybridOfferSeq,
XRP(10), usd(10), lsfHybrid,
true));
1511 auto carolBalance = env.
balance(carol, usd);
1514 BEAST_EXPECT(env.
balance(carol, usd) - carolBalance == usd(5));
1515 BEAST_EXPECT(
checkOffer(env, devin, hybridOfferSeq,
XRP(5), usd(5), lsfHybrid,
true));
1527 BEAST_EXPECT(
offerExists(env, devin, hybridOfferSeq));
1531 carolBalance = env.
balance(carol, usd);
1536 BEAST_EXPECT(env.
balance(carol, usd) - carolBalance == usd(2));
1538 BEAST_EXPECT(
checkOffer(env, devin, hybridOfferSeq,
XRP(3), usd(3), lsfHybrid,
true));
1543 env(
pay(alice, carol, usd(1)),
1552 BEAST_EXPECT(
checkOffer(env, devin, hybridOfferSeq,
XRP(3), usd(3), lsfHybrid,
true));
1555 carolBalance = env.
balance(carol, usd);
1558 BEAST_EXPECT(env.
balance(carol, usd) - carolBalance == usd(3));
1559 BEAST_EXPECT(!
offerExists(env, devin, hybridOfferSeq));
1565 Env env(*
this, features);
1566 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1578 size_t dirCnt = 100;
1580 for (
size_t i = 1; i <= dirCnt; i++)
1582 auto const bobOfferSeq{env.
seq(bob)};
1587 auto const sleOffer =
1589 BEAST_EXPECT(sleOffer);
1590 BEAST_EXPECT(sleOffer->getFieldH256(sfBookDirectory) == domainDir);
1591 BEAST_EXPECT(sleOffer->getFieldArray(sfAdditionalBooks).size() == 1);
1593 sleOffer->getFieldArray(sfAdditionalBooks)[0].getFieldH256(sfBookDirectory) ==
1596 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), lsfHybrid,
true));
1601 for (
auto const offerSeq : offerSeqs)
1617 Env env(*
this, features);
1618 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1620 auto const eur = gw[
"EUR"];
1622 for (
auto const& account : {alice, bob, carol})
1624 env(
trust(account, eur(10000)));
1628 env(
pay(gw, carol, eur(1)));
1631 auto const aliceOfferSeq{env.
seq(alice)};
1632 auto const bobOfferSeq{env.
seq(bob)};
1639 auto const carolOfferSeq{env.
seq(carol)};
1640 env(
offer(carol, usd(1), eur(1)),
Domain(domainID));
1643 BEAST_EXPECT(!
offerExists(env, bob, aliceOfferSeq));
1644 BEAST_EXPECT(!
offerExists(env, bob, bobOfferSeq));
1645 BEAST_EXPECT(!
offerExists(env, bob, carolOfferSeq));
1651 bool const fixEnabled = features[fixCleanup3_4_0];
1653 testcase <<
"Expired credential cleanup"
1654 << (fixEnabled ?
" (Cleanup3_4_0 enabled)" :
" (Cleanup3_4_0 disabled)");
1658 auto const fundAccount =
1662 env.
trust(usd(1000), account);
1664 env(
pay(gw, account, usd(100)));
1668 auto const fundDevin = [&](
Env& env,
Account const& gw,
IOU const& usd) {
1670 fundAccount(env, devin, gw, usd);
1674 auto const createExpiringCredential = [](
Env& env,
1679 uint32_t
const t = env.
current()->header().parentCloseTime.time_since_epoch().count();
1680 jv[sfExpiration.jsonName] = t + 20;
1688 auto const expectExpiredCredentialState = [&](
Env const& env,
Keylet const& credKey) {
1691 BEAST_EXPECT(!env.
le(credKey));
1695 BEAST_EXPECT(env.
le(credKey));
1701 Env env(*
this, features);
1702 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1706 "F10D0CC9A0F9A3CBF585B80BE09A186483668FDBDD39AA7E3370F3649CE134"
1712 env(
pay(alice, bob, usd(10)),
1722 Env env(*
this, features);
1723 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1726 Account const devin = fundDevin(env, gw, usd);
1727 auto const credKey = createExpiringCredential(env, devin, domainOwner, credType);
1728 BEAST_EXPECT(env.
le(credKey));
1732 env(
offer(devin,
XRP(10), usd(10)),
Domain(domainID),
Ter(expectedExpiredCredTer));
1735 expectExpiredCredentialState(env, credKey);
1740 Env env(*
this, features);
1741 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1744 Account const devin = fundDevin(env, gw, usd);
1745 auto const credKey = createExpiringCredential(env, devin, domainOwner, credType);
1747 auto const bobOfferSeq{env.
seq(bob)};
1748 auto const bobCredKey =
1753 BEAST_EXPECT(env.
le(credKey));
1754 BEAST_EXPECT(env.
le(bobCredKey));
1759 env(
pay(devin, alice, usd(10)),
1763 Ter(expectedExpiredCredTer));
1766 expectExpiredCredentialState(env, credKey);
1767 BEAST_EXPECT(env.
le(bobCredKey));
1773 Env env(*
this, features);
1774 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1777 Account const devin = fundDevin(env, gw, usd);
1778 auto const credKey = createExpiringCredential(env, devin, domainOwner, credType);
1780 auto const bobOfferSeq{env.
seq(bob)};
1781 auto const bobCredKey =
1786 BEAST_EXPECT(env.
le(credKey));
1787 BEAST_EXPECT(env.
le(bobCredKey));
1792 env(
pay(alice, devin, usd(10)),
1796 Ter(expectedExpiredCredTer));
1799 expectExpiredCredentialState(env, credKey);
1800 BEAST_EXPECT(env.
le(bobCredKey));
1806 Env env(*
this, features);
1807 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1810 Account const devin = fundDevin(env, gw, usd);
1812 fundAccount(env, erin, gw, usd);
1814 auto const devinCredKey = createExpiringCredential(env, devin, domainOwner, credType);
1815 auto const erinCredKey = createExpiringCredential(env, erin, domainOwner, credType);
1817 auto const bobOfferSeq{env.
seq(bob)};
1818 auto const bobCredKey =
1823 BEAST_EXPECT(env.
le(devinCredKey));
1824 BEAST_EXPECT(env.
le(erinCredKey));
1825 BEAST_EXPECT(env.
le(bobCredKey));
1830 env(
pay(devin, erin, usd(10)),
1834 Ter(expectedExpiredCredTer));
1837 expectExpiredCredentialState(env, devinCredKey);
1838 expectExpiredCredentialState(env, erinCredKey);
1839 BEAST_EXPECT(env.
le(bobCredKey));
1847 bool const fixEnabled = features[fixCleanup3_1_3];
1849 testcase <<
"Hybrid offer with empty AdditionalBooks"
1850 << (fixEnabled ?
" (fixCleanup3_1_3 enabled)" :
" (fixCleanup3_1_3 disabled)");
1867 Env env(*
this, features);
1868 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1872 auto const bobOfferSeq{env.seq(bob)};
1882 auto const sle = view.
read(offerKey);
1886 replacement->setFieldArray(sfAdditionalBooks,
STArray{});
1895 env(
pay(alice, carol, usd(10)),
1913 bool const fixEnabled = features[fixCleanup3_2_0];
1914 testcase <<
"Hybrid offer crossing quality"
1915 << (fixEnabled ?
" (fixCleanup3_2_0)" :
" (pre-fix)");
1930 Env env(*
this, features);
1931 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
1935 auto const bobOfferSeq{env.seq(bob)};
1944 auto const aliceOfferSeq{env.seq(alice)};
1951 BEAST_EXPECT(sle->isFieldPresent(sfAdditionalBooks));
1952 BEAST_EXPECT(sle->getFieldArray(sfAdditionalBooks).size() == 1);
1954 auto const domainDirKey = sle->getFieldH256(sfBookDirectory);
1955 auto const openDirKey =
1956 sle->getFieldArray(sfAdditionalBooks)[0].getFieldH256(sfBookDirectory);
1958 auto const domainQuality =
getQuality(domainDirKey);
1959 auto const openQuality =
getQuality(openDirKey);
1962 auto const domainDirSle = env.le(
Keylet(ltDIR_NODE, domainDirKey));
1963 auto const openDirSle = env.le(
Keylet(ltDIR_NODE, openDirKey));
1964 BEAST_EXPECT(domainDirSle);
1965 BEAST_EXPECT(openDirSle);
1967 auto const domainExRate = domainDirSle->getFieldU64(sfExchangeRate);
1968 auto const openExRate = openDirSle->getFieldU64(sfExchangeRate);
1969 auto const preCrossingQuality =
std::uint64_t{5623825668291712342ULL};
1970 auto const postCrossingQuality =
std::uint64_t{5623825668291712341ULL};
1974 BEAST_EXPECT(domainQuality == preCrossingQuality);
1975 BEAST_EXPECT(domainExRate == preCrossingQuality);
1976 BEAST_EXPECT(domainExRate == domainQuality);
1981 BEAST_EXPECT(openQuality == preCrossingQuality);
1982 BEAST_EXPECT(domainQuality == openQuality);
1985 BEAST_EXPECT(openExRate == preCrossingQuality);
1986 BEAST_EXPECT(openExRate == openQuality);
1992 BEAST_EXPECT(openQuality == postCrossingQuality);
1993 BEAST_EXPECT(domainQuality != openQuality);
1998 BEAST_EXPECT(openExRate == preCrossingQuality);
1999 BEAST_EXPECT(openExRate != openQuality);
2000 BEAST_EXPECT(openExRate == domainQuality);
2007 testcase(
"LedgerStateFix BookExchangeRate");
2024 Env env(*
this, features - fixCleanup3_2_0);
2036 Env env(*
this, features);
2044 missingBookDirectory.
removeMember(sfBookDirectory.jsonName);
2050 extraOwner[sfOwner.jsonName] = carol.
human();
2055 Env env(*
this, features);
2057 auto const fixFee =
drops(env.
current()->fees().increment);
2071 auto const ownerDirSle = env.
le(ownerDir);
2072 BEAST_EXPECT(ownerDirSle);
2073 BEAST_EXPECT(!ownerDirSle->isFieldPresent(sfExchangeRate));
2083 auto const bobOfferSeq{env.
seq(setup.bob)};
2084 env(
offer(setup.bob,
XRP(100), setup.usd(40)));
2091 auto const dirKey = sle->getFieldH256(sfBookDirectory);
2093 auto const dirSle = env.
le(
Keylet(ltDIR_NODE, dirKey));
2094 BEAST_EXPECT(dirSle);
2095 auto const exchangeRate = dirSle->getFieldU64(sfExchangeRate);
2097 BEAST_EXPECT(exchangeRate == quality);
2109 Env env(*
this, features - fixCleanup3_2_0);
2110 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
2118 auto const aliceOfferSeq{env.
seq(alice)};
2126 auto const openDirKey =
2127 sle->getFieldArray(sfAdditionalBooks)[0].getFieldH256(sfBookDirectory);
2129 auto const preCrossingQuality =
std::uint64_t{5623825668291712342ULL};
2130 auto const postCrossingQuality =
std::uint64_t{5623825668291712341ULL};
2134 auto const dirSle = env.
le(
Keylet(ltDIR_NODE, openDirKey));
2135 BEAST_EXPECT(dirSle);
2136 auto const exchangeRate = dirSle->getFieldU64(sfExchangeRate);
2138 BEAST_EXPECT(exchangeRate == preCrossingQuality);
2139 BEAST_EXPECT(quality == postCrossingQuality);
2140 BEAST_EXPECT(exchangeRate != quality);
2147 auto const fixFee =
drops(env.
current()->fees().increment);
2153 auto const dirSle = env.
le(
Keylet(ltDIR_NODE, openDirKey));
2154 BEAST_EXPECT(dirSle);
2155 auto const exchangeRate = dirSle->getFieldU64(sfExchangeRate);
2157 BEAST_EXPECT(exchangeRate == postCrossingQuality);
2158 BEAST_EXPECT(quality == postCrossingQuality);
2159 BEAST_EXPECT(exchangeRate == quality);
2172 bool const fixEnabled = features[fixCleanup3_2_0];
2174 testcase <<
"Cancel regular offer via domain OfferCreate"
2175 << (fixEnabled ?
" (fixCleanup3_2_0 enabled)" :
" (fixCleanup3_2_0 disabled)");
2186 Env env(*
this, features);
2187 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
2190 auto const regularSeq = env.seq(bob);
2193 BEAST_EXPECT(
checkOffer(env, bob, regularSeq,
XRP(10), usd(10), 0,
false));
2195 auto const domainSeq = env.seq(bob);
2200 Json(jss::OfferSequence, regularSeq));
2203 BEAST_EXPECT(
checkOffer(env, bob, domainSeq,
XRP(20), usd(20), 0,
true));
2209 Json(jss::OfferSequence, regularSeq),
2220 bool const fixEnabled = features[fixCleanup3_4_0];
2222 testcase <<
"Domain offer indexed in the wrong domain book"
2223 << (fixEnabled ?
" (fixCleanup3_4_0 enabled)" :
" (fixCleanup3_4_0 disabled)");
2237 Env env(*
this, features);
2238 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
2243 auto const domainID2 =
2247 auto const bobOfferSeq{env.seq(bob)};
2250 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), 0,
true));
2256 auto const sle = view.
read(offerKey);
2260 replacement->setFieldH256(sfDomainID, domainID2);
2268 env(
pay(alice, carol, usd(10)),
2279 env(
pay(alice, carol, usd(10)),
2291 bool const fixEnabled = features[fixCleanup3_4_0];
2293 testcase <<
"Offer without a domain indexed in a domain book"
2294 << (fixEnabled ?
" (fixCleanup3_4_0 enabled)" :
" (fixCleanup3_4_0 disabled)");
2308 Env env(*
this, features);
2309 auto const& [gw, domainOwner, alice, bob, carol, usd, domainID, credType] =
2313 auto const bobOfferSeq{env.seq(bob)};
2316 BEAST_EXPECT(
checkOffer(env, bob, bobOfferSeq,
XRP(10), usd(10), 0,
true));
2322 auto const sle = view.
read(offerKey);
2326 replacement->makeFieldAbsent(sfDomainID);
2331 auto const carolBefore = env.balance(carol, usd);
2336 env(
pay(alice, carol, usd(10)),
2342 BEAST_EXPECT(env.balance(carol, usd) - carolBefore == usd(0));
2349 BEAST_EXPECT(!
offerExists(env, bob, bobOfferSeq));
2350 BEAST_EXPECT(env.balance(carol, usd) - carolBefore == usd(10));
2357 bool const fixEnabled = features[fixCleanup3_4_0];
2359 testcase <<
"Replace domain offer via OfferCreate"
2360 << (fixEnabled ?
" (fixCleanup3_4_0 enabled)" :
" (fixCleanup3_4_0 disabled)");
2362 Env env(*
this, features);
2363 auto const& [gw, domainOwner, alice, bob, carol, usd, domainA, credType] =
2366 Account const domainOwnerB(
"permdex-domainOwnerB");
2367 auto const domainB =
2368 setupDomain(env, {alice, bob, carol, gw}, domainOwnerB,
"permdex-other-domain");
2369 BEAST_EXPECT(domainA != domainB);
2371 auto const oldSeq = env.seq(alice);
2375 BEAST_EXPECT(
checkOffer(env, alice, oldSeq, usd(100),
XRP(1), 0,
true));
2377 if (!BEAST_EXPECT(oldOffer))
2379 BEAST_EXPECT(oldOffer->getFieldH256(sfDomainID) == domainA);
2381 auto const newSeq = env.seq(alice);
2386 env(
offer(alice, usd(100),
XRP(2)),
Domain(domainB),
Json(jss::OfferSequence, oldSeq));
2390 BEAST_EXPECT(
checkOffer(env, alice, newSeq, usd(100),
XRP(2), 0,
true));
2392 if (!BEAST_EXPECT(newOffer))
2394 BEAST_EXPECT(newOffer->getFieldH256(sfDomainID) == domainB);
2398 env(
offer(alice, usd(100),
XRP(2)),
2400 Json(jss::OfferSequence, oldSeq),
2404 BEAST_EXPECT(
checkOffer(env, alice, oldSeq, usd(100),
XRP(1), 0,
true));
A generic endpoint for log messages.
TestcaseT testcase
Memberspace for declaring test cases.
Value removeMember(char const *key)
Remove and return the named member.
A currency issued by an account.
Writable ledger view that accumulates state and tx changes.
void rawReplace(SLE::Ref sle) override
Unconditionally replace a state item.
SLE::const_pointer read(Keylet const &k) const override
Return the state item associated with a key.
static constexpr SeqProxy rawSequence(std::uint32_t v)
Factory function to return a sequence-based SeqProxy.
void testRippling(FeatureBitset features)
static std::optional< UInt256 > getDefaultOfferDirKey(Env const &env, Account const &account, std::uint32_t offerSeq)
static bool checkDirectorySize(Env const &env, UInt256 directory, std::uint32_t dirSize)
void testOfferCreate(FeatureBitset features)
void testHybridOfferDirectories(FeatureBitset features)
static UInt256 getBookDirKey(Book const &book, STAmount const &takerPays, STAmount const &takerGets)
void testExpiredCredentialCleanup(FeatureBitset features)
void testHybridOfferCreate(FeatureBitset features)
void testCancelRegularOfferWithDomainCreate(FeatureBitset features)
void testHybridOpenBookAfterCredentialExpiry(FeatureBitset features)
void testHybridOfferCrossingQuality(FeatureBitset features)
void testAutoBridge(FeatureBitset features)
void testOfferTokenIssuerInDomain(FeatureBitset features)
void run() override
Runs the suite.
void testPayment(FeatureBitset features)
void testHybridBookStep(FeatureBitset features)
void testAmmNotUsed(FeatureBitset features)
void testBookStep(FeatureBitset features)
void testDomainOfferInWrongBook(FeatureBitset features)
static bool offerExists(Env const &env, Account const &account, std::uint32_t offerSeq)
void testAmmQualityNotLeaked(FeatureBitset features)
void testReplaceDomainOfferWithOtherDomainOffer(FeatureBitset features)
static bool checkOffer(Env const &env, Account const &account, std::uint32_t offerSeq, STAmount const &takerPays, STAmount const &takerGets, uint32_t const flags=0, bool const domainOffer=false)
void testDomainBookOfferMissingDomain(FeatureBitset features)
void testBookExchangeRateFix(FeatureBitset features)
void testHybridMalformedOffer(FeatureBitset features)
void testHybridInvalidOffer(FeatureBitset features)
void testRemoveUnfundedOffer(FeatureBitset features)
Convenience class to test AMM functionality.
Immutable cryptographic account descriptor.
std::string const & human() const
Returns the human readable public key.
A transaction testing environment.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
SLE::const_pointer le(Account const &account) const
Return an account root.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
std::uint32_t seq(Account const &account) const
Returns the next sequence number on account.
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
void enableFeature(UInt256 const feature)
void require(Args const &... args)
Check a set of requirements.
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Converts to IOU Issue or STAmount.
Set Paths, SendMax on a JTx.
Sets the SendMax on a JTx.
Set the expected result code for a JTx The test will fail if the code doesn't match.
T emplace_back(T... args)
Keylet quality(Keylet const &k, std::uint64_t const q) noexcept
The initial directory page for a specific quality.
Keylet offer(AccountID const &id, SeqProxy const &seq) noexcept
An offer from an account.
Keylet book(Book const &b)
The beginning of an order book.
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Keylet page(UInt256 const &root, std::uint64_t const index=0) noexcept
A page in a directory.
Keylet credential(AccountID const &subject, AccountID const &issuer, Slice const &credType) noexcept
json::Value deleteCred(jtx::Account const &acc, jtx::Account const &subject, jtx::Account const &issuer, std::string_view credType)
json::Value accept(jtx::Account const &subject, jtx::Account const &issuer, std::string_view credType)
json::Value create(jtx::Account const &subject, jtx::Account const &issuer, std::string_view credType)
json::Value bookExchangeRate(jtx::Account const &acct, UInt256 const &bookDir)
Repair sfExchangeRate on a book directory's first page.
std::map< UInt256, json::Value > getObjects(Account const &account, Env &env, bool withType)
std::vector< Credential > Credentials
json::Value setTx(AccountID const &account, Credentials const &credentials, std::optional< UInt256 > domain)
json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
json::Value offerCancel(Account const &account, std::uint32_t offerSeq)
Cancel an offer.
XrpT const XRP
Converts to XRP Issue or STAmount.
std::uint32_t ownerCount(Env const &env, Account const &account)
FeatureBitset testableAmendments()
json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
json::Value trust(Account const &account, STAmount const &amount, std::uint32_t flags)
Modify a trust line.
UInt256 setupDomain(jtx::Env &env, std::vector< jtx::Account > const &accounts, jtx::Account const &domainOwner, std::string const &credType)
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
BaseUInt< 256 > Domain
Domain is a 256-bit hash representing a specific domain.
std::uint64_t getQuality(UInt256 const &uBase)
Slice makeSlice(std::array< T, N > const &a)
std::uint64_t getRate(STAmount const &offerOut, STAmount const &offerIn)
TERSubset< CanCvtToTER > TER
A pair of SHAMap key and LedgerEntryType.