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 = [&] {
500 BEAST_EXPECT(flowResult.removableOffers.size() == 1);
503 if (flowResult.removableOffers.empty())
506 for (
auto const& o : flowResult.removableOffers)
514 BEAST_EXPECT(
isOffer(env, bob, BTC(50), USD(50)));
515 BEAST_EXPECT(
isOffer(env, carol, BTC(1000), EUR(1)));
517 BEAST_EXPECT(!
isOffer(env, bob, BTC(60), EUR(50)));
527 Env env(*
this, features);
528 env.
fund(
XRP(10000), alice, bob, carol, gw);
531 env.
trust(USD(1000), alice, bob, carol);
532 env.
trust(EUR(1000), alice, bob, carol);
534 env(
pay(gw, alice, USD(1000)));
535 env(
pay(gw, bob, EUR(1000)));
541 bool const reducedOffersV2 = features[fixReducedOffersV2];
547 TER const expectedTER =
549 env(
pay(alice, carol, EUR(1)),
555 if (!reducedOffersV2)
563 if (BEAST_EXPECT(usdOffer))
569 to_string(usdOffer->at(sfBookDirectory));
570 bookDirStr.
erase(0, 48);
574 usdOffer->at(sfTakerGets), usdOffer->at(sfTakerPays));
580 BEAST_EXPECT(actualRate > bookRate);
593 auto const gw =
Account(
"gateway");
594 auto const USD = gw[
"USD"];
595 auto const BTC = gw[
"BTC"];
596 auto const EUR = gw[
"EUR"];
604 Env env(*
this, features);
606 env.
fund(
XRP(10000), alice, bob, carol, gw);
609 env.
trust(USD(1000), alice, bob, carol);
610 env(
pay(gw, alice, USD(50)));
612 env(
pay(alice, bob, USD(40)),
sendmax(USD(50)));
617 Env env(*
this, features);
619 env.
fund(
XRP(10000), alice, bob, carol, gw);
622 env.
trust(USD(1000), alice, bob, carol);
623 env(
pay(gw, alice, USD(50)));
625 env(
pay(alice, gw, USD(40)),
sendmax(USD(40)));
630 Env env(*
this, features);
632 env.
fund(
XRP(10000), alice, bob, carol, gw);
635 env.
trust(USD(1000), alice, bob, carol);
636 env(
pay(gw, bob, USD(65)));
649 Env env(*
this, features);
651 env.
fund(
XRP(10000), alice, bob, carol, gw);
654 env.
trust(USD(1000), alice, bob, carol);
655 env.
trust(EUR(1000), alice, bob, carol);
656 env(
pay(gw, bob, USD(50)));
657 env(
pay(gw, bob, EUR(50)));
660 env(
offer(bob, USD(50), EUR(50)));
673 Env env(*
this, features);
674 auto const USDA = alice[
"USD"];
675 auto const USDB = bob[
"USD"];
677 env.
fund(
XRP(10000), alice, bob, carol, gw);
680 env.
trust(USD(1000), alice, bob, carol);
681 env.
trust(USDA(1000), bob);
682 env.
trust(USDB(1000), gw);
683 env(
pay(gw, bob, USD(50)));
695 Env env(*
this, features);
696 auto const USDA = alice[
"USD"];
697 auto const USDB = bob[
"USD"];
700 env.
fund(
XRP(10000), alice, bob, carol, dan, gw);
703 env.
trust(USD(1000), alice, bob, carol, dan);
704 env.
trust(EUR(1000), carol, dan);
705 env.
trust(USDA(1000), bob);
706 env.
trust(USDB(1000), gw);
707 env(
pay(gw, bob, USD(50)));
708 env(
pay(gw, dan, EUR(100)));
709 env(
offer(dan, USD(100), EUR(100)));
712 env(
pay(alice, carol, EUR(50)),
726 Env env(*
this, features);
728 env.
fund(
XRP(10000), alice, bob, gw);
731 env.
trust(USD(1000), alice, bob);
738 if (!features[featureOwnerPaysFee])
741 Env env(*
this, features);
743 env.
fund(
XRP(10000), alice, bob, gw);
746 env.
trust(USD(1000), alice, bob);
762 auto const gw =
Account(
"gateway");
763 auto const USD = gw[
"USD"];
764 auto const EUR = gw[
"EUR"];
769 Env env(*
this, features);
771 env.
fund(
XRP(10000), alice, carol, gw);
774 env.
trust(USD(1000), alice, bob, carol);
775 env.
trust(EUR(1000), alice, bob, carol);
777 env(
pay(gw, alice, EUR(50)));
778 env(
pay(gw, bob, USD(50)));
790 env(
pay(alice, carol, USD(1000000)),
796 BEAST_EXPECT(carolUSD > USD(0) && carolUSD < USD(50));
809 auto const gw =
Account(
"gateway");
810 auto const USD = gw[
"USD"];
818 env.
fund(
XRP(10000), alice, bob, carol, gw);
821 env.
trust(USD(100), alice, bob, carol);
822 env(
pay(gw, bob, USD(100)));
826 env(
pay(alice, carol, USD(100)),
840 return env.
current()->fees().accountReserve(count);
852 if (sle->getType() == ltOFFER)
853 result.push_back(sle);
870 auto const gw1 =
Account(
"gw1");
871 auto const gw2 =
Account(
"gw2");
872 auto const alice =
Account(
"alice");
873 auto const USD = gw1[
"USD"];
874 auto const EUR = gw2[
"EUR"];
876 Env env(*
this, features);
878 env.
fund(
XRP(1000000), gw1, gw2);
882 auto const f = env.
current()->fees().base;
887 env(
trust(alice, USD(2000)));
888 env(
trust(alice, EUR(2000)));
891 env(
pay(gw1, alice, USD(1)));
892 env(
pay(gw2, alice, EUR(1000)));
895 env(
offer(alice, USD(500), EUR(600)));
903 BEAST_EXPECT(aliceOffers.size() == 1);
904 for (
auto const& offerPtr : aliceOffers)
906 auto const offer = *offerPtr;
907 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
908 BEAST_EXPECT(
offer[sfTakerGets] == EUR(600));
909 BEAST_EXPECT(
offer[sfTakerPays] == USD(500));
912 env(
pay(alice, alice, EUR(600)),
921 BEAST_EXPECT(aliceOffers.size() == 1);
922 for (
auto const& offerPtr : aliceOffers)
924 auto const offer = *offerPtr;
925 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
926 BEAST_EXPECT(
offer[sfTakerGets] == EUR(598.8));
927 BEAST_EXPECT(
offer[sfTakerPays] == USD(499));
941 auto const gw1 =
Account(
"gw1");
942 auto const gw2 =
Account(
"gw2");
943 auto const alice =
Account(
"alice");
944 auto const USD = gw1[
"USD"];
945 auto const EUR = gw2[
"EUR"];
947 Env env(*
this, features);
949 env.
fund(
XRP(1000000), gw1, gw2);
953 auto const f = env.
current()->fees().base;
958 env(
trust(alice, USD(506)));
959 env(
trust(alice, EUR(606)));
962 env(
pay(gw1, alice, USD(500)));
963 env(
pay(gw2, alice, EUR(600)));
966 env(
offer(alice, USD(500), EUR(600)));
974 BEAST_EXPECT(aliceOffers.size() == 1);
975 for (
auto const& offerPtr : aliceOffers)
977 auto const offer = *offerPtr;
978 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
979 BEAST_EXPECT(
offer[sfTakerGets] == EUR(600));
980 BEAST_EXPECT(
offer[sfTakerPays] == USD(500));
983 env(
pay(alice, alice, EUR(60)),
992 BEAST_EXPECT(aliceOffers.size() == 1);
993 for (
auto const& offerPtr : aliceOffers)
995 auto const offer = *offerPtr;
996 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
997 BEAST_EXPECT(
offer[sfTakerGets] == EUR(594));
998 BEAST_EXPECT(
offer[sfTakerPays] == USD(495));
1009 testcase(
"Self funded XRPEndpoint");
1011 using namespace jtx;
1013 Env env(*
this, features);
1015 auto const alice =
Account(
"alice");
1016 auto const gw =
Account(
"gw");
1017 auto const USD = gw[
"USD"];
1019 env.
fund(
XRP(10000), alice, gw);
1021 env(
trust(alice, USD(20)));
1022 env(
pay(gw, alice, USD(10)));
1023 env(
offer(alice,
XRP(50000), USD(10)));
1027 auto const toSend = consumeOffer ? USD(10) : USD(9);
1028 env(
pay(alice, alice, toSend),
1039 using namespace jtx;
1042 Env env(*
this, features);
1044 auto const alice =
Account(
"alice");
1045 auto const bob =
Account(
"bob");
1046 auto const gw =
Account(
"gw");
1047 auto const USD = gw[
"USD"];
1049 env.
fund(
XRP(100000), alice, bob, gw);
1051 env(
trust(bob, USD(20)));
1067 env(
pay(alice, bob, tinyAmt1),
1072 BEAST_EXPECT(!
isOffer(env, gw,
XRP(0), USD(0)));
1076 Env env(*
this, features);
1078 auto const alice =
Account(
"alice");
1079 auto const bob =
Account(
"bob");
1080 auto const gw =
Account(
"gw");
1081 auto const USD = gw[
"USD"];
1083 env.
fund(
XRP(100000), alice, bob, gw);
1085 env(
trust(alice, USD(20)));
1100 env(
pay(gw, alice, tinyAmt1));
1103 env(
pay(alice, bob,
drops(9000000000)),
1108 BEAST_EXPECT(!
isOffer(env, gw, USD(0),
XRP(0)));
1117 using namespace jtx;
1118 Env env(*
this, features);
1120 auto const alice =
Account(
"alice");
1121 auto const bob =
Account(
"bob");
1122 auto const gw =
Account(
"gw");
1123 auto const USD = gw[
"USD"];
1124 auto const usdC = USD.currency;
1126 env.
fund(
XRP(10000), alice, bob, gw);
1128 env(
trust(alice, USD(100)));
1168 env(
pay(alice, bob,
XRP(10000)),
1179 using namespace jtx;
1181 auto const alice =
Account(
"alice");
1182 auto const bob =
Account(
"bob");
1183 auto const carol =
Account(
"carol");
1184 auto const gw =
Account(
"gw");
1188 env.
trust(gw[
"USD"](10000), alice, carol);
1190 env.
trust(gw[
"USD"](10000), bob);
1195 env(
pay(gw, alice, gw[
"USD"](1000)));
1198 env(
offer(alice, bob[
"USD"](1000),
XRP(1)));
1201 env(
pay(alice, alice,
XRP(1)),
1208 env.
trust(bob[
"USD"](10000), alice);
1209 env(
pay(bob, alice, bob[
"USD"](1000)));
1211 env(
offer(alice,
XRP(1000), bob[
"USD"](1000)));
1214 env(
pay(carol, carol, gw[
"USD"](1000)),
1215 path(~bob[
"USD"], gw),
1229 using namespace jtx;
1236 auto const alice =
Account(
"alice");
1237 auto const bob =
Account(
"bob");
1238 auto const carol =
Account(
"carol");
1239 auto const gw =
Account(
"gw");
1240 auto const USD = gw[
"USD"];
1242 env.
fund(
XRP(100000000), alice, bob, carol, gw);
1244 env.
trust(USD(10000), alice, carol);
1246 env.
trust(USD(10000), bob);
1247 env.
trust(bob[
"USD"](10000), carol);
1250 env(
pay(bob, carol, bob[
"USD"](1000)));
1251 env(
pay(gw, bob, USD(1000)));
1254 env(
offer(carol,
XRP(1), bob[
"USD"](1000)));
1257 env(
pay(alice, alice, USD(1000)),
1258 path(~bob[
"USD"], bob, gw),
1271 testcase(
"Self crossing low quality offer");
1273 using namespace jtx;
1275 Env env(*
this, features);
1277 auto const ann =
Account(
"ann");
1278 auto const gw =
Account(
"gateway");
1279 auto const CTB = gw[
"CTB"];
1286 env(
rate(gw, 1.002));
1287 env(
trust(ann, CTB(10)));
1290 env(
pay(gw, ann, CTB(2.856)));
1293 env(
offer(ann,
drops(365611702030), CTB(5.713)));
1297 env(
pay(ann, ann, CTB(0.687)),
1306 using namespace jtx;
1308 auto const alice =
Account(
"alice");
1310 Env env(*
this, features);
1315 env(
pay(alice, alice, alice[
"USD"](100)),
1316 path(~alice[
"USD"]),
1325 using namespace jtx;
1326 auto const alice =
Account(
"alice");
1327 auto const bob =
Account(
"bob");
1328 auto const gw =
Account(
"gw");
1329 auto const USD = gw[
"USD"];
1330 auto const EUR = gw[
"EUR"];
1332 for (
auto const withFix : {
true,
false})
1341 Env env(*
this, feats);
1342 env.
fund(
XRP(10000), alice, bob, gw);
1344 env.
trust(USD(1000), alice, bob);
1345 env.
trust(EUR(1000), alice, bob);
1347 env(
pay(gw, alice, USD(100)));
1348 env(
pay(gw, alice, EUR(100)));
1356 TER const expectedTer =
1358 env(
pay(alice, bob, EUR(1)),
1369 env.
fund(
XRP(10000), alice, bob, gw);
1371 env.
trust(USD(1000), alice, bob);
1372 env.
trust(EUR(1000), alice, bob);
1373 env(
pay(gw, alice, USD(100)));
1374 env(
pay(gw, alice, EUR(100)));
1381 env(
pay(alice, bob,
XRP(1)),
1390 auto const JPY = gw[
"JPY"];
1392 env.
fund(
XRP(10000), alice, bob, gw);
1394 env.
trust(USD(1000), alice, bob);
1395 env.
trust(EUR(1000), alice, bob);
1396 env.
trust(JPY(1000), alice, bob);
1398 env(
pay(gw, alice, USD(100)));
1399 env(
pay(gw, alice, EUR(100)));
1400 env(
pay(gw, alice, JPY(100)));
1409 env(
pay(alice, bob, JPY(1)),
1421 using namespace jtx;
1423 auto const alice =
Account(
"alice");
1424 auto const bob =
Account(
"bob");
1426 Env env(*
this, features);
1446 using namespace jtx;
1476 using namespace jtx;
1489 using namespace jtx;
1504BEAST_DEFINE_TESTSUITE_PRIO(Flow, app,
ripple, 2);
1505BEAST_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