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/SeqProxy.h>
39#include <xrpl/protocol/TER.h>
40#include <xrpl/protocol/TxFlags.h>
41#include <xrpl/protocol/UintTypes.h>
42#include <xrpl/protocol/XRPAmount.h>
43#include <xrpl/tx/paths/Flow.h>
44#include <xrpl/tx/paths/detail/Steps.h>
63 auto const flag = (src.
id() > dst.
id()) ? lsfHighNoRipple : lsfLowNoRipple;
64 return sle->isFlag(flag);
78 auto const alice =
Account(
"alice");
79 auto const bob =
Account(
"bob");
80 auto const carol =
Account(
"carol");
81 auto const dan =
Account(
"dan");
82 auto const erin =
Account(
"erin");
83 auto const usda = alice[
"USD"];
84 auto const usdb = bob[
"USD"];
85 auto const usdc = carol[
"USD"];
86 auto const usdd = dan[
"USD"];
88 auto const usd = gw[
"USD"];
91 Env env(*
this, features);
93 env.
fund(
XRP(10000), alice, bob, gw);
95 env.
trust(usd(1000), alice, bob);
96 env(
pay(gw, alice, usd(100)));
97 env(
pay(alice, bob, usd(10)),
Paths(usd));
102 Env env(*
this, features);
104 env.
fund(
XRP(10000), alice, bob);
106 env(
pay(alice, bob,
XRP(100)));
112 Env env(*
this, features);
114 env.
fund(
XRP(10000), alice, bob, gw);
116 env.
trust(usd(1000), alice, bob);
117 env(
pay(gw, alice, usd(100)));
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), carol);
131 env.
trust(usdc(10), dan);
132 env(
pay(alice, dan, usdc(10)),
Paths(usda));
138 Env env(*
this, features);
140 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);
148 env(
pay(bob, alice, usdb(6)));
149 env(
pay(alice, dan, usdc(5)),
159 Env env(*
this, features);
161 env.
fund(
XRP(10000), alice, bob, carol, dan);
163 env.
trust(usda(10), bob);
164 env.
trust(usdb(10), alice, carol);
165 env.
trust(usdc(10), dan);
168 env(
pay(alice, dan, usdc(5)),
178 Env env(*
this, features);
180 env.
fund(
XRP(10000), alice, bob, carol, dan, erin);
182 env.
trust(usda(10), bob, carol);
183 env.
trust(usdb(10), dan);
184 env.
trust(usdc(10), alice, dan);
185 env.
trust(usdd(20), erin);
187 env(
rate(carol, 1.1));
190 env(
pay(carol, alice, usdc(10)));
191 env(
pay(alice, erin, usdd(5)),
202 Env env(*
this, features);
204 env.
fund(
XRP(10000), alice, bob, carol);
206 env.
trust(usda(10), bob);
207 env.
trust(usdb(10), carol);
209 env(
pay(alice, carol, usdb(5)),
211 Txflags(tfLimitQuality | tfPartialPayment),
226 auto const alice =
Account(
"alice");
227 auto const bob =
Account(
"bob");
228 auto const carol =
Account(
"carol");
229 auto const dan =
Account(
"dan");
230 auto const usda = alice[
"USD"];
231 auto const usdb = bob[
"USD"];
232 auto const usdc = carol[
"USD"];
233 auto const usdd = dan[
"USD"];
236 for (
auto bobDanQIn : {80, 100, 120})
238 for (
auto bobAliceQOut : {80, 100, 120})
240 Env env(*
this, features);
241 env.
fund(
XRP(10000), alice, bob, carol, dan);
245 env(
trust(carol, usda(100)));
247 env(
pay(alice, bob, usda(100)));
249 env(
pay(dan, carol, usda(10)),
254 if (bobAliceQOut > bobDanQIn)
257 Balance(bob, usdd(10.0 *
double(bobAliceQOut) /
double(bobDanQIn))));
268 for (
auto carolAliceQIn : {80, 100, 120})
270 Env env(*
this, features);
271 env.
fund(
XRP(10000), alice, bob, carol);
274 env(
trust(bob, usda(10)));
277 env(
pay(alice, bob, usda(10)));
279 env(
pay(bob, carol, usda(5)),
Sendmax(usda(10)));
280 auto const effectiveQ = carolAliceQIn > 100 ? 1.0 : carolAliceQIn / 100.0;
285 for (
auto bobAliceQOut : {80, 100, 120})
287 Env env(*
this, features);
288 env.
fund(
XRP(10000), alice, bob, carol);
291 env(
trust(carol, usda(10)));
293 env(
pay(alice, bob, usda(10)));
295 env(
pay(bob, carol, usda(5)),
Sendmax(usda(5)));
308 auto const gw =
Account(
"gateway");
309 auto const usd = gw[
"USD"];
310 auto const btc = gw[
"BTC"];
311 auto const eur = gw[
"EUR"];
318 Env env(*
this, features);
320 env.
fund(
XRP(10000), alice, bob, carol, gw);
322 env.
trust(usd(1000), alice, bob, carol);
323 env.
trust(btc(1000), alice, bob, carol);
325 env(
pay(gw, alice, btc(50)));
326 env(
pay(gw, bob, usd(50)));
328 env(
offer(bob, btc(50), usd(50)));
336 BEAST_EXPECT(!
isOffer(env, bob, btc(50), usd(50)));
340 Env env(*
this, features);
342 env.
fund(
XRP(10000), alice, bob, carol, gw);
344 env.
trust(usd(1000), alice, bob, carol);
345 env.
trust(btc(1000), alice, bob, carol);
347 env(
pay(gw, alice, btc(50)));
348 env(
pay(gw, bob, usd(50)));
359 BEAST_EXPECT(!
isOffer(env, bob,
XRP(50), usd(50)));
360 BEAST_EXPECT(!
isOffer(env, bob, btc(50),
XRP(50)));
364 Env env(*
this, features);
366 env.
fund(
XRP(10000), alice, bob, carol, gw);
368 env.
trust(usd(1000), alice, bob, carol);
369 env.
trust(btc(1000), alice, bob, carol);
371 env(
pay(gw, bob, usd(50)));
381 BEAST_EXPECT(!
isOffer(env, bob,
XRP(50), usd(50)));
385 Env env(*
this, features);
387 env.
fund(
XRP(10000), alice, bob, carol, gw);
389 env.
trust(usd(1000), alice, bob, carol);
390 env.
trust(btc(1000), alice, bob, carol);
392 env(
pay(gw, alice, usd(50)));
402 BEAST_EXPECT(!
isOffer(env, bob, usd(50),
XRP(50)));
406 Env env(*
this, features);
408 env.
fund(
XRP(10000), alice, bob, carol, gw);
410 env.
trust(usd(1000), alice, bob, carol);
411 env.
trust(btc(1000), alice, bob, carol);
412 env.
trust(eur(1000), alice, bob, carol);
414 env(
pay(gw, alice, btc(60)));
415 env(
pay(gw, bob, usd(50)));
416 env(
pay(gw, bob, eur(50)));
418 env(
offer(bob, btc(50), usd(50)));
419 env(
offer(bob, btc(40), eur(50)));
420 env(
offer(bob, eur(50), usd(50)));
423 env(
pay(bob, gw, eur(50)));
424 BEAST_EXPECT(
isOffer(env, bob, btc(50), usd(50)));
425 BEAST_EXPECT(
isOffer(env, bob, btc(40), eur(50)));
426 BEAST_EXPECT(
isOffer(env, bob, eur(50), usd(50)));
436 BEAST_EXPECT(!
isOffer(env, bob, btc(50), usd(50)));
438 BEAST_EXPECT(!
isOffer(env, bob, btc(40), eur(50)));
440 BEAST_EXPECT(
isOffer(env, bob, eur(50), usd(50)));
451 Env env(*
this, features);
453 env.
fund(
XRP(10000), alice, bob, carol, gw);
455 env.
trust(usd(1000), alice, bob, carol);
456 env.
trust(btc(1000), alice, bob, carol);
457 env.
trust(eur(1000), alice, bob, carol);
459 env(
pay(gw, alice, btc(60)));
460 env(
pay(gw, bob, usd(60)));
461 env(
pay(gw, bob, eur(50)));
462 env(
pay(gw, carol, eur(1)));
464 env(
offer(bob, btc(50), usd(50)));
465 env(
offer(bob, btc(60), eur(50)));
466 env(
offer(carol, btc(1000), eur(1)));
467 env(
offer(bob, eur(50), usd(50)));
470 env(
pay(bob, gw, eur(50)));
471 BEAST_EXPECT(
isOffer(env, bob, btc(50), usd(50)));
472 BEAST_EXPECT(
isOffer(env, bob, btc(60), eur(50)));
473 BEAST_EXPECT(
isOffer(env, carol, btc(1000), eur(1)));
476 auto const flowResult = [&] {
513 BEAST_EXPECT(flowResult.removableOffers.size() == 1);
515 if (flowResult.removableOffers.empty())
518 for (
auto const& o : flowResult.removableOffers)
528 BEAST_EXPECT(
isOffer(env, bob, btc(50), usd(50)));
529 BEAST_EXPECT(
isOffer(env, carol, btc(1000), eur(1)));
531 BEAST_EXPECT(!
isOffer(env, bob, btc(60), eur(50)));
541 Env env(*
this, features);
542 env.
fund(
XRP(10000), alice, bob, carol, gw);
545 env.
trust(usd(1000), alice, bob, carol);
546 env.
trust(eur(1000), alice, bob, carol);
548 env(
pay(gw, alice, usd(1000)));
549 env(
pay(gw, bob, eur(1000)));
555 bool const reducedOffersV2 = features[fixReducedOffersV2];
562 env(
pay(alice, carol, eur(1)),
565 Txflags(tfNoRippleDirect | tfPartialPayment),
568 if (!reducedOffersV2)
576 if (BEAST_EXPECT(usdOffer))
582 bookDirStr.
erase(0, 48);
586 getRate(usdOffer->at(sfTakerGets), usdOffer->at(sfTakerPays));
592 BEAST_EXPECT(actualRate > bookRate);
605 auto const gw =
Account(
"gateway");
606 auto const usd = gw[
"USD"];
607 auto const btc = gw[
"BTC"];
608 auto const eur = gw[
"EUR"];
614 Env env(*
this, features);
616 env.
fund(
XRP(10000), alice, bob, gw);
619 env.
trust(usd(1000), alice, bob);
632 auto const gw =
Account(
"gateway");
633 auto const usd = gw[
"USD"];
634 auto const eur = gw[
"EUR"];
639 Env env(*
this, features);
641 env.
fund(
XRP(10000), alice, carol, gw);
644 env.
trust(usd(1000), alice, bob, carol);
645 env.
trust(eur(1000), alice, bob, carol);
647 env(
pay(gw, alice, eur(50)));
648 env(
pay(gw, bob, usd(50)));
660 env(
pay(alice, carol, usd(1000000)),
663 Txflags(tfNoRippleDirect | tfPartialPayment));
666 BEAST_EXPECT(carolUSD > usd(0) && carolUSD < usd(50));
679 auto const gw =
Account(
"gateway");
680 auto const usd = gw[
"USD"];
688 env.
fund(
XRP(10000), alice, bob, carol, gw);
691 env.
trust(usd(100), alice, bob, carol);
692 env(
pay(gw, bob, usd(100)));
696 env(
pay(alice, carol, usd(100)),
699 Txflags(tfNoRippleDirect | tfPartialPayment | tfLimitQuality));
710 return env.
current()->fees().accountReserve(count, 1);
719 if (sle->getType() == ltOFFER)
720 result.push_back(sle);
737 auto const gw1 =
Account(
"gw1");
738 auto const gw2 =
Account(
"gw2");
739 auto const alice =
Account(
"alice");
740 auto const usd = gw1[
"USD"];
741 auto const eur = gw2[
"EUR"];
743 Env env(*
this, features);
745 env.
fund(
XRP(1000000), gw1, gw2);
749 auto const f = env.
current()->fees().base;
754 env(
trust(alice, usd(2000)));
755 env(
trust(alice, eur(2000)));
758 env(
pay(gw1, alice, usd(1)));
759 env(
pay(gw2, alice, eur(1000)));
762 env(
offer(alice, usd(500), eur(600)));
770 BEAST_EXPECT(aliceOffers.size() == 1);
771 for (
auto const& offerPtr : aliceOffers)
773 auto const offer = *offerPtr;
774 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
775 BEAST_EXPECT(
offer[sfTakerGets] == eur(600));
776 BEAST_EXPECT(
offer[sfTakerPays] == usd(500));
786 BEAST_EXPECT(aliceOffers.size() == 1);
787 for (
auto const& offerPtr : aliceOffers)
789 auto const offer = *offerPtr;
790 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
791 BEAST_EXPECT(
offer[sfTakerGets] == eur(598.8));
792 BEAST_EXPECT(
offer[sfTakerPays] == usd(499));
806 auto const gw1 =
Account(
"gw1");
807 auto const gw2 =
Account(
"gw2");
808 auto const alice =
Account(
"alice");
809 auto const usd = gw1[
"USD"];
810 auto const eur = gw2[
"EUR"];
812 Env env(*
this, features);
814 env.
fund(
XRP(1000000), gw1, gw2);
818 auto const f = env.
current()->fees().base;
823 env(
trust(alice, usd(506)));
824 env(
trust(alice, eur(606)));
827 env(
pay(gw1, alice, usd(500)));
828 env(
pay(gw2, alice, eur(600)));
831 env(
offer(alice, usd(500), eur(600)));
839 BEAST_EXPECT(aliceOffers.size() == 1);
840 for (
auto const& offerPtr : aliceOffers)
842 auto const offer = *offerPtr;
843 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
844 BEAST_EXPECT(
offer[sfTakerGets] == eur(600));
845 BEAST_EXPECT(
offer[sfTakerPays] == usd(500));
855 BEAST_EXPECT(aliceOffers.size() == 1);
856 for (
auto const& offerPtr : aliceOffers)
858 auto const offer = *offerPtr;
859 BEAST_EXPECT(
offer[sfLedgerEntryType] == ltOFFER);
860 BEAST_EXPECT(
offer[sfTakerGets] == eur(594));
861 BEAST_EXPECT(
offer[sfTakerPays] == usd(495));
872 testcase(
"Self funded XRPEndpoint");
876 Env env(*
this, features);
878 auto const alice =
Account(
"alice");
880 auto const usd = gw[
"USD"];
882 env.
fund(
XRP(10000), alice, gw);
884 env(
trust(alice, usd(20)));
885 env(
pay(gw, alice, usd(10)));
886 env(
offer(alice,
XRP(50000), usd(10)));
890 auto const toSend = consumeOffer ? usd(10) : usd(9);
891 env(
pay(alice, alice, toSend),
894 Txflags(tfPartialPayment | tfNoRippleDirect));
905 Env env(*
this, features);
907 auto const alice =
Account(
"alice");
908 auto const bob =
Account(
"bob");
910 auto const usd = gw[
"USD"];
912 env.
fund(
XRP(100000), alice, bob, gw);
914 env(
trust(bob, usd(20)));
920 env(
pay(alice, bob, tinyAmt1),
925 BEAST_EXPECT(!
isOffer(env, gw,
XRP(0), usd(0)));
929 Env env(*
this, features);
931 auto const alice =
Account(
"alice");
932 auto const bob =
Account(
"bob");
934 auto const usd = gw[
"USD"];
936 env.
fund(
XRP(100000), alice, bob, gw);
938 env(
trust(alice, usd(20)));
943 env(
pay(gw, alice, tinyAmt1));
946 env(
pay(alice, bob,
drops(9000000000)),
951 BEAST_EXPECT(!
isOffer(env, gw, usd(0),
XRP(0)));
961 Env env(*
this, features);
963 auto const alice =
Account(
"alice");
964 auto const bob =
Account(
"bob");
966 auto const usd = gw[
"USD"];
967 auto const usdC = usd.currency;
969 env.
fund(
XRP(10000), alice, bob, gw);
971 env(
trust(alice, usd(100)));
1006 env(
pay(alice, bob,
XRP(10000)),
1009 Txflags(tfPartialPayment | tfNoRippleDirect));
1017 using namespace jtx;
1019 auto const alice =
Account(
"alice");
1020 auto const bob =
Account(
"bob");
1021 auto const carol =
Account(
"carol");
1022 auto const gw =
Account(
"gw");
1026 env.
trust(gw[
"USD"](10000), alice, carol);
1027 env(
trust(bob, gw[
"USD"](10000), tfSetNoRipple));
1028 env.
trust(gw[
"USD"](10000), bob);
1033 env(
pay(gw, alice, gw[
"USD"](1000)));
1036 env(
offer(alice, bob[
"USD"](1000),
XRP(1)));
1039 env(
pay(alice, alice,
XRP(1)),
1046 env.
trust(bob[
"USD"](10000), alice);
1047 env(
pay(bob, alice, bob[
"USD"](1000)));
1049 env(
offer(alice,
XRP(1000), bob[
"USD"](1000)));
1052 env(
pay(carol, carol, gw[
"USD"](1000)),
1053 Path(~bob[
"USD"], gw),
1067 using namespace jtx;
1074 auto const alice =
Account(
"alice");
1075 auto const bob =
Account(
"bob");
1076 auto const carol =
Account(
"carol");
1077 auto const gw =
Account(
"gw");
1078 auto const usd = gw[
"USD"];
1080 env.
fund(
XRP(100000000), alice, bob, carol, gw);
1082 env.
trust(usd(10000), alice, carol);
1083 env(
trust(bob, usd(10000), tfSetNoRipple));
1084 env.
trust(usd(10000), bob);
1085 env.
trust(bob[
"USD"](10000), carol);
1088 env(
pay(bob, carol, bob[
"USD"](1000)));
1089 env(
pay(gw, bob, usd(1000)));
1092 env(
offer(carol,
XRP(1), bob[
"USD"](1000)));
1095 env(
pay(alice, alice, usd(1000)),
1096 Path(~bob[
"USD"], bob, gw),
1109 testcase(
"Self crossing low quality offer");
1111 using namespace jtx;
1113 Env env(*
this, features);
1115 auto const ann =
Account(
"ann");
1116 auto const gw =
Account(
"gateway");
1117 auto const ctb = gw[
"CTB"];
1119 auto const fee = env.
current()->fees().base;
1124 env(
rate(gw, 1.002));
1125 env(
trust(ann, ctb(10)));
1128 env(
pay(gw, ann, ctb(2.856)));
1131 env(
offer(ann,
drops(365611702030), ctb(5.713)));
1142 using namespace jtx;
1144 auto const alice =
Account(
"alice");
1146 Env env(*
this, features);
1159 using namespace jtx;
1160 auto const alice =
Account(
"alice");
1161 auto const bob =
Account(
"bob");
1162 auto const gw =
Account(
"gw");
1163 auto const usd = gw[
"USD"];
1164 auto const eur = gw[
"EUR"];
1169 env.
fund(
XRP(10000), alice, bob, gw);
1171 env.
trust(usd(1000), alice, bob);
1172 env.
trust(eur(1000), alice, bob);
1174 env(
pay(gw, alice, usd(100)));
1175 env(
pay(gw, alice, eur(100)));
1184 env(
pay(alice, bob, eur(1)),
1195 env.
fund(
XRP(10000), alice, bob, gw);
1197 env.
trust(usd(1000), alice, bob);
1198 env.
trust(eur(1000), alice, bob);
1199 env(
pay(gw, alice, usd(100)));
1200 env(
pay(gw, alice, eur(100)));
1207 env(
pay(alice, bob,
XRP(1)),
1216 auto const jpy = gw[
"JPY"];
1218 env.
fund(
XRP(10000), alice, bob, gw);
1220 env.
trust(usd(1000), alice, bob);
1221 env.
trust(eur(1000), alice, bob);
1222 env.
trust(jpy(1000), alice, bob);
1224 env(
pay(gw, alice, usd(100)));
1225 env(
pay(gw, alice, eur(100)));
1226 env(
pay(gw, alice, jpy(100)));
1235 env(
pay(alice, bob, jpy(1)),
1247 using namespace jtx;
1249 auto const alice =
Account(
"alice");
1250 auto const bob =
Account(
"bob");
1252 Env env(*
this, features);
1271 using namespace jtx;
1298 using namespace jtx;
1311 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.
static constexpr SeqProxy rawSequence(std::uint32_t v)
Factory function to return a sequence-based SeqProxy.
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, SeqProxy const &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.
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
json::Value rate(Account const &account, double multiplier)
Set a transfer rate.
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