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);
76 env.
trust(USD(1000), alice, bob);
77 env(
pay(gw, alice, USD(100)));
78 env(
pay(alice, bob, USD(10)),
paths(USD));
83 Env env(*
this, features);
85 env.
fund(
XRP(10000), alice, bob);
86 env(
pay(alice, bob,
XRP(100)));
92 Env env(*
this, features);
94 env.
fund(
XRP(10000), alice, bob, gw);
95 env.
trust(USD(1000), alice, bob);
96 env(
pay(gw, alice, USD(100)));
99 env(
pay(alice, bob, USD(110)),
106 Env env(*
this, features);
108 env.
fund(
XRP(10000), alice, bob, carol, dan);
109 env.
trust(USDA(10), bob);
110 env.
trust(USDB(10), carol);
111 env.
trust(USDC(10), dan);
112 env(
pay(alice, dan, USDC(10)),
paths(USDA));
121 Env env(*
this, features);
123 env.
fund(
XRP(10000), alice, bob, carol, dan);
124 env.
trust(USDA(10), bob);
125 env.
trust(USDB(10), alice, carol);
126 env.
trust(USDC(10), dan);
130 env(
pay(bob, alice, USDB(6)));
131 env(
pay(alice, dan, USDC(5)),
141 Env env(*
this, features);
143 env.
fund(
XRP(10000), alice, bob, carol, dan);
144 env.
trust(USDA(10), bob);
145 env.
trust(USDB(10), alice, carol);
146 env.
trust(USDC(10), dan);
149 env(
pay(alice, dan, USDC(5)),
159 Env env(*
this, features);
161 env.
fund(
XRP(10000), alice, bob, carol, dan, erin);
162 env.
trust(USDA(10), bob, carol);
163 env.
trust(USDB(10), dan);
164 env.
trust(USDC(10), alice, dan);
165 env.
trust(USDD(20), erin);
167 env(
rate(carol, 1.1));
170 env(
pay(carol, alice, USDC(10)));
171 env(
pay(alice, erin, USDD(5)),
182 Env env(*
this, features);
184 env.
fund(
XRP(10000), alice, bob, carol);
185 env.
trust(USDA(10), bob);
186 env.
trust(USDB(10), carol);
188 env(
pay(alice, carol, USDB(5)),
194 env(
pay(alice, carol, USDB(5)),
207 auto const alice =
Account(
"alice");
208 auto const bob =
Account(
"bob");
209 auto const carol =
Account(
"carol");
210 auto const dan =
Account(
"dan");
211 auto const USDA = alice[
"USD"];
212 auto const USDB = bob[
"USD"];
213 auto const USDC = carol[
"USD"];
214 auto const USDD = dan[
"USD"];
217 for (
auto bobDanQIn : {80, 100, 120})
218 for (
auto bobAliceQOut : {80, 100, 120})
220 Env env(*
this, features);
221 env.
fund(
XRP(10000), alice, bob, carol, dan);
224 env(
trust(carol, USDA(100)));
226 env(
pay(alice, bob, USDA(100)));
228 env(
pay(dan, carol, USDA(10)),
233 if (bobAliceQOut > bobDanQIn)
236 USDD(10.0 *
double(bobAliceQOut) /
double(bobDanQIn))));
243 for (
auto carolAliceQIn : {80, 100, 120})
245 Env env(*
this, features);
246 env.
fund(
XRP(10000), alice, bob, carol);
247 env(
trust(bob, USDA(10)));
250 env(
pay(alice, bob, USDA(10)));
252 env(
pay(bob, carol, USDA(5)),
sendmax(USDA(10)));
253 auto const effectiveQ =
254 carolAliceQIn > 100 ? 1.0 : carolAliceQIn / 100.0;
259 for (
auto bobAliceQOut : {80, 100, 120})
261 Env env(*
this, features);
262 env.
fund(
XRP(10000), alice, bob, carol);
264 env(
trust(carol, USDA(10)));
266 env(
pay(alice, bob, USDA(10)));
268 env(
pay(bob, carol, USDA(5)),
sendmax(USDA(5)));
281 auto const gw =
Account(
"gateway");
282 auto const USD = gw[
"USD"];
283 auto const BTC = gw[
"BTC"];
284 auto const EUR = gw[
"EUR"];
291 Env env(*
this, features);
293 env.
fund(
XRP(10000), alice, bob, carol, gw);
294 env.
trust(USD(1000), alice, bob, carol);
295 env.
trust(BTC(1000), alice, bob, carol);
297 env(
pay(gw, alice, BTC(50)));
298 env(
pay(gw, bob, USD(50)));
300 env(
offer(bob, BTC(50), USD(50)));
308 BEAST_EXPECT(!
isOffer(env, bob, BTC(50), USD(50)));
312 Env env(*
this, features);
314 env.
fund(
XRP(10000), alice, bob, carol, gw);
315 env.
trust(USD(1000), alice, bob, carol);
316 env.
trust(BTC(1000), alice, bob, carol);
318 env(
pay(gw, alice, BTC(50)));
319 env(
pay(gw, bob, USD(50)));
330 BEAST_EXPECT(!
isOffer(env, bob,
XRP(50), USD(50)));
331 BEAST_EXPECT(!
isOffer(env, bob, BTC(50),
XRP(50)));
335 Env env(*
this, features);
337 env.
fund(
XRP(10000), alice, bob, carol, gw);
338 env.
trust(USD(1000), alice, bob, carol);
339 env.
trust(BTC(1000), alice, bob, carol);
341 env(
pay(gw, bob, USD(50)));
351 BEAST_EXPECT(!
isOffer(env, bob,
XRP(50), USD(50)));
355 Env env(*
this, features);
357 env.
fund(
XRP(10000), alice, bob, carol, gw);
358 env.
trust(USD(1000), alice, bob, carol);
359 env.
trust(BTC(1000), alice, bob, carol);
361 env(
pay(gw, alice, USD(50)));
371 BEAST_EXPECT(!
isOffer(env, bob, USD(50),
XRP(50)));
375 Env env(*
this, features);
377 env.
fund(
XRP(10000), alice, bob, carol, gw);
378 env.
trust(USD(1000), alice, bob, carol);
379 env.
trust(BTC(1000), alice, bob, carol);
380 env.
trust(EUR(1000), alice, bob, carol);
382 env(
pay(gw, alice, BTC(60)));
383 env(
pay(gw, bob, USD(50)));
384 env(
pay(gw, bob, EUR(50)));
386 env(
offer(bob, BTC(50), USD(50)));
387 env(
offer(bob, BTC(40), EUR(50)));
388 env(
offer(bob, EUR(50), USD(50)));
391 env(
pay(bob, gw, EUR(50)));
392 BEAST_EXPECT(
isOffer(env, bob, BTC(50), USD(50)));
393 BEAST_EXPECT(
isOffer(env, bob, BTC(40), EUR(50)));
394 BEAST_EXPECT(
isOffer(env, bob, EUR(50), USD(50)));
396 env(
pay(alice, carol, USD(50)),
407 BEAST_EXPECT(!
isOffer(env, bob, BTC(50), USD(50)));
409 BEAST_EXPECT(!
isOffer(env, bob, BTC(40), EUR(50)));
411 BEAST_EXPECT(
isOffer(env, bob, EUR(50), USD(50)));
422 Env env(*
this, features);
424 env.
fund(
XRP(10000), alice, bob, carol, gw);
425 env.
trust(USD(1000), alice, bob, carol);
426 env.
trust(BTC(1000), alice, bob, carol);
427 env.
trust(EUR(1000), alice, bob, carol);
429 env(
pay(gw, alice, BTC(60)));
430 env(
pay(gw, bob, USD(60)));
431 env(
pay(gw, bob, EUR(50)));
432 env(
pay(gw, carol, EUR(1)));
434 env(
offer(bob, BTC(50), USD(50)));
435 env(
offer(bob, BTC(60), EUR(50)));
436 env(
offer(carol, BTC(1000), EUR(1)));
437 env(
offer(bob, EUR(50), USD(50)));
440 env(
pay(bob, gw, EUR(50)));
441 BEAST_EXPECT(
isOffer(env, bob, BTC(50), USD(50)));
442 BEAST_EXPECT(
isOffer(env, bob, BTC(60), EUR(50)));
443 BEAST_EXPECT(
isOffer(env, carol, BTC(1000), EUR(1)));
446 auto const flowResult = [&] {
482 BEAST_EXPECT(flowResult.removableOffers.size() == 1);
485 if (flowResult.removableOffers.empty())
488 for (
auto const& o : flowResult.removableOffers)
496 BEAST_EXPECT(
isOffer(env, bob, BTC(50), USD(50)));
497 BEAST_EXPECT(
isOffer(env, carol, BTC(1000), EUR(1)));
499 BEAST_EXPECT(!
isOffer(env, bob, BTC(60), EUR(50)));
509 Env env(*
this, features);
510 env.
fund(
XRP(10000), alice, bob, carol, gw);
511 env.
trust(USD(1000), alice, bob, carol);
512 env.
trust(EUR(1000), alice, bob, carol);
514 env(
pay(gw, alice, USD(1000)));
515 env(
pay(gw, bob, EUR(1000)));
521 bool const reducedOffersV2 = features[fixReducedOffersV2];
527 TER const expectedTER =
529 env(
pay(alice, carol, EUR(1)),
535 if (!reducedOffersV2)
543 if (BEAST_EXPECT(usdOffer))
549 to_string(usdOffer->at(sfBookDirectory));
550 bookDirStr.
erase(0, 48);
554 usdOffer->at(sfTakerGets), usdOffer->at(sfTakerPays));
560 BEAST_EXPECT(actualRate > bookRate);
573 auto const gw =
Account(
"gateway");
574 auto const USD = gw[
"USD"];
575 auto const BTC = gw[
"BTC"];
576 auto const EUR = gw[
"EUR"];
584 Env env(*
this, features);
586 env.
fund(
XRP(10000), alice, bob, carol, gw);
588 env.
trust(USD(1000), alice, bob, carol);
589 env(
pay(gw, alice, USD(50)));
591 env(
pay(alice, bob, USD(40)),
sendmax(USD(50)));
596 Env env(*
this, features);
598 env.
fund(
XRP(10000), alice, bob, carol, gw);
600 env.
trust(USD(1000), alice, bob, carol);
601 env(
pay(gw, alice, USD(50)));
603 env(
pay(alice, gw, USD(40)),
sendmax(USD(40)));
608 Env env(*
this, features);
610 env.
fund(
XRP(10000), alice, bob, carol, gw);
612 env.
trust(USD(1000), alice, bob, carol);
613 env(
pay(gw, bob, USD(65)));
626 Env env(*
this, features);
628 env.
fund(
XRP(10000), alice, bob, carol, gw);
630 env.
trust(USD(1000), alice, bob, carol);
631 env.
trust(EUR(1000), alice, bob, carol);
632 env(
pay(gw, bob, USD(50)));
633 env(
pay(gw, bob, EUR(50)));
636 env(
offer(bob, USD(50), EUR(50)));
649 Env env(*
this, features);
650 auto const USDA = alice[
"USD"];
651 auto const USDB = bob[
"USD"];
653 env.
fund(
XRP(10000), alice, bob, carol, gw);
655 env.
trust(USD(1000), alice, bob, carol);
656 env.
trust(USDA(1000), bob);
657 env.
trust(USDB(1000), gw);
658 env(
pay(gw, bob, USD(50)));
670 Env env(*
this, features);
671 auto const USDA = alice[
"USD"];
672 auto const USDB = bob[
"USD"];
675 env.
fund(
XRP(10000), alice, bob, carol, dan, gw);
677 env.
trust(USD(1000), alice, bob, carol, dan);
678 env.
trust(EUR(1000), carol, dan);
679 env.
trust(USDA(1000), bob);
680 env.
trust(USDB(1000), gw);
681 env(
pay(gw, bob, USD(50)));
682 env(
pay(gw, dan, EUR(100)));
683 env(
offer(dan, USD(100), EUR(100)));
686 env(
pay(alice, carol, EUR(50)),
700 Env env(*
this, features);
702 env.
fund(
XRP(10000), alice, bob, gw);
704 env.
trust(USD(1000), alice, bob);
711 if (!features[featureOwnerPaysFee])
714 Env env(*
this, features);
716 env.
fund(
XRP(10000), alice, bob, gw);
718 env.
trust(USD(1000), alice, bob);
734 auto const gw =
Account(
"gateway");
735 auto const USD = gw[
"USD"];
736 auto const EUR = gw[
"EUR"];
741 Env env(*
this, features);
743 env.
fund(
XRP(10000), alice, carol, gw);
745 env.
trust(USD(1000), alice, bob, carol);
746 env.
trust(EUR(1000), alice, bob, carol);
748 env(
pay(gw, alice, EUR(50)));
749 env(
pay(gw, bob, USD(50)));
761 env(
pay(alice, carol, USD(1000000)),
767 BEAST_EXPECT(carolUSD > USD(0) && carolUSD < USD(50));
780 auto const gw =
Account(
"gateway");
781 auto const USD = gw[
"USD"];
789 env.
fund(
XRP(10000), alice, bob, carol, gw);
791 env.
trust(USD(100), alice, bob, carol);
792 env(
pay(gw, bob, USD(100)));
796 env(
pay(alice, carol, USD(100)),
810 return env.
current()->fees().accountReserve(count);
822 if (sle->getType() == ltOFFER)
823 result.push_back(sle);
840 auto const gw1 =
Account(
"gw1");
841 auto const gw2 =
Account(
"gw2");
842 auto const alice =
Account(
"alice");
843 auto const USD = gw1[
"USD"];
844 auto const EUR = gw2[
"EUR"];
846 Env env(*
this, features);
848 env.
fund(
XRP(1000000), gw1, gw2);
852 auto const f = env.
current()->fees().base;
857 env(
trust(alice, USD(2000)));
858 env(
trust(alice, EUR(2000)));
861 env(
pay(gw1, alice, USD(1)));
862 env(
pay(gw2, alice, EUR(1000)));
865 env(
offer(alice, USD(500), EUR(600)));
873 BEAST_EXPECT(aliceOffers.size() == 1);
874 for (
auto const& offerPtr : aliceOffers)
876 auto const offer = *offerPtr;
877 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
878 BEAST_EXPECT(
offer[sfTakerGets] == EUR(600));
879 BEAST_EXPECT(
offer[sfTakerPays] == USD(500));
882 env(
pay(alice, alice, EUR(600)),
891 BEAST_EXPECT(aliceOffers.size() == 1);
892 for (
auto const& offerPtr : aliceOffers)
894 auto const offer = *offerPtr;
895 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
896 BEAST_EXPECT(
offer[sfTakerGets] == EUR(598.8));
897 BEAST_EXPECT(
offer[sfTakerPays] == USD(499));
911 auto const gw1 =
Account(
"gw1");
912 auto const gw2 =
Account(
"gw2");
913 auto const alice =
Account(
"alice");
914 auto const USD = gw1[
"USD"];
915 auto const EUR = gw2[
"EUR"];
917 Env env(*
this, features);
919 env.
fund(
XRP(1000000), gw1, gw2);
923 auto const f = env.
current()->fees().base;
928 env(
trust(alice, USD(506)));
929 env(
trust(alice, EUR(606)));
932 env(
pay(gw1, alice, USD(500)));
933 env(
pay(gw2, alice, EUR(600)));
936 env(
offer(alice, USD(500), EUR(600)));
944 BEAST_EXPECT(aliceOffers.size() == 1);
945 for (
auto const& offerPtr : aliceOffers)
947 auto const offer = *offerPtr;
948 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
949 BEAST_EXPECT(
offer[sfTakerGets] == EUR(600));
950 BEAST_EXPECT(
offer[sfTakerPays] == USD(500));
953 env(
pay(alice, alice, EUR(60)),
962 BEAST_EXPECT(aliceOffers.size() == 1);
963 for (
auto const& offerPtr : aliceOffers)
965 auto const offer = *offerPtr;
966 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
967 BEAST_EXPECT(
offer[sfTakerGets] == EUR(594));
968 BEAST_EXPECT(
offer[sfTakerPays] == USD(495));
979 testcase(
"Self funded XRPEndpoint");
983 Env env(*
this, features);
985 auto const alice =
Account(
"alice");
987 auto const USD = gw[
"USD"];
989 env.
fund(
XRP(10000), alice, gw);
990 env(
trust(alice, USD(20)));
991 env(
pay(gw, alice, USD(10)));
992 env(
offer(alice,
XRP(50000), USD(10)));
996 auto const toSend = consumeOffer ? USD(10) : USD(9);
997 env(
pay(alice, alice, toSend),
1008 using namespace jtx;
1011 Env env(*
this, features);
1013 auto const alice =
Account(
"alice");
1014 auto const bob =
Account(
"bob");
1015 auto const gw =
Account(
"gw");
1016 auto const USD = gw[
"USD"];
1018 env.
fund(
XRP(100000), alice, bob, gw);
1019 env(
trust(bob, USD(20)));
1035 env(
pay(alice, bob, tinyAmt1),
1040 BEAST_EXPECT(!
isOffer(env, gw,
XRP(0), USD(0)));
1044 Env env(*
this, features);
1046 auto const alice =
Account(
"alice");
1047 auto const bob =
Account(
"bob");
1048 auto const gw =
Account(
"gw");
1049 auto const USD = gw[
"USD"];
1051 env.
fund(
XRP(100000), alice, bob, gw);
1052 env(
trust(alice, USD(20)));
1067 env(
pay(gw, alice, tinyAmt1));
1070 env(
pay(alice, bob,
drops(9000000000)),
1075 BEAST_EXPECT(!
isOffer(env, gw, USD(0),
XRP(0)));
1084 using namespace jtx;
1085 Env env(*
this, features);
1087 auto const alice =
Account(
"alice");
1088 auto const bob =
Account(
"bob");
1089 auto const gw =
Account(
"gw");
1090 auto const USD = gw[
"USD"];
1091 auto const usdC = USD.currency;
1093 env.
fund(
XRP(10000), alice, bob, gw);
1095 env(
trust(alice, USD(100)));
1135 env(
pay(alice, bob,
XRP(10000)),
1146 using namespace jtx;
1148 auto const alice =
Account(
"alice");
1149 auto const bob =
Account(
"bob");
1150 auto const carol =
Account(
"carol");
1151 auto const gw =
Account(
"gw");
1154 env.
trust(gw[
"USD"](10000), alice, carol);
1156 env.
trust(gw[
"USD"](10000), bob);
1161 env(
pay(gw, alice, gw[
"USD"](1000)));
1164 env(
offer(alice, bob[
"USD"](1000),
XRP(1)));
1167 env(
pay(alice, alice,
XRP(1)),
1174 env.
trust(bob[
"USD"](10000), alice);
1175 env(
pay(bob, alice, bob[
"USD"](1000)));
1177 env(
offer(alice,
XRP(1000), bob[
"USD"](1000)));
1180 env(
pay(carol, carol, gw[
"USD"](1000)),
1181 path(~bob[
"USD"], gw),
1195 using namespace jtx;
1202 auto const alice =
Account(
"alice");
1203 auto const bob =
Account(
"bob");
1204 auto const carol =
Account(
"carol");
1205 auto const gw =
Account(
"gw");
1206 auto const USD = gw[
"USD"];
1208 env.
fund(
XRP(100000000), alice, bob, carol, gw);
1210 env.
trust(USD(10000), alice, carol);
1212 env.
trust(USD(10000), bob);
1213 env.
trust(bob[
"USD"](10000), carol);
1216 env(
pay(bob, carol, bob[
"USD"](1000)));
1217 env(
pay(gw, bob, USD(1000)));
1220 env(
offer(carol,
XRP(1), bob[
"USD"](1000)));
1223 env(
pay(alice, alice, USD(1000)),
1224 path(~bob[
"USD"], bob, gw),
1237 testcase(
"Self crossing low quality offer");
1239 using namespace jtx;
1241 Env env(*
this, features);
1243 auto const ann =
Account(
"ann");
1244 auto const gw =
Account(
"gateway");
1245 auto const CTB = gw[
"CTB"];
1252 env(
rate(gw, 1.002));
1253 env(
trust(ann, CTB(10)));
1256 env(
pay(gw, ann, CTB(2.856)));
1259 env(
offer(ann,
drops(365611702030), CTB(5.713)));
1263 env(
pay(ann, ann, CTB(0.687)),
1272 using namespace jtx;
1274 auto const alice =
Account(
"alice");
1276 Env env(*
this, features);
1280 env(
pay(alice, alice, alice[
"USD"](100)),
1281 path(~alice[
"USD"]),
1290 using namespace jtx;
1291 auto const alice =
Account(
"alice");
1292 auto const bob =
Account(
"bob");
1293 auto const gw =
Account(
"gw");
1294 auto const USD = gw[
"USD"];
1295 auto const EUR = gw[
"EUR"];
1297 for (
auto const withFix : {
true,
false})
1306 Env env(*
this, feats);
1307 env.
fund(
XRP(10000), alice, bob, gw);
1308 env.
trust(USD(1000), alice, bob);
1309 env.
trust(EUR(1000), alice, bob);
1310 env(
pay(gw, alice, USD(100)));
1311 env(
pay(gw, alice, EUR(100)));
1319 TER const expectedTer =
1321 env(
pay(alice, bob, EUR(1)),
1332 env.
fund(
XRP(10000), alice, bob, gw);
1333 env.
trust(USD(1000), alice, bob);
1334 env.
trust(EUR(1000), alice, bob);
1335 env(
pay(gw, alice, USD(100)));
1336 env(
pay(gw, alice, EUR(100)));
1343 env(
pay(alice, bob,
XRP(1)),
1352 auto const JPY = gw[
"JPY"];
1354 env.
fund(
XRP(10000), alice, bob, gw);
1356 env.
trust(USD(1000), alice, bob);
1357 env.
trust(EUR(1000), alice, bob);
1358 env.
trust(JPY(1000), alice, bob);
1360 env(
pay(gw, alice, USD(100)));
1361 env(
pay(gw, alice, EUR(100)));
1362 env(
pay(gw, alice, JPY(100)));
1371 env(
pay(alice, bob, JPY(1)),
1383 using namespace jtx;
1385 auto const alice =
Account(
"alice");
1386 auto const bob =
Account(
"bob");
1388 Env env(*
this, features);
1406 using namespace jtx;
1436 using namespace jtx;
1449 using namespace jtx;
1464BEAST_DEFINE_TESTSUITE_PRIO(Flow, app,
ripple, 2);
1465BEAST_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