21#include <test/jtx/PathSet.h>
22#include <xrpld/app/paths/Flow.h>
23#include <xrpld/app/paths/detail/Steps.h>
24#include <xrpld/core/Config.h>
25#include <xrpld/ledger/PaymentSandbox.h>
26#include <xrpld/ledger/Sandbox.h>
27#include <xrpl/basics/contract.h>
28#include <xrpl/protocol/Feature.h>
44 return sle->isFlag(flag);
46 Throw<std::runtime_error>(
"No line in getTrustFlag");
58 auto const alice =
Account(
"alice");
59 auto const bob =
Account(
"bob");
60 auto const carol =
Account(
"carol");
61 auto const dan =
Account(
"dan");
62 auto const erin =
Account(
"erin");
63 auto const USDA = alice[
"USD"];
64 auto const USDB = bob[
"USD"];
65 auto const USDC = carol[
"USD"];
66 auto const USDD = dan[
"USD"];
68 auto const USD = gw[
"USD"];
71 Env env(*
this, features);
73 env.
fund(
XRP(10000), alice, bob, gw);
74 env.
trust(USD(1000), alice, bob);
75 env(
pay(gw, alice, USD(100)));
76 env(
pay(alice, bob, USD(10)),
paths(USD));
81 Env env(*
this, features);
83 env.
fund(
XRP(10000), alice, bob);
84 env(
pay(alice, bob,
XRP(100)));
90 Env env(*
this, features);
92 env.
fund(
XRP(10000), alice, bob, gw);
93 env.
trust(USD(1000), alice, bob);
94 env(
pay(gw, alice, USD(100)));
97 env(
pay(alice, bob, USD(110)),
104 Env env(*
this, features);
106 env.
fund(
XRP(10000), alice, bob, carol, dan);
107 env.
trust(USDA(10), bob);
108 env.
trust(USDB(10), carol);
109 env.
trust(USDC(10), dan);
110 env(
pay(alice, dan, USDC(10)),
paths(USDA));
119 Env env(*
this, features);
121 env.
fund(
XRP(10000), alice, bob, carol, dan);
122 env.
trust(USDA(10), bob);
123 env.
trust(USDB(10), alice, carol);
124 env.
trust(USDC(10), dan);
128 env(
pay(bob, alice, USDB(6)));
129 env(
pay(alice, dan, USDC(5)),
139 Env env(*
this, features);
141 env.
fund(
XRP(10000), alice, bob, carol, dan);
142 env.
trust(USDA(10), bob);
143 env.
trust(USDB(10), alice, carol);
144 env.
trust(USDC(10), dan);
147 env(
pay(alice, dan, USDC(5)),
157 Env env(*
this, features);
159 env.
fund(
XRP(10000), alice, bob, carol, dan, erin);
160 env.
trust(USDA(10), bob, carol);
161 env.
trust(USDB(10), dan);
162 env.
trust(USDC(10), alice, dan);
163 env.
trust(USDD(20), erin);
165 env(
rate(carol, 1.1));
168 env(
pay(carol, alice, USDC(10)));
169 env(
pay(alice, erin, USDD(5)),
180 Env env(*
this, features);
182 env.
fund(
XRP(10000), alice, bob, carol);
183 env.
trust(USDA(10), bob);
184 env.
trust(USDB(10), carol);
186 env(
pay(alice, carol, USDB(5)),
192 env(
pay(alice, carol, USDB(5)),
205 auto const alice =
Account(
"alice");
206 auto const bob =
Account(
"bob");
207 auto const carol =
Account(
"carol");
208 auto const dan =
Account(
"dan");
209 auto const USDA = alice[
"USD"];
210 auto const USDB = bob[
"USD"];
211 auto const USDC = carol[
"USD"];
212 auto const USDD = dan[
"USD"];
215 for (
auto bobDanQIn : {80, 100, 120})
216 for (
auto bobAliceQOut : {80, 100, 120})
218 Env env(*
this, features);
219 env.
fund(
XRP(10000), alice, bob, carol, dan);
222 env(
trust(carol, USDA(100)));
224 env(
pay(alice, bob, USDA(100)));
226 env(
pay(dan, carol, USDA(10)),
231 if (bobAliceQOut > bobDanQIn)
234 USDD(10.0 *
double(bobAliceQOut) /
double(bobDanQIn))));
241 for (
auto carolAliceQIn : {80, 100, 120})
243 Env env(*
this, features);
244 env.
fund(
XRP(10000), alice, bob, carol);
245 env(
trust(bob, USDA(10)));
248 env(
pay(alice, bob, USDA(10)));
250 env(
pay(bob, carol, USDA(5)),
sendmax(USDA(10)));
251 auto const effectiveQ =
252 carolAliceQIn > 100 ? 1.0 : carolAliceQIn / 100.0;
257 for (
auto bobAliceQOut : {80, 100, 120})
259 Env env(*
this, features);
260 env.
fund(
XRP(10000), alice, bob, carol);
262 env(
trust(carol, USDA(10)));
264 env(
pay(alice, bob, USDA(10)));
266 env(
pay(bob, carol, USDA(5)),
sendmax(USDA(5)));
279 auto const gw =
Account(
"gateway");
280 auto const USD = gw[
"USD"];
281 auto const BTC = gw[
"BTC"];
282 auto const EUR = gw[
"EUR"];
289 Env env(*
this, features);
291 env.
fund(
XRP(10000), alice, bob, carol, gw);
292 env.
trust(USD(1000), alice, bob, carol);
293 env.
trust(BTC(1000), alice, bob, carol);
295 env(
pay(gw, alice, BTC(50)));
296 env(
pay(gw, bob, USD(50)));
298 env(
offer(bob, BTC(50), USD(50)));
306 BEAST_EXPECT(!
isOffer(env, bob, BTC(50), USD(50)));
310 Env env(*
this, features);
312 env.
fund(
XRP(10000), alice, bob, carol, gw);
313 env.
trust(USD(1000), alice, bob, carol);
314 env.
trust(BTC(1000), alice, bob, carol);
316 env(
pay(gw, alice, BTC(50)));
317 env(
pay(gw, bob, USD(50)));
328 BEAST_EXPECT(!
isOffer(env, bob,
XRP(50), USD(50)));
329 BEAST_EXPECT(!
isOffer(env, bob, BTC(50),
XRP(50)));
333 Env env(*
this, features);
335 env.
fund(
XRP(10000), alice, bob, carol, gw);
336 env.
trust(USD(1000), alice, bob, carol);
337 env.
trust(BTC(1000), alice, bob, carol);
339 env(
pay(gw, bob, USD(50)));
349 BEAST_EXPECT(!
isOffer(env, bob,
XRP(50), USD(50)));
353 Env env(*
this, features);
355 env.
fund(
XRP(10000), alice, bob, carol, gw);
356 env.
trust(USD(1000), alice, bob, carol);
357 env.
trust(BTC(1000), alice, bob, carol);
359 env(
pay(gw, alice, USD(50)));
369 BEAST_EXPECT(!
isOffer(env, bob, USD(50),
XRP(50)));
373 Env env(*
this, features);
375 env.
fund(
XRP(10000), alice, bob, carol, gw);
376 env.
trust(USD(1000), alice, bob, carol);
377 env.
trust(BTC(1000), alice, bob, carol);
378 env.
trust(EUR(1000), alice, bob, carol);
380 env(
pay(gw, alice, BTC(60)));
381 env(
pay(gw, bob, USD(50)));
382 env(
pay(gw, bob, EUR(50)));
384 env(
offer(bob, BTC(50), USD(50)));
385 env(
offer(bob, BTC(40), EUR(50)));
386 env(
offer(bob, EUR(50), USD(50)));
389 env(
pay(bob, gw, EUR(50)));
390 BEAST_EXPECT(
isOffer(env, bob, BTC(50), USD(50)));
391 BEAST_EXPECT(
isOffer(env, bob, BTC(40), EUR(50)));
392 BEAST_EXPECT(
isOffer(env, bob, EUR(50), USD(50)));
394 env(
pay(alice, carol, USD(50)),
405 BEAST_EXPECT(!
isOffer(env, bob, BTC(50), USD(50)));
407 BEAST_EXPECT(!
isOffer(env, bob, BTC(40), EUR(50)));
409 BEAST_EXPECT(
isOffer(env, bob, EUR(50), USD(50)));
420 Env env(*
this, features);
422 env.
fund(
XRP(10000), alice, bob, carol, gw);
423 env.
trust(USD(1000), alice, bob, carol);
424 env.
trust(BTC(1000), alice, bob, carol);
425 env.
trust(EUR(1000), alice, bob, carol);
427 env(
pay(gw, alice, BTC(60)));
428 env(
pay(gw, bob, USD(60)));
429 env(
pay(gw, bob, EUR(50)));
430 env(
pay(gw, carol, EUR(1)));
432 env(
offer(bob, BTC(50), USD(50)));
433 env(
offer(bob, BTC(60), EUR(50)));
434 env(
offer(carol, BTC(1000), EUR(1)));
435 env(
offer(bob, EUR(50), USD(50)));
438 env(
pay(bob, gw, EUR(50)));
439 BEAST_EXPECT(
isOffer(env, bob, BTC(50), USD(50)));
440 BEAST_EXPECT(
isOffer(env, bob, BTC(60), EUR(50)));
441 BEAST_EXPECT(
isOffer(env, carol, BTC(1000), EUR(1)));
444 auto const flowResult = [&] {
480 BEAST_EXPECT(flowResult.removableOffers.size() == 1);
483 if (flowResult.removableOffers.empty())
486 for (
auto const& o : flowResult.removableOffers)
494 BEAST_EXPECT(
isOffer(env, bob, BTC(50), USD(50)));
495 BEAST_EXPECT(
isOffer(env, carol, BTC(1000), EUR(1)));
497 BEAST_EXPECT(!
isOffer(env, bob, BTC(60), EUR(50)));
507 Env env(*
this, features);
508 env.
fund(
XRP(10000), alice, bob, carol, gw);
509 env.
trust(USD(1000), alice, bob, carol);
510 env.
trust(EUR(1000), alice, bob, carol);
512 env(
pay(gw, alice, USD(1000)));
513 env(
pay(gw, bob, EUR(1000)));
519 bool const reducedOffersV2 = features[fixReducedOffersV2];
525 TER const expectedTER =
527 env(
pay(alice, carol, EUR(1)),
533 if (!reducedOffersV2)
541 if (BEAST_EXPECT(usdOffer))
547 to_string(usdOffer->at(sfBookDirectory));
548 bookDirStr.
erase(0, 48);
552 usdOffer->at(sfTakerGets), usdOffer->at(sfTakerPays));
558 BEAST_EXPECT(actualRate > bookRate);
571 auto const gw =
Account(
"gateway");
572 auto const USD = gw[
"USD"];
573 auto const BTC = gw[
"BTC"];
574 auto const EUR = gw[
"EUR"];
582 Env env(*
this, features);
584 env.
fund(
XRP(10000), alice, bob, carol, gw);
586 env.
trust(USD(1000), alice, bob, carol);
587 env(
pay(gw, alice, USD(50)));
589 env(
pay(alice, bob, USD(40)),
sendmax(USD(50)));
594 Env env(*
this, features);
596 env.
fund(
XRP(10000), alice, bob, carol, gw);
598 env.
trust(USD(1000), alice, bob, carol);
599 env(
pay(gw, alice, USD(50)));
601 env(
pay(alice, gw, USD(40)),
sendmax(USD(40)));
606 Env env(*
this, features);
608 env.
fund(
XRP(10000), alice, bob, carol, gw);
610 env.
trust(USD(1000), alice, bob, carol);
611 env(
pay(gw, bob, USD(65)));
624 Env env(*
this, features);
626 env.
fund(
XRP(10000), alice, bob, carol, gw);
628 env.
trust(USD(1000), alice, bob, carol);
629 env.
trust(EUR(1000), alice, bob, carol);
630 env(
pay(gw, bob, USD(50)));
631 env(
pay(gw, bob, EUR(50)));
634 env(
offer(bob, USD(50), EUR(50)));
647 Env env(*
this, features);
648 auto const USDA = alice[
"USD"];
649 auto const USDB = bob[
"USD"];
651 env.
fund(
XRP(10000), alice, bob, carol, gw);
653 env.
trust(USD(1000), alice, bob, carol);
654 env.
trust(USDA(1000), bob);
655 env.
trust(USDB(1000), gw);
656 env(
pay(gw, bob, USD(50)));
668 Env env(*
this, features);
669 auto const USDA = alice[
"USD"];
670 auto const USDB = bob[
"USD"];
673 env.
fund(
XRP(10000), alice, bob, carol, dan, gw);
675 env.
trust(USD(1000), alice, bob, carol, dan);
676 env.
trust(EUR(1000), carol, dan);
677 env.
trust(USDA(1000), bob);
678 env.
trust(USDB(1000), gw);
679 env(
pay(gw, bob, USD(50)));
680 env(
pay(gw, dan, EUR(100)));
681 env(
offer(dan, USD(100), EUR(100)));
684 env(
pay(alice, carol, EUR(50)),
698 Env env(*
this, features);
700 env.
fund(
XRP(10000), alice, bob, gw);
702 env.
trust(USD(1000), alice, bob);
709 if (!features[featureOwnerPaysFee])
712 Env env(*
this, features);
714 env.
fund(
XRP(10000), alice, bob, gw);
716 env.
trust(USD(1000), alice, bob);
732 auto const gw =
Account(
"gateway");
733 auto const USD = gw[
"USD"];
734 auto const EUR = gw[
"EUR"];
739 Env env(*
this, features);
741 env.
fund(
XRP(10000), alice, carol, gw);
743 env.
trust(USD(1000), alice, bob, carol);
744 env.
trust(EUR(1000), alice, bob, carol);
746 env(
pay(gw, alice, EUR(50)));
747 env(
pay(gw, bob, USD(50)));
759 env(
pay(alice, carol, USD(1000000)),
765 BEAST_EXPECT(carolUSD > USD(0) && carolUSD < USD(50));
778 auto const gw =
Account(
"gateway");
779 auto const USD = gw[
"USD"];
787 env.
fund(
XRP(10000), alice, bob, carol, gw);
789 env.
trust(USD(100), alice, bob, carol);
790 env(
pay(gw, bob, USD(100)));
794 env(
pay(alice, carol, USD(100)),
808 return env.
current()->fees().accountReserve(count);
820 if (sle->getType() == ltOFFER)
821 result.push_back(sle);
838 auto const gw1 =
Account(
"gw1");
839 auto const gw2 =
Account(
"gw2");
840 auto const alice =
Account(
"alice");
841 auto const USD = gw1[
"USD"];
842 auto const EUR = gw2[
"EUR"];
844 Env env(*
this, features);
846 env.
fund(
XRP(1000000), gw1, gw2);
850 auto const f = env.
current()->fees().base;
855 env(
trust(alice, USD(2000)));
856 env(
trust(alice, EUR(2000)));
859 env(
pay(gw1, alice, USD(1)));
860 env(
pay(gw2, alice, EUR(1000)));
863 env(
offer(alice, USD(500), EUR(600)));
871 BEAST_EXPECT(aliceOffers.size() == 1);
872 for (
auto const& offerPtr : aliceOffers)
874 auto const offer = *offerPtr;
875 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
876 BEAST_EXPECT(
offer[sfTakerGets] == EUR(600));
877 BEAST_EXPECT(
offer[sfTakerPays] == USD(500));
880 env(
pay(alice, alice, EUR(600)),
889 BEAST_EXPECT(aliceOffers.size() == 1);
890 for (
auto const& offerPtr : aliceOffers)
892 auto const offer = *offerPtr;
893 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
894 BEAST_EXPECT(
offer[sfTakerGets] == EUR(598.8));
895 BEAST_EXPECT(
offer[sfTakerPays] == USD(499));
909 auto const gw1 =
Account(
"gw1");
910 auto const gw2 =
Account(
"gw2");
911 auto const alice =
Account(
"alice");
912 auto const USD = gw1[
"USD"];
913 auto const EUR = gw2[
"EUR"];
915 Env env(*
this, features);
917 env.
fund(
XRP(1000000), gw1, gw2);
921 auto const f = env.
current()->fees().base;
926 env(
trust(alice, USD(506)));
927 env(
trust(alice, EUR(606)));
930 env(
pay(gw1, alice, USD(500)));
931 env(
pay(gw2, alice, EUR(600)));
934 env(
offer(alice, USD(500), EUR(600)));
942 BEAST_EXPECT(aliceOffers.size() == 1);
943 for (
auto const& offerPtr : aliceOffers)
945 auto const offer = *offerPtr;
946 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
947 BEAST_EXPECT(
offer[sfTakerGets] == EUR(600));
948 BEAST_EXPECT(
offer[sfTakerPays] == USD(500));
951 env(
pay(alice, alice, EUR(60)),
960 BEAST_EXPECT(aliceOffers.size() == 1);
961 for (
auto const& offerPtr : aliceOffers)
963 auto const offer = *offerPtr;
964 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
965 BEAST_EXPECT(
offer[sfTakerGets] == EUR(594));
966 BEAST_EXPECT(
offer[sfTakerPays] == USD(495));
977 testcase(
"Self funded XRPEndpoint");
981 Env env(*
this, features);
983 auto const alice =
Account(
"alice");
985 auto const USD = gw[
"USD"];
987 env.
fund(
XRP(10000), alice, gw);
988 env(
trust(alice, USD(20)));
989 env(
pay(gw, alice, USD(10)));
990 env(
offer(alice,
XRP(50000), USD(10)));
994 auto const toSend = consumeOffer ? USD(10) : USD(9);
995 env(
pay(alice, alice, toSend),
1006 using namespace jtx;
1009 Env env(*
this, features);
1011 auto const alice =
Account(
"alice");
1012 auto const bob =
Account(
"bob");
1013 auto const gw =
Account(
"gw");
1014 auto const USD = gw[
"USD"];
1016 env.
fund(
XRP(100000), alice, bob, gw);
1017 env(
trust(bob, USD(20)));
1033 env(
pay(alice, bob, tinyAmt1),
1038 BEAST_EXPECT(!
isOffer(env, gw,
XRP(0), USD(0)));
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);
1050 env(
trust(alice, USD(20)));
1065 env(
pay(gw, alice, tinyAmt1));
1068 env(
pay(alice, bob,
drops(9000000000)),
1073 BEAST_EXPECT(!
isOffer(env, gw, USD(0),
XRP(0)));
1082 using namespace jtx;
1083 Env env(*
this, features);
1085 auto const alice =
Account(
"alice");
1086 auto const bob =
Account(
"bob");
1087 auto const gw =
Account(
"gw");
1088 auto const USD = gw[
"USD"];
1089 auto const usdC = USD.currency;
1091 env.
fund(
XRP(10000), alice, bob, gw);
1093 env(
trust(alice, USD(100)));
1133 env(
pay(alice, bob,
XRP(10000)),
1144 using namespace jtx;
1146 auto const alice =
Account(
"alice");
1147 auto const bob =
Account(
"bob");
1148 auto const carol =
Account(
"carol");
1149 auto const gw =
Account(
"gw");
1152 env.
trust(gw[
"USD"](10000), alice, carol);
1154 env.
trust(gw[
"USD"](10000), bob);
1159 env(
pay(gw, alice, gw[
"USD"](1000)));
1162 env(
offer(alice, bob[
"USD"](1000),
XRP(1)));
1165 env(
pay(alice, alice,
XRP(1)),
1172 env.
trust(bob[
"USD"](10000), alice);
1173 env(
pay(bob, alice, bob[
"USD"](1000)));
1175 env(
offer(alice,
XRP(1000), bob[
"USD"](1000)));
1178 env(
pay(carol, carol, gw[
"USD"](1000)),
1179 path(~bob[
"USD"], gw),
1193 using namespace jtx;
1200 auto const alice =
Account(
"alice");
1201 auto const bob =
Account(
"bob");
1202 auto const carol =
Account(
"carol");
1203 auto const gw =
Account(
"gw");
1204 auto const USD = gw[
"USD"];
1206 env.
fund(
XRP(100000000), alice, bob, carol, gw);
1208 env.
trust(USD(10000), alice, carol);
1210 env.
trust(USD(10000), bob);
1211 env.
trust(bob[
"USD"](10000), carol);
1214 env(
pay(bob, carol, bob[
"USD"](1000)));
1215 env(
pay(gw, bob, USD(1000)));
1218 env(
offer(carol,
XRP(1), bob[
"USD"](1000)));
1221 env(
pay(alice, alice, USD(1000)),
1222 path(~bob[
"USD"], bob, gw),
1235 testcase(
"Self crossing low quality offer");
1237 using namespace jtx;
1239 Env env(*
this, features);
1241 auto const ann =
Account(
"ann");
1242 auto const gw =
Account(
"gateway");
1243 auto const CTB = gw[
"CTB"];
1250 env(
rate(gw, 1.002));
1251 env(
trust(ann, CTB(10)));
1254 env(
pay(gw, ann, CTB(2.856)));
1257 env(
offer(ann,
drops(365611702030), CTB(5.713)));
1261 env(
pay(ann, ann, CTB(0.687)),
1270 using namespace jtx;
1272 auto const alice =
Account(
"alice");
1274 Env env(*
this, features);
1278 env(
pay(alice, alice, alice[
"USD"](100)),
1279 path(~alice[
"USD"]),
1288 using namespace jtx;
1289 auto const alice =
Account(
"alice");
1290 auto const bob =
Account(
"bob");
1291 auto const gw =
Account(
"gw");
1292 auto const USD = gw[
"USD"];
1293 auto const EUR = gw[
"EUR"];
1295 for (
auto const withFix : {
true,
false})
1304 Env env(*
this, feats);
1305 env.
fund(
XRP(10000), alice, bob, gw);
1306 env.
trust(USD(1000), alice, bob);
1307 env.
trust(EUR(1000), alice, bob);
1308 env(
pay(gw, alice, USD(100)));
1309 env(
pay(gw, alice, EUR(100)));
1317 TER const expectedTer =
1319 env(
pay(alice, bob, EUR(1)),
1330 env.
fund(
XRP(10000), alice, bob, gw);
1331 env.
trust(USD(1000), alice, bob);
1332 env.
trust(EUR(1000), alice, bob);
1333 env(
pay(gw, alice, USD(100)));
1334 env(
pay(gw, alice, EUR(100)));
1341 env(
pay(alice, bob,
XRP(1)),
1350 auto const JPY = gw[
"JPY"];
1352 env.
fund(
XRP(10000), alice, bob, gw);
1354 env.
trust(USD(1000), alice, bob);
1355 env.
trust(EUR(1000), alice, bob);
1356 env.
trust(JPY(1000), alice, bob);
1358 env(
pay(gw, alice, USD(100)));
1359 env(
pay(gw, alice, EUR(100)));
1360 env(
pay(gw, alice, JPY(100)));
1369 env(
pay(alice, bob, JPY(1)),
1381 using namespace jtx;
1383 auto const alice =
Account(
"alice");
1384 auto const bob =
Account(
"bob");
1386 Env env(*
this, features);
1404 using namespace jtx;
1434 using namespace jtx;
1447 using namespace jtx;
1462BEAST_DEFINE_TESTSUITE_PRIO(Flow, app,
ripple, 2);
1463BEAST_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