21#include <test/jtx/PathSet.h>
23#include <xrpld/app/paths/Flow.h>
24#include <xrpld/app/paths/detail/Steps.h>
25#include <xrpld/core/Config.h>
26#include <xrpld/ledger/PaymentSandbox.h>
27#include <xrpld/ledger/Sandbox.h>
29#include <xrpl/basics/contract.h>
30#include <xrpl/protocol/Feature.h>
46 return sle->isFlag(flag);
48 Throw<std::runtime_error>(
"No line in getTrustFlag");
60 auto const alice =
Account(
"alice");
61 auto const bob =
Account(
"bob");
62 auto const carol =
Account(
"carol");
63 auto const dan =
Account(
"dan");
64 auto const erin =
Account(
"erin");
65 auto const USDA = alice[
"USD"];
66 auto const USDB = bob[
"USD"];
67 auto const USDC = carol[
"USD"];
68 auto const USDD = dan[
"USD"];
70 auto const USD = gw[
"USD"];
73 Env env(*
this, features);
75 env.
fund(
XRP(10000), alice, bob, gw);
77 env.
trust(USD(1000), alice, bob);
78 env(
pay(gw, alice, USD(100)));
79 env(
pay(alice, bob, USD(10)),
paths(USD));
84 Env env(*
this, features);
86 env.
fund(
XRP(10000), alice, bob);
88 env(
pay(alice, bob,
XRP(100)));
94 Env env(*
this, features);
96 env.
fund(
XRP(10000), alice, bob, gw);
98 env.
trust(USD(1000), alice, bob);
99 env(
pay(gw, alice, USD(100)));
102 env(
pay(alice, bob, USD(110)),
109 Env env(*
this, features);
111 env.
fund(
XRP(10000), alice, bob, carol, dan);
113 env.
trust(USDA(10), bob);
114 env.
trust(USDB(10), carol);
115 env.
trust(USDC(10), dan);
116 env(
pay(alice, dan, USDC(10)),
paths(USDA));
125 Env env(*
this, features);
127 env.
fund(
XRP(10000), alice, bob, carol, dan);
129 env.
trust(USDA(10), bob);
130 env.
trust(USDB(10), alice, carol);
131 env.
trust(USDC(10), dan);
135 env(
pay(bob, alice, USDB(6)));
136 env(
pay(alice, dan, USDC(5)),
146 Env env(*
this, features);
148 env.
fund(
XRP(10000), alice, bob, carol, dan);
150 env.
trust(USDA(10), bob);
151 env.
trust(USDB(10), alice, carol);
152 env.
trust(USDC(10), dan);
155 env(
pay(alice, dan, USDC(5)),
165 Env env(*
this, features);
167 env.
fund(
XRP(10000), alice, bob, carol, dan, erin);
169 env.
trust(USDA(10), bob, carol);
170 env.
trust(USDB(10), dan);
171 env.
trust(USDC(10), alice, dan);
172 env.
trust(USDD(20), erin);
174 env(
rate(carol, 1.1));
177 env(
pay(carol, alice, USDC(10)));
178 env(
pay(alice, erin, USDD(5)),
189 Env env(*
this, features);
191 env.
fund(
XRP(10000), alice, bob, carol);
193 env.
trust(USDA(10), bob);
194 env.
trust(USDB(10), carol);
196 env(
pay(alice, carol, USDB(5)),
202 env(
pay(alice, carol, USDB(5)),
215 auto const alice =
Account(
"alice");
216 auto const bob =
Account(
"bob");
217 auto const carol =
Account(
"carol");
218 auto const dan =
Account(
"dan");
219 auto const USDA = alice[
"USD"];
220 auto const USDB = bob[
"USD"];
221 auto const USDC = carol[
"USD"];
222 auto const USDD = dan[
"USD"];
225 for (
auto bobDanQIn : {80, 100, 120})
226 for (
auto bobAliceQOut : {80, 100, 120})
228 Env env(*
this, features);
229 env.
fund(
XRP(10000), alice, bob, carol, dan);
233 env(
trust(carol, USDA(100)));
235 env(
pay(alice, bob, USDA(100)));
237 env(
pay(dan, carol, USDA(10)),
242 if (bobAliceQOut > bobDanQIn)
245 USDD(10.0 *
double(bobAliceQOut) /
double(bobDanQIn))));
252 for (
auto carolAliceQIn : {80, 100, 120})
254 Env env(*
this, features);
255 env.
fund(
XRP(10000), alice, bob, carol);
258 env(
trust(bob, USDA(10)));
261 env(
pay(alice, bob, USDA(10)));
263 env(
pay(bob, carol, USDA(5)),
sendmax(USDA(10)));
264 auto const effectiveQ =
265 carolAliceQIn > 100 ? 1.0 : carolAliceQIn / 100.0;
270 for (
auto bobAliceQOut : {80, 100, 120})
272 Env env(*
this, features);
273 env.
fund(
XRP(10000), alice, bob, carol);
276 env(
trust(carol, USDA(10)));
278 env(
pay(alice, bob, USDA(10)));
280 env(
pay(bob, carol, USDA(5)),
sendmax(USDA(5)));
293 auto const gw =
Account(
"gateway");
294 auto const USD = gw[
"USD"];
295 auto const BTC = gw[
"BTC"];
296 auto const EUR = gw[
"EUR"];
303 Env env(*
this, features);
305 env.
fund(
XRP(10000), alice, bob, carol, gw);
307 env.
trust(USD(1000), alice, bob, carol);
308 env.
trust(BTC(1000), alice, bob, carol);
310 env(
pay(gw, alice, BTC(50)));
311 env(
pay(gw, bob, USD(50)));
313 env(
offer(bob, BTC(50), USD(50)));
321 BEAST_EXPECT(!
isOffer(env, bob, BTC(50), USD(50)));
325 Env env(*
this, features);
327 env.
fund(
XRP(10000), alice, bob, carol, gw);
329 env.
trust(USD(1000), alice, bob, carol);
330 env.
trust(BTC(1000), alice, bob, carol);
332 env(
pay(gw, alice, BTC(50)));
333 env(
pay(gw, bob, USD(50)));
344 BEAST_EXPECT(!
isOffer(env, bob,
XRP(50), USD(50)));
345 BEAST_EXPECT(!
isOffer(env, bob, BTC(50),
XRP(50)));
349 Env env(*
this, features);
351 env.
fund(
XRP(10000), alice, bob, carol, gw);
353 env.
trust(USD(1000), alice, bob, carol);
354 env.
trust(BTC(1000), alice, bob, carol);
356 env(
pay(gw, bob, USD(50)));
366 BEAST_EXPECT(!
isOffer(env, bob,
XRP(50), USD(50)));
370 Env env(*
this, features);
372 env.
fund(
XRP(10000), alice, bob, carol, gw);
374 env.
trust(USD(1000), alice, bob, carol);
375 env.
trust(BTC(1000), alice, bob, carol);
377 env(
pay(gw, alice, USD(50)));
387 BEAST_EXPECT(!
isOffer(env, bob, USD(50),
XRP(50)));
391 Env env(*
this, features);
393 env.
fund(
XRP(10000), alice, bob, carol, gw);
395 env.
trust(USD(1000), alice, bob, carol);
396 env.
trust(BTC(1000), alice, bob, carol);
397 env.
trust(EUR(1000), alice, bob, carol);
399 env(
pay(gw, alice, BTC(60)));
400 env(
pay(gw, bob, USD(50)));
401 env(
pay(gw, bob, EUR(50)));
403 env(
offer(bob, BTC(50), USD(50)));
404 env(
offer(bob, BTC(40), EUR(50)));
405 env(
offer(bob, EUR(50), USD(50)));
408 env(
pay(bob, gw, EUR(50)));
409 BEAST_EXPECT(
isOffer(env, bob, BTC(50), USD(50)));
410 BEAST_EXPECT(
isOffer(env, bob, BTC(40), EUR(50)));
411 BEAST_EXPECT(
isOffer(env, bob, EUR(50), USD(50)));
413 env(
pay(alice, carol, USD(50)),
424 BEAST_EXPECT(!
isOffer(env, bob, BTC(50), USD(50)));
426 BEAST_EXPECT(!
isOffer(env, bob, BTC(40), EUR(50)));
428 BEAST_EXPECT(
isOffer(env, bob, EUR(50), USD(50)));
439 Env env(*
this, features);
441 env.
fund(
XRP(10000), alice, bob, carol, gw);
443 env.
trust(USD(1000), alice, bob, carol);
444 env.
trust(BTC(1000), alice, bob, carol);
445 env.
trust(EUR(1000), alice, bob, carol);
447 env(
pay(gw, alice, BTC(60)));
448 env(
pay(gw, bob, USD(60)));
449 env(
pay(gw, bob, EUR(50)));
450 env(
pay(gw, carol, EUR(1)));
452 env(
offer(bob, BTC(50), USD(50)));
453 env(
offer(bob, BTC(60), EUR(50)));
454 env(
offer(carol, BTC(1000), EUR(1)));
455 env(
offer(bob, EUR(50), USD(50)));
458 env(
pay(bob, gw, EUR(50)));
459 BEAST_EXPECT(
isOffer(env, bob, BTC(50), USD(50)));
460 BEAST_EXPECT(
isOffer(env, bob, BTC(60), EUR(50)));
461 BEAST_EXPECT(
isOffer(env, carol, BTC(1000), EUR(1)));
464 auto const flowResult = [&] {
501 BEAST_EXPECT(flowResult.removableOffers.size() == 1);
504 if (flowResult.removableOffers.empty())
507 for (
auto const& o : flowResult.removableOffers)
515 BEAST_EXPECT(
isOffer(env, bob, BTC(50), USD(50)));
516 BEAST_EXPECT(
isOffer(env, carol, BTC(1000), EUR(1)));
518 BEAST_EXPECT(!
isOffer(env, bob, BTC(60), EUR(50)));
528 Env env(*
this, features);
529 env.
fund(
XRP(10000), alice, bob, carol, gw);
532 env.
trust(USD(1000), alice, bob, carol);
533 env.
trust(EUR(1000), alice, bob, carol);
535 env(
pay(gw, alice, USD(1000)));
536 env(
pay(gw, bob, EUR(1000)));
542 bool const reducedOffersV2 = features[fixReducedOffersV2];
548 TER const expectedTER =
550 env(
pay(alice, carol, EUR(1)),
556 if (!reducedOffersV2)
564 if (BEAST_EXPECT(usdOffer))
570 to_string(usdOffer->at(sfBookDirectory));
571 bookDirStr.
erase(0, 48);
575 usdOffer->at(sfTakerGets), usdOffer->at(sfTakerPays));
581 BEAST_EXPECT(actualRate > bookRate);
594 auto const gw =
Account(
"gateway");
595 auto const USD = gw[
"USD"];
596 auto const BTC = gw[
"BTC"];
597 auto const EUR = gw[
"EUR"];
605 Env env(*
this, features);
607 env.
fund(
XRP(10000), alice, bob, carol, gw);
610 env.
trust(USD(1000), alice, bob, carol);
611 env(
pay(gw, alice, USD(50)));
613 env(
pay(alice, bob, USD(40)),
sendmax(USD(50)));
618 Env env(*
this, features);
620 env.
fund(
XRP(10000), alice, bob, carol, gw);
623 env.
trust(USD(1000), alice, bob, carol);
624 env(
pay(gw, alice, USD(50)));
626 env(
pay(alice, gw, USD(40)),
sendmax(USD(40)));
631 Env env(*
this, features);
633 env.
fund(
XRP(10000), alice, bob, carol, gw);
636 env.
trust(USD(1000), alice, bob, carol);
637 env(
pay(gw, bob, USD(65)));
650 Env env(*
this, features);
652 env.
fund(
XRP(10000), alice, bob, carol, gw);
655 env.
trust(USD(1000), alice, bob, carol);
656 env.
trust(EUR(1000), alice, bob, carol);
657 env(
pay(gw, bob, USD(50)));
658 env(
pay(gw, bob, EUR(50)));
661 env(
offer(bob, USD(50), EUR(50)));
674 Env env(*
this, features);
675 auto const USDA = alice[
"USD"];
676 auto const USDB = bob[
"USD"];
678 env.
fund(
XRP(10000), alice, bob, carol, gw);
681 env.
trust(USD(1000), alice, bob, carol);
682 env.
trust(USDA(1000), bob);
683 env.
trust(USDB(1000), gw);
684 env(
pay(gw, bob, USD(50)));
696 Env env(*
this, features);
697 auto const USDA = alice[
"USD"];
698 auto const USDB = bob[
"USD"];
701 env.
fund(
XRP(10000), alice, bob, carol, dan, gw);
704 env.
trust(USD(1000), alice, bob, carol, dan);
705 env.
trust(EUR(1000), carol, dan);
706 env.
trust(USDA(1000), bob);
707 env.
trust(USDB(1000), gw);
708 env(
pay(gw, bob, USD(50)));
709 env(
pay(gw, dan, EUR(100)));
710 env(
offer(dan, USD(100), EUR(100)));
713 env(
pay(alice, carol, EUR(50)),
727 Env env(*
this, features);
729 env.
fund(
XRP(10000), alice, bob, gw);
732 env.
trust(USD(1000), alice, bob);
739 if (!features[featureOwnerPaysFee])
742 Env env(*
this, features);
744 env.
fund(
XRP(10000), alice, bob, gw);
747 env.
trust(USD(1000), alice, bob);
763 auto const gw =
Account(
"gateway");
764 auto const USD = gw[
"USD"];
765 auto const EUR = gw[
"EUR"];
770 Env env(*
this, features);
772 env.
fund(
XRP(10000), alice, carol, gw);
775 env.
trust(USD(1000), alice, bob, carol);
776 env.
trust(EUR(1000), alice, bob, carol);
778 env(
pay(gw, alice, EUR(50)));
779 env(
pay(gw, bob, USD(50)));
791 env(
pay(alice, carol, USD(1000000)),
797 BEAST_EXPECT(carolUSD > USD(0) && carolUSD < USD(50));
810 auto const gw =
Account(
"gateway");
811 auto const USD = gw[
"USD"];
819 env.
fund(
XRP(10000), alice, bob, carol, gw);
822 env.
trust(USD(100), alice, bob, carol);
823 env(
pay(gw, bob, USD(100)));
827 env(
pay(alice, carol, USD(100)),
841 return env.
current()->fees().accountReserve(count);
853 if (sle->getType() == ltOFFER)
854 result.push_back(sle);
871 auto const gw1 =
Account(
"gw1");
872 auto const gw2 =
Account(
"gw2");
873 auto const alice =
Account(
"alice");
874 auto const USD = gw1[
"USD"];
875 auto const EUR = gw2[
"EUR"];
877 Env env(*
this, features);
879 env.
fund(
XRP(1000000), gw1, gw2);
883 auto const f = env.
current()->fees().base;
888 env(
trust(alice, USD(2000)));
889 env(
trust(alice, EUR(2000)));
892 env(
pay(gw1, alice, USD(1)));
893 env(
pay(gw2, alice, EUR(1000)));
896 env(
offer(alice, USD(500), EUR(600)));
904 BEAST_EXPECT(aliceOffers.size() == 1);
905 for (
auto const& offerPtr : aliceOffers)
907 auto const offer = *offerPtr;
908 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
909 BEAST_EXPECT(
offer[sfTakerGets] == EUR(600));
910 BEAST_EXPECT(
offer[sfTakerPays] == USD(500));
913 env(
pay(alice, alice, EUR(600)),
922 BEAST_EXPECT(aliceOffers.size() == 1);
923 for (
auto const& offerPtr : aliceOffers)
925 auto const offer = *offerPtr;
926 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
927 BEAST_EXPECT(
offer[sfTakerGets] == EUR(598.8));
928 BEAST_EXPECT(
offer[sfTakerPays] == USD(499));
942 auto const gw1 =
Account(
"gw1");
943 auto const gw2 =
Account(
"gw2");
944 auto const alice =
Account(
"alice");
945 auto const USD = gw1[
"USD"];
946 auto const EUR = gw2[
"EUR"];
948 Env env(*
this, features);
950 env.
fund(
XRP(1000000), gw1, gw2);
954 auto const f = env.
current()->fees().base;
959 env(
trust(alice, USD(506)));
960 env(
trust(alice, EUR(606)));
963 env(
pay(gw1, alice, USD(500)));
964 env(
pay(gw2, alice, EUR(600)));
967 env(
offer(alice, USD(500), EUR(600)));
975 BEAST_EXPECT(aliceOffers.size() == 1);
976 for (
auto const& offerPtr : aliceOffers)
978 auto const offer = *offerPtr;
979 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
980 BEAST_EXPECT(
offer[sfTakerGets] == EUR(600));
981 BEAST_EXPECT(
offer[sfTakerPays] == USD(500));
984 env(
pay(alice, alice, EUR(60)),
993 BEAST_EXPECT(aliceOffers.size() == 1);
994 for (
auto const& offerPtr : aliceOffers)
996 auto const offer = *offerPtr;
997 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
998 BEAST_EXPECT(
offer[sfTakerGets] == EUR(594));
999 BEAST_EXPECT(
offer[sfTakerPays] == USD(495));
1010 testcase(
"Self funded XRPEndpoint");
1012 using namespace jtx;
1014 Env env(*
this, features);
1016 auto const alice =
Account(
"alice");
1017 auto const gw =
Account(
"gw");
1018 auto const USD = gw[
"USD"];
1020 env.
fund(
XRP(10000), alice, gw);
1022 env(
trust(alice, USD(20)));
1023 env(
pay(gw, alice, USD(10)));
1024 env(
offer(alice,
XRP(50000), USD(10)));
1028 auto const toSend = consumeOffer ? USD(10) : USD(9);
1029 env(
pay(alice, alice, toSend),
1040 using namespace jtx;
1043 Env env(*
this, features);
1045 auto const alice =
Account(
"alice");
1046 auto const bob =
Account(
"bob");
1047 auto const gw =
Account(
"gw");
1048 auto const USD = gw[
"USD"];
1050 env.
fund(
XRP(100000), alice, bob, gw);
1052 env(
trust(bob, USD(20)));
1068 env(
pay(alice, bob, tinyAmt1),
1073 BEAST_EXPECT(!
isOffer(env, gw,
XRP(0), USD(0)));
1077 Env env(*
this, features);
1079 auto const alice =
Account(
"alice");
1080 auto const bob =
Account(
"bob");
1081 auto const gw =
Account(
"gw");
1082 auto const USD = gw[
"USD"];
1084 env.
fund(
XRP(100000), alice, bob, gw);
1086 env(
trust(alice, USD(20)));
1101 env(
pay(gw, alice, tinyAmt1));
1104 env(
pay(alice, bob,
drops(9000000000)),
1109 BEAST_EXPECT(!
isOffer(env, gw, USD(0),
XRP(0)));
1118 using namespace jtx;
1119 Env env(*
this, features);
1121 auto const alice =
Account(
"alice");
1122 auto const bob =
Account(
"bob");
1123 auto const gw =
Account(
"gw");
1124 auto const USD = gw[
"USD"];
1125 auto const usdC = USD.currency;
1127 env.
fund(
XRP(10000), alice, bob, gw);
1129 env(
trust(alice, USD(100)));
1169 env(
pay(alice, bob,
XRP(10000)),
1180 using namespace jtx;
1182 auto const alice =
Account(
"alice");
1183 auto const bob =
Account(
"bob");
1184 auto const carol =
Account(
"carol");
1185 auto const gw =
Account(
"gw");
1189 env.
trust(gw[
"USD"](10000), alice, carol);
1191 env.
trust(gw[
"USD"](10000), bob);
1196 env(
pay(gw, alice, gw[
"USD"](1000)));
1199 env(
offer(alice, bob[
"USD"](1000),
XRP(1)));
1202 env(
pay(alice, alice,
XRP(1)),
1209 env.
trust(bob[
"USD"](10000), alice);
1210 env(
pay(bob, alice, bob[
"USD"](1000)));
1212 env(
offer(alice,
XRP(1000), bob[
"USD"](1000)));
1215 env(
pay(carol, carol, gw[
"USD"](1000)),
1216 path(~bob[
"USD"], gw),
1230 using namespace jtx;
1237 auto const alice =
Account(
"alice");
1238 auto const bob =
Account(
"bob");
1239 auto const carol =
Account(
"carol");
1240 auto const gw =
Account(
"gw");
1241 auto const USD = gw[
"USD"];
1243 env.
fund(
XRP(100000000), alice, bob, carol, gw);
1245 env.
trust(USD(10000), alice, carol);
1247 env.
trust(USD(10000), bob);
1248 env.
trust(bob[
"USD"](10000), carol);
1251 env(
pay(bob, carol, bob[
"USD"](1000)));
1252 env(
pay(gw, bob, USD(1000)));
1255 env(
offer(carol,
XRP(1), bob[
"USD"](1000)));
1258 env(
pay(alice, alice, USD(1000)),
1259 path(~bob[
"USD"], bob, gw),
1272 testcase(
"Self crossing low quality offer");
1274 using namespace jtx;
1276 Env env(*
this, features);
1278 auto const ann =
Account(
"ann");
1279 auto const gw =
Account(
"gateway");
1280 auto const CTB = gw[
"CTB"];
1287 env(
rate(gw, 1.002));
1288 env(
trust(ann, CTB(10)));
1291 env(
pay(gw, ann, CTB(2.856)));
1294 env(
offer(ann,
drops(365611702030), CTB(5.713)));
1298 env(
pay(ann, ann, CTB(0.687)),
1307 using namespace jtx;
1309 auto const alice =
Account(
"alice");
1311 Env env(*
this, features);
1316 env(
pay(alice, alice, alice[
"USD"](100)),
1317 path(~alice[
"USD"]),
1326 using namespace jtx;
1327 auto const alice =
Account(
"alice");
1328 auto const bob =
Account(
"bob");
1329 auto const gw =
Account(
"gw");
1330 auto const USD = gw[
"USD"];
1331 auto const EUR = gw[
"EUR"];
1333 for (
auto const withFix : {
true,
false})
1342 Env env(*
this, feats);
1343 env.
fund(
XRP(10000), alice, bob, gw);
1345 env.
trust(USD(1000), alice, bob);
1346 env.
trust(EUR(1000), alice, bob);
1348 env(
pay(gw, alice, USD(100)));
1349 env(
pay(gw, alice, EUR(100)));
1357 TER const expectedTer =
1359 env(
pay(alice, bob, EUR(1)),
1370 env.
fund(
XRP(10000), alice, bob, gw);
1372 env.
trust(USD(1000), alice, bob);
1373 env.
trust(EUR(1000), alice, bob);
1374 env(
pay(gw, alice, USD(100)));
1375 env(
pay(gw, alice, EUR(100)));
1382 env(
pay(alice, bob,
XRP(1)),
1391 auto const JPY = gw[
"JPY"];
1393 env.
fund(
XRP(10000), alice, bob, gw);
1395 env.
trust(USD(1000), alice, bob);
1396 env.
trust(EUR(1000), alice, bob);
1397 env.
trust(JPY(1000), alice, bob);
1399 env(
pay(gw, alice, USD(100)));
1400 env(
pay(gw, alice, EUR(100)));
1401 env(
pay(gw, alice, JPY(100)));
1410 env(
pay(alice, bob, JPY(1)),
1422 using namespace jtx;
1424 auto const alice =
Account(
"alice");
1425 auto const bob =
Account(
"bob");
1427 Env env(*
this, features);
1447 using namespace jtx;
1477 using namespace jtx;
1479 testWithFeats(sa - featureFlowCross - featurePermissionedDEX);
1491 using namespace jtx;
1509BEAST_DEFINE_TESTSUITE_PRIO(Flow, app,
ripple, 2);
1510BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(Flow_manual, app,
ripple, 4);
A generic endpoint for log messages.
void pass()
Record a successful test condition.
testcase_t testcase
Memberspace for declaring test cases.
virtual OpenLedger & openLedger()=0
A currency issued by an account.
beast::Journal journal(std::string const &name)
bool modify(modify_type const &f)
Modify the open ledger.
Writable ledger view that accumulates state and tx changes.
A wrapper which makes credits unavailable to balances.
Issue const & issue() const
Discardable, editable view to a ledger.
Immutable cryptographic account descriptor.
AccountID id() const
Returns the Account ID.
A transaction testing environment.
std::uint32_t seq(Account const &account) const
Returns the next sequence number on account.
void require(Args const &... args)
Check a set of requirements.
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
std::shared_ptr< SLE const > le(Account const &account) const
Return an account root.
Match the number of items in the account's owner directory.
Set Paths, SendMax on a JTx.
Sets the QualityIn on a trust JTx.
Sets the QualityOut on a trust JTx as a percentage.
Sets the SendMax on a JTx.
Set the expected result code for a JTx The test will fail if the code doesn't match.
Set a ticket sequence on a JTx.
Keylet line(AccountID const &id0, AccountID const &id1, Currency const ¤cy) noexcept
The index of a trust line for a given currency.
Keylet offer(AccountID const &id, std::uint32_t seq) noexcept
An offer from an account.
Json::Value create(Account const &account, std::uint32_t count)
Create one of more tickets.
PrettyAmount xrpMinusFee(Env const &env, std::int64_t xrpAmount)
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
Json::Value trust(Account const &account, STAmount const &amount, std::uint32_t flags)
Modify a trust line.
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
Json::Value rate(Account const &account, double multiplier)
Set a transfer rate.
STPathElement IPE(Issue const &iss)
Json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
XRP_t const XRP
Converts to XRP Issue or STAmount.
FeatureBitset supported_amendments()
bool isOffer(jtx::Env &env, jtx::Account const &account, STAmount const &takerPays, STAmount const &takerGets)
An offer exists.
bool getNoRippleFlag(jtx::Env const &env, jtx::Account const &src, jtx::Account const &dst, Currency const &cur)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
AccountID const & xrpAccount()
Compute AccountID from public key.
StrandResult< TInAmt, TOutAmt > flow(PaymentSandbox const &baseView, Strand const &strand, std::optional< TInAmt > const &maxIn, TOutAmt const &out, beast::Journal j)
Request out amount from a strand.
constexpr std::uint32_t tfPassive
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
std::uint64_t getRate(STAmount const &offerOut, STAmount const &offerIn)
constexpr std::uint32_t tfPartialPayment
constexpr std::uint32_t tfNoRippleDirect
constexpr std::uint32_t tfLimitQuality
std::string to_string(base_uint< Bits, Tag > const &a)
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.
TERSubset< CanCvtToTER > TER
constexpr std::uint32_t tfSetNoRipple
A pair of SHAMap key and LedgerEntryType.
void run() override
Runs the suite.
void run() override
Runs the suite.
void testWithFeats(FeatureBitset features)
void testSelfPayment1(FeatureBitset features)
void testTransferRate(FeatureBitset features)
static XRPAmount reserve(jtx::Env &env, std::uint32_t count)
void testBookStep(FeatureBitset features)
void testUnfundedOffer(FeatureBitset features)
void testTicketPay(FeatureBitset features)
void testSelfFundedXRPEndpoint(bool consumeOffer, FeatureBitset features)
void testEmptyStrand(FeatureBitset features)
void testSelfPayLowQualityOffer(FeatureBitset features)
static std::vector< std::shared_ptr< SLE const > > offersOnAccount(jtx::Env &env, jtx::Account account)
void testDirectStep(FeatureBitset features)
void testLineQuality(FeatureBitset features)
void testFalseDry(FeatureBitset features)
void testSelfPayment2(FeatureBitset features)
void testReexecuteDirectStep(FeatureBitset features)
STAmount const & value() const