2#include <test/jtx/Account.h>
3#include <test/jtx/Env.h>
4#include <test/jtx/amount.h>
5#include <test/jtx/balance.h>
6#include <test/jtx/delivermin.h>
7#include <test/jtx/offer.h>
8#include <test/jtx/paths.h>
9#include <test/jtx/pay.h>
10#include <test/jtx/sendmax.h>
11#include <test/jtx/ter.h>
12#include <test/jtx/txflags.h>
14#include <xrpl/beast/unit_test/suite.h>
15#include <xrpl/protocol/Feature.h>
16#include <xrpl/protocol/TER.h>
17#include <xrpl/protocol/TxFlags.h>
27 testcase(
"Convert all of an asset using DeliverMin");
30 auto const gw =
Account(
"gateway");
31 auto const usd = gw[
"USD"];
34 Env env(*
this, features);
35 env.
fund(
XRP(10000),
"alice",
"bob",
"carol", gw);
37 env.
trust(usd(100),
"alice",
"bob",
"carol");
40 env(
pay(
"alice",
"bob", usd(10)),
44 env(
pay(
"alice",
"bob", usd(10)),
48 env(
pay(
"alice",
"bob", usd(10)),
52 env(
pay(
"alice",
"bob", usd(10)),
56 env(
pay(gw,
"carol", usd(50)));
58 env(
pay(
"alice",
"bob", usd(10)),
69 Env env(*
this, features);
70 env.
fund(
XRP(10000),
"alice",
"bob", gw);
72 env.
trust(usd(1000),
"alice",
"bob");
74 env(
pay(gw,
"bob", usd(100)));
75 env(
offer(
"bob",
XRP(100), usd(100)));
76 env(
pay(
"alice",
"alice", usd(10000)),
85 Env env(*
this, features);
86 env.
fund(
XRP(10000),
"alice",
"bob",
"carol", gw);
88 env.
trust(usd(1000),
"bob",
"carol");
90 env(
pay(gw,
"bob", usd(200)));
91 env(
offer(
"bob",
XRP(100), usd(100)));
92 env(
offer(
"bob",
XRP(1000), usd(100)));
93 env(
offer(
"bob",
XRP(10000), usd(100)));
94 env(
pay(
"alice",
"carol", usd(10000)),
100 env(
pay(
"alice",
"carol", usd(10000)),
110 Env env(*
this, features);
111 env.
fund(
XRP(10000),
"alice",
"bob",
"carol",
"dan", gw);
113 env.
trust(usd(1000),
"bob",
"carol",
"dan");
115 env(
pay(gw,
"bob", usd(100)));
116 env(
pay(gw,
"dan", usd(100)));
117 env(
offer(
"bob",
XRP(100), usd(100)));
118 env(
offer(
"bob",
XRP(1000), usd(100)));
119 env(
offer(
"dan",
XRP(100), usd(100)));
120 env(
pay(
"alice",
"carol", usd(10000)),
TestcaseT testcase
Memberspace for declaring test cases.
void testConvertAllOfAnAsset(FeatureBitset features)
void run() override
Runs the suite.
Sets the DeliverMin on a JTx.
A transaction testing environment.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &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.
Set Paths, SendMax on a JTx.
Sets the SendMax on a JTx.
Set the expected result code for a JTx The test will fail if the code doesn't match.
json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
XrpT const XRP
Converts to XRP Issue or STAmount.
FeatureBitset testableAmendments()
json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.