1#include <test/jtx/Account.h>
2#include <test/jtx/Env.h>
3#include <test/jtx/PathSet.h>
4#include <test/jtx/TestHelpers.h>
5#include <test/jtx/amount.h>
6#include <test/jtx/balance.h>
7#include <test/jtx/offer.h>
8#include <test/jtx/owners.h>
9#include <test/jtx/paths.h>
10#include <test/jtx/pay.h>
11#include <test/jtx/quality.h>
12#include <test/jtx/rate.h>
13#include <test/jtx/sendmax.h>
14#include <test/jtx/ter.h>
15#include <test/jtx/ticket.h>
16#include <test/jtx/trust.h>
17#include <test/jtx/txflags.h>
19#include <xrpl/basics/base_uint.h>
20#include <xrpl/basics/contract.h>
21#include <xrpl/beast/unit_test/suite.h>
22#include <xrpl/core/ServiceRegistry.h>
23#include <xrpl/ledger/ApplyView.h>
24#include <xrpl/ledger/OpenView.h>
25#include <xrpl/ledger/PaymentSandbox.h>
26#include <xrpl/ledger/Sandbox.h>
27#include <xrpl/ledger/helpers/DirectoryHelpers.h>
28#include <xrpl/ledger/helpers/OfferHelpers.h>
29#include <xrpl/protocol/AccountID.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/STPathSet.h>
38#include <xrpl/protocol/TER.h>
39#include <xrpl/protocol/TxFlags.h>
40#include <xrpl/protocol/UintTypes.h>
41#include <xrpl/protocol/XRPAmount.h>
42#include <xrpl/tx/paths/Flow.h>
43#include <xrpl/tx/paths/detail/Steps.h>
62 auto const flag = (src.
id() > dst.
id()) ? lsfHighNoRipple : lsfLowNoRipple;
63 return sle->isFlag(flag);
77 auto const alice =
Account(
"alice");
78 auto const bob =
Account(
"bob");
79 auto const carol =
Account(
"carol");
80 auto const dan =
Account(
"dan");
81 auto const erin =
Account(
"erin");
82 auto const usda = alice[
"USD"];
83 auto const usdb = bob[
"USD"];
84 auto const usdc = carol[
"USD"];
85 auto const usdd = dan[
"USD"];
87 auto const usd = gw[
"USD"];
90 Env env(*
this, features);
92 env.
fund(
XRP(10000), alice, bob, gw);
94 env.
trust(usd(1000), alice, bob);
95 env(
pay(gw, alice, usd(100)));
96 env(
pay(alice, bob, usd(10)),
Paths(usd));
101 Env env(*
this, features);
103 env.
fund(
XRP(10000), alice, bob);
105 env(
pay(alice, bob,
XRP(100)));
111 Env env(*
this, features);
113 env.
fund(
XRP(10000), alice, bob, gw);
115 env.
trust(usd(1000), alice, bob);
116 env(
pay(gw, alice, usd(100)));
124 Env env(*
this, features);
126 env.
fund(
XRP(10000), alice, bob, carol, dan);
128 env.
trust(usda(10), bob);
129 env.
trust(usdb(10), carol);
130 env.
trust(usdc(10), dan);
131 env(
pay(alice, dan, usdc(10)),
Paths(usda));
137 Env env(*
this, features);
139 env.
fund(
XRP(10000), alice, bob, carol, dan);
141 env.
trust(usda(10), bob);
142 env.
trust(usdb(10), alice, carol);
143 env.
trust(usdc(10), dan);
147 env(
pay(bob, alice, usdb(6)));
148 env(
pay(alice, dan, usdc(5)),
158 Env env(*
this, features);
160 env.
fund(
XRP(10000), alice, bob, carol, dan);
162 env.
trust(usda(10), bob);
163 env.
trust(usdb(10), alice, carol);
164 env.
trust(usdc(10), dan);
167 env(
pay(alice, dan, usdc(5)),
177 Env env(*
this, features);
179 env.
fund(
XRP(10000), alice, bob, carol, dan, erin);
181 env.
trust(usda(10), bob, carol);
182 env.
trust(usdb(10), dan);
183 env.
trust(usdc(10), alice, dan);
184 env.
trust(usdd(20), erin);
186 env(
rate(carol, 1.1));
189 env(
pay(carol, alice, usdc(10)));
190 env(
pay(alice, erin, usdd(5)),
201 Env env(*
this, features);
203 env.
fund(
XRP(10000), alice, bob, carol);
205 env.
trust(usda(10), bob);
206 env.
trust(usdb(10), carol);
208 env(
pay(alice, carol, usdb(5)),
210 Txflags(tfLimitQuality | tfPartialPayment),
225 auto const alice =
Account(
"alice");
226 auto const bob =
Account(
"bob");
227 auto const carol =
Account(
"carol");
228 auto const dan =
Account(
"dan");
229 auto const usda = alice[
"USD"];
230 auto const usdb = bob[
"USD"];
231 auto const usdc = carol[
"USD"];
232 auto const usdd = dan[
"USD"];
235 for (
auto bobDanQIn : {80, 100, 120})
237 for (
auto bobAliceQOut : {80, 100, 120})
239 Env env(*
this, features);
240 env.
fund(
XRP(10000), alice, bob, carol, dan);
244 env(
trust(carol, usda(100)));
246 env(
pay(alice, bob, usda(100)));
248 env(
pay(dan, carol, usda(10)),
253 if (bobAliceQOut > bobDanQIn)
256 Balance(bob, usdd(10.0 *
double(bobAliceQOut) /
double(bobDanQIn))));
267 for (
auto carolAliceQIn : {80, 100, 120})
269 Env env(*
this, features);
270 env.
fund(
XRP(10000), alice, bob, carol);
273 env(
trust(bob, usda(10)));
276 env(
pay(alice, bob, usda(10)));
278 env(
pay(bob, carol, usda(5)),
Sendmax(usda(10)));
279 auto const effectiveQ = carolAliceQIn > 100 ? 1.0 : carolAliceQIn / 100.0;
284 for (
auto bobAliceQOut : {80, 100, 120})
286 Env env(*
this, features);
287 env.
fund(
XRP(10000), alice, bob, carol);
290 env(
trust(carol, usda(10)));
292 env(
pay(alice, bob, usda(10)));
294 env(
pay(bob, carol, usda(5)),
Sendmax(usda(5)));
307 auto const gw =
Account(
"gateway");
308 auto const usd = gw[
"USD"];
309 auto const btc = gw[
"BTC"];
310 auto const eur = gw[
"EUR"];
317 Env env(*
this, features);
319 env.
fund(
XRP(10000), alice, bob, carol, gw);
321 env.
trust(usd(1000), alice, bob, carol);
322 env.
trust(btc(1000), alice, bob, carol);
324 env(
pay(gw, alice, btc(50)));
325 env(
pay(gw, bob, usd(50)));
327 env(
offer(bob, btc(50), usd(50)));
335 BEAST_EXPECT(!
isOffer(env, bob, btc(50), usd(50)));
339 Env env(*
this, features);
341 env.
fund(
XRP(10000), alice, bob, carol, gw);
343 env.
trust(usd(1000), alice, bob, carol);
344 env.
trust(btc(1000), alice, bob, carol);
346 env(
pay(gw, alice, btc(50)));
347 env(
pay(gw, bob, usd(50)));
358 BEAST_EXPECT(!
isOffer(env, bob,
XRP(50), usd(50)));
359 BEAST_EXPECT(!
isOffer(env, bob, btc(50),
XRP(50)));
363 Env env(*
this, features);
365 env.
fund(
XRP(10000), alice, bob, carol, gw);
367 env.
trust(usd(1000), alice, bob, carol);
368 env.
trust(btc(1000), alice, bob, carol);
370 env(
pay(gw, bob, usd(50)));
380 BEAST_EXPECT(!
isOffer(env, bob,
XRP(50), usd(50)));
384 Env env(*
this, features);
386 env.
fund(
XRP(10000), alice, bob, carol, gw);
388 env.
trust(usd(1000), alice, bob, carol);
389 env.
trust(btc(1000), alice, bob, carol);
391 env(
pay(gw, alice, usd(50)));
401 BEAST_EXPECT(!
isOffer(env, bob, usd(50),
XRP(50)));
405 Env env(*
this, features);
407 env.
fund(
XRP(10000), alice, bob, carol, gw);
409 env.
trust(usd(1000), alice, bob, carol);
410 env.
trust(btc(1000), alice, bob, carol);
411 env.
trust(eur(1000), alice, bob, carol);
413 env(
pay(gw, alice, btc(60)));
414 env(
pay(gw, bob, usd(50)));
415 env(
pay(gw, bob, eur(50)));
417 env(
offer(bob, btc(50), usd(50)));
418 env(
offer(bob, btc(40), eur(50)));
419 env(
offer(bob, eur(50), usd(50)));
422 env(
pay(bob, gw, eur(50)));
423 BEAST_EXPECT(
isOffer(env, bob, btc(50), usd(50)));
424 BEAST_EXPECT(
isOffer(env, bob, btc(40), eur(50)));
425 BEAST_EXPECT(
isOffer(env, bob, eur(50), usd(50)));
435 BEAST_EXPECT(!
isOffer(env, bob, btc(50), usd(50)));
437 BEAST_EXPECT(!
isOffer(env, bob, btc(40), eur(50)));
439 BEAST_EXPECT(
isOffer(env, bob, eur(50), usd(50)));
450 Env env(*
this, features);
452 env.
fund(
XRP(10000), alice, bob, carol, gw);
454 env.
trust(usd(1000), alice, bob, carol);
455 env.
trust(btc(1000), alice, bob, carol);
456 env.
trust(eur(1000), alice, bob, carol);
458 env(
pay(gw, alice, btc(60)));
459 env(
pay(gw, bob, usd(60)));
460 env(
pay(gw, bob, eur(50)));
461 env(
pay(gw, carol, eur(1)));
463 env(
offer(bob, btc(50), usd(50)));
464 env(
offer(bob, btc(60), eur(50)));
465 env(
offer(carol, btc(1000), eur(1)));
466 env(
offer(bob, eur(50), usd(50)));
469 env(
pay(bob, gw, eur(50)));
470 BEAST_EXPECT(
isOffer(env, bob, btc(50), usd(50)));
471 BEAST_EXPECT(
isOffer(env, bob, btc(60), eur(50)));
472 BEAST_EXPECT(
isOffer(env, carol, btc(1000), eur(1)));
475 auto const flowResult = [&] {
512 BEAST_EXPECT(flowResult.removableOffers.size() == 1);
514 if (flowResult.removableOffers.empty())
517 for (
auto const& o : flowResult.removableOffers)
527 BEAST_EXPECT(
isOffer(env, bob, btc(50), usd(50)));
528 BEAST_EXPECT(
isOffer(env, carol, btc(1000), eur(1)));
530 BEAST_EXPECT(!
isOffer(env, bob, btc(60), eur(50)));
540 Env env(*
this, features);
541 env.
fund(
XRP(10000), alice, bob, carol, gw);
544 env.
trust(usd(1000), alice, bob, carol);
545 env.
trust(eur(1000), alice, bob, carol);
547 env(
pay(gw, alice, usd(1000)));
548 env(
pay(gw, bob, eur(1000)));
554 bool const reducedOffersV2 = features[fixReducedOffersV2];
561 env(
pay(alice, carol, eur(1)),
564 Txflags(tfNoRippleDirect | tfPartialPayment),
567 if (!reducedOffersV2)
575 if (BEAST_EXPECT(usdOffer))
581 bookDirStr.
erase(0, 48);
585 getRate(usdOffer->at(sfTakerGets), usdOffer->at(sfTakerPays));
591 BEAST_EXPECT(actualRate > bookRate);
604 auto const gw =
Account(
"gateway");
605 auto const usd = gw[
"USD"];
606 auto const btc = gw[
"BTC"];
607 auto const eur = gw[
"EUR"];
613 Env env(*
this, features);
615 env.
fund(
XRP(10000), alice, bob, gw);
618 env.
trust(usd(1000), alice, bob);
631 auto const gw =
Account(
"gateway");
632 auto const usd = gw[
"USD"];
633 auto const eur = gw[
"EUR"];
638 Env env(*
this, features);
640 env.
fund(
XRP(10000), alice, carol, gw);
643 env.
trust(usd(1000), alice, bob, carol);
644 env.
trust(eur(1000), alice, bob, carol);
646 env(
pay(gw, alice, eur(50)));
647 env(
pay(gw, bob, usd(50)));
659 env(
pay(alice, carol, usd(1000000)),
662 Txflags(tfNoRippleDirect | tfPartialPayment));
665 BEAST_EXPECT(carolUSD > usd(0) && carolUSD < usd(50));
678 auto const gw =
Account(
"gateway");
679 auto const usd = gw[
"USD"];
687 env.
fund(
XRP(10000), alice, bob, carol, gw);
690 env.
trust(usd(100), alice, bob, carol);
691 env(
pay(gw, bob, usd(100)));
695 env(
pay(alice, carol, usd(100)),
698 Txflags(tfNoRippleDirect | tfPartialPayment | tfLimitQuality));
709 return env.
current()->fees().accountReserve(count);
718 if (sle->getType() == ltOFFER)
719 result.push_back(sle);
736 auto const gw1 =
Account(
"gw1");
737 auto const gw2 =
Account(
"gw2");
738 auto const alice =
Account(
"alice");
739 auto const usd = gw1[
"USD"];
740 auto const eur = gw2[
"EUR"];
742 Env env(*
this, features);
744 env.
fund(
XRP(1000000), gw1, gw2);
748 auto const f = env.
current()->fees().base;
753 env(
trust(alice, usd(2000)));
754 env(
trust(alice, eur(2000)));
757 env(
pay(gw1, alice, usd(1)));
758 env(
pay(gw2, alice, eur(1000)));
761 env(
offer(alice, usd(500), eur(600)));
769 BEAST_EXPECT(aliceOffers.size() == 1);
770 for (
auto const& offerPtr : aliceOffers)
772 auto const offer = *offerPtr;
773 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
774 BEAST_EXPECT(
offer[sfTakerGets] == eur(600));
775 BEAST_EXPECT(
offer[sfTakerPays] == usd(500));
785 BEAST_EXPECT(aliceOffers.size() == 1);
786 for (
auto const& offerPtr : aliceOffers)
788 auto const offer = *offerPtr;
789 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
790 BEAST_EXPECT(
offer[sfTakerGets] == eur(598.8));
791 BEAST_EXPECT(
offer[sfTakerPays] == usd(499));
805 auto const gw1 =
Account(
"gw1");
806 auto const gw2 =
Account(
"gw2");
807 auto const alice =
Account(
"alice");
808 auto const usd = gw1[
"USD"];
809 auto const eur = gw2[
"EUR"];
811 Env env(*
this, features);
813 env.
fund(
XRP(1000000), gw1, gw2);
817 auto const f = env.
current()->fees().base;
822 env(
trust(alice, usd(506)));
823 env(
trust(alice, eur(606)));
826 env(
pay(gw1, alice, usd(500)));
827 env(
pay(gw2, alice, eur(600)));
830 env(
offer(alice, usd(500), eur(600)));
838 BEAST_EXPECT(aliceOffers.size() == 1);
839 for (
auto const& offerPtr : aliceOffers)
841 auto const offer = *offerPtr;
842 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
843 BEAST_EXPECT(
offer[sfTakerGets] == eur(600));
844 BEAST_EXPECT(
offer[sfTakerPays] == usd(500));
854 BEAST_EXPECT(aliceOffers.size() == 1);
855 for (
auto const& offerPtr : aliceOffers)
857 auto const offer = *offerPtr;
858 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
859 BEAST_EXPECT(
offer[sfTakerGets] == eur(594));
860 BEAST_EXPECT(
offer[sfTakerPays] == usd(495));
871 testcase(
"Self funded XRPEndpoint");
875 Env env(*
this, features);
877 auto const alice =
Account(
"alice");
879 auto const usd = gw[
"USD"];
881 env.
fund(
XRP(10000), alice, gw);
883 env(
trust(alice, usd(20)));
884 env(
pay(gw, alice, usd(10)));
885 env(
offer(alice,
XRP(50000), usd(10)));
889 auto const toSend = consumeOffer ? usd(10) : usd(9);
890 env(
pay(alice, alice, toSend),
893 Txflags(tfPartialPayment | tfNoRippleDirect));
904 Env env(*
this, features);
906 auto const alice =
Account(
"alice");
907 auto const bob =
Account(
"bob");
909 auto const usd = gw[
"USD"];
911 env.
fund(
XRP(100000), alice, bob, gw);
913 env(
trust(bob, usd(20)));
919 env(
pay(alice, bob, tinyAmt1),
924 BEAST_EXPECT(!
isOffer(env, gw,
XRP(0), usd(0)));
928 Env env(*
this, features);
930 auto const alice =
Account(
"alice");
931 auto const bob =
Account(
"bob");
933 auto const usd = gw[
"USD"];
935 env.
fund(
XRP(100000), alice, bob, gw);
937 env(
trust(alice, usd(20)));
942 env(
pay(gw, alice, tinyAmt1));
945 env(
pay(alice, bob,
drops(9000000000)),
950 BEAST_EXPECT(!
isOffer(env, gw, usd(0),
XRP(0)));
960 Env env(*
this, features);
962 auto const alice =
Account(
"alice");
963 auto const bob =
Account(
"bob");
965 auto const usd = gw[
"USD"];
966 auto const usdC = usd.currency;
968 env.
fund(
XRP(10000), alice, bob, gw);
970 env(
trust(alice, usd(100)));
1005 env(
pay(alice, bob,
XRP(10000)),
1008 Txflags(tfPartialPayment | tfNoRippleDirect));
1016 using namespace jtx;
1018 auto const alice =
Account(
"alice");
1019 auto const bob =
Account(
"bob");
1020 auto const carol =
Account(
"carol");
1021 auto const gw =
Account(
"gw");
1025 env.
trust(gw[
"USD"](10000), alice, carol);
1026 env(
trust(bob, gw[
"USD"](10000), tfSetNoRipple));
1027 env.
trust(gw[
"USD"](10000), bob);
1032 env(
pay(gw, alice, gw[
"USD"](1000)));
1035 env(
offer(alice, bob[
"USD"](1000),
XRP(1)));
1038 env(
pay(alice, alice,
XRP(1)),
1045 env.
trust(bob[
"USD"](10000), alice);
1046 env(
pay(bob, alice, bob[
"USD"](1000)));
1048 env(
offer(alice,
XRP(1000), bob[
"USD"](1000)));
1051 env(
pay(carol, carol, gw[
"USD"](1000)),
1052 Path(~bob[
"USD"], gw),
1066 using namespace jtx;
1073 auto const alice =
Account(
"alice");
1074 auto const bob =
Account(
"bob");
1075 auto const carol =
Account(
"carol");
1076 auto const gw =
Account(
"gw");
1077 auto const usd = gw[
"USD"];
1079 env.
fund(
XRP(100000000), alice, bob, carol, gw);
1081 env.
trust(usd(10000), alice, carol);
1082 env(
trust(bob, usd(10000), tfSetNoRipple));
1083 env.
trust(usd(10000), bob);
1084 env.
trust(bob[
"USD"](10000), carol);
1087 env(
pay(bob, carol, bob[
"USD"](1000)));
1088 env(
pay(gw, bob, usd(1000)));
1091 env(
offer(carol,
XRP(1), bob[
"USD"](1000)));
1094 env(
pay(alice, alice, usd(1000)),
1095 Path(~bob[
"USD"], bob, gw),
1108 testcase(
"Self crossing low quality offer");
1110 using namespace jtx;
1112 Env env(*
this, features);
1114 auto const ann =
Account(
"ann");
1115 auto const gw =
Account(
"gateway");
1116 auto const ctb = gw[
"CTB"];
1118 auto const fee = env.
current()->fees().base;
1123 env(
rate(gw, 1.002));
1124 env(
trust(ann, ctb(10)));
1127 env(
pay(gw, ann, ctb(2.856)));
1130 env(
offer(ann,
drops(365611702030), ctb(5.713)));
1141 using namespace jtx;
1143 auto const alice =
Account(
"alice");
1145 Env env(*
this, features);
1158 using namespace jtx;
1159 auto const alice =
Account(
"alice");
1160 auto const bob =
Account(
"bob");
1161 auto const gw =
Account(
"gw");
1162 auto const usd = gw[
"USD"];
1163 auto const eur = gw[
"EUR"];
1168 env.
fund(
XRP(10000), alice, bob, gw);
1170 env.
trust(usd(1000), alice, bob);
1171 env.
trust(eur(1000), alice, bob);
1173 env(
pay(gw, alice, usd(100)));
1174 env(
pay(gw, alice, eur(100)));
1183 env(
pay(alice, bob, eur(1)),
1194 env.
fund(
XRP(10000), alice, bob, gw);
1196 env.
trust(usd(1000), alice, bob);
1197 env.
trust(eur(1000), alice, bob);
1198 env(
pay(gw, alice, usd(100)));
1199 env(
pay(gw, alice, eur(100)));
1206 env(
pay(alice, bob,
XRP(1)),
1215 auto const jpy = gw[
"JPY"];
1217 env.
fund(
XRP(10000), alice, bob, gw);
1219 env.
trust(usd(1000), alice, bob);
1220 env.
trust(eur(1000), alice, bob);
1221 env.
trust(jpy(1000), alice, bob);
1223 env(
pay(gw, alice, usd(100)));
1224 env(
pay(gw, alice, eur(100)));
1225 env(
pay(gw, alice, jpy(100)));
1234 env(
pay(alice, bob, jpy(1)),
1246 using namespace jtx;
1248 auto const alice =
Account(
"alice");
1249 auto const bob =
Account(
"bob");
1251 Env env(*
this, features);
1270 using namespace jtx;
1297 using namespace jtx;
1310 using namespace jtx;
A generic endpoint for log messages.
void pass()
Record a successful test condition.
TestcaseT testcase
Memberspace for declaring test cases.
A currency issued by an account.
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.
std::shared_ptr< STLedgerEntry const > const & const_ref
std::shared_ptr< STLedgerEntry const > const_pointer
void pushBack(STPath const &e)
Discardable, editable view to a ledger.
virtual beast::Journal getJournal(std::string const &name)=0
virtual OpenLedger & getOpenLedger()=0
SLE::pointer peek(Keylet const &k) override
Prepare to modify the SLE associated with key.
Immutable cryptographic account descriptor.
AccountID id() const
Returns the Account ID.
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 require(Args const &... args)
Check a set of requirements.
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
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 offer(AccountID const &id, std::uint32_t seq) noexcept
An offer from an account.
Keylet trustLine(AccountID const &id0, AccountID const &id1, Currency const ¤cy) noexcept
The index of a trust line for a given currency.
json::Value create(Account const &account, std::uint32_t count)
Create one of more tickets.
json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
PrettyAmount xrpMinusFee(Env const &env, std::int64_t xrpAmount)
XrpT const XRP
Converts to XRP Issue or STAmount.
FeatureBitset testableAmendments()
STPathElement ipe(Asset const &asset)
std::array< Account, 1+sizeof...(Args)> noripple(Account const &account, Args const &... args)
Designate accounts as no-ripple in Env::fund.
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.
json::Value rate(Account const &account, double multiplier)
Set a transfer rate.
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(CrossingLimits, app, xrpl, 10)
constexpr XRPAmount
Convert XRP to drops (integral types).
BEAST_DEFINE_TESTSUITE_PRIO(AccountDelete, app, xrpl, 2)
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.
BaseUInt< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
TER offerDelete(ApplyView &view, SLE::ref sle, beast::Journal j)
Delete an offer.
std::string to_string(BaseUInt< Bits, Tag > const &a)
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.
std::uint64_t getRate(STAmount const &offerOut, STAmount const &offerIn)
TERSubset< CanCvtToTER > TER
void forEachItem(ReadView const &view, Keylet const &root, std::function< void(SLE::const_ref)> const &f)
Iterate all items in the given directory.
AccountID const & xrpAccount()
Compute AccountID from public key.
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)
A pair of SHAMap key and LedgerEntryType.
void run() override
Runs the suite.
void testLineQuality(FeatureBitset features)
void run() override
Runs the suite.
void testSelfPayLowQualityOffer(FeatureBitset features)
void testBookStep(FeatureBitset features)
static XRPAmount reserve(jtx::Env &env, std::uint32_t count)
void testSelfPayment1(FeatureBitset features)
void testUnfundedOffer(FeatureBitset features)
static std::vector< SLE::const_pointer > offersOnAccount(jtx::Env &env, jtx::Account account)
void testEmptyStrand(FeatureBitset features)
void testFalseDry(FeatureBitset features)
void testWithFeats(FeatureBitset features)
void testTicketPay(FeatureBitset features)
void testDirectStep(FeatureBitset features)
void testTransferRate(FeatureBitset features)
void testSelfPayment2(FeatureBitset features)
void testSelfFundedXRPEndpoint(bool consumeOffer, FeatureBitset features)
void testReExecuteDirectStep(FeatureBitset features)
STAmount const & value() const