22#include <xrpl/beast/unit_test.h>
23#include <xrpl/protocol/Feature.h>
34 testcase(
"Convert all of an asset using DeliverMin");
37 auto const gw =
Account(
"gateway");
38 auto const USD = gw[
"USD"];
41 Env env(*
this, features);
42 env.
fund(
XRP(10000),
"alice",
"bob",
"carol", gw);
44 env.
trust(USD(100),
"alice",
"bob",
"carol");
46 env(
pay(
"alice",
"bob", USD(10)),
49 env(
pay(
"alice",
"bob", USD(10)),
53 env(
pay(
"alice",
"bob", USD(10)),
57 env(
pay(
"alice",
"bob", USD(10)),
61 env(
pay(
"alice",
"bob", USD(10)),
65 env(
pay(gw,
"carol", USD(50)));
67 env(
pay(
"alice",
"bob", USD(10)),
79 Env env(*
this, features);
80 env.
fund(
XRP(10000),
"alice",
"bob", gw);
82 env.
trust(USD(1000),
"alice",
"bob");
84 env(
pay(gw,
"bob", USD(100)));
85 env(
offer(
"bob",
XRP(100), USD(100)));
86 env(
pay(
"alice",
"alice", USD(10000)),
95 Env env(*
this, features);
96 env.
fund(
XRP(10000),
"alice",
"bob",
"carol", gw);
98 env.
trust(USD(1000),
"bob",
"carol");
100 env(
pay(gw,
"bob", USD(200)));
101 env(
offer(
"bob",
XRP(100), USD(100)));
102 env(
offer(
"bob",
XRP(1000), USD(100)));
103 env(
offer(
"bob",
XRP(10000), USD(100)));
104 env(
pay(
"alice",
"carol", USD(10000)),
110 env(
pay(
"alice",
"carol", USD(10000)),
120 Env env(*
this, features);
121 env.
fund(
XRP(10000),
"alice",
"bob",
"carol",
"dan", gw);
123 env.
trust(USD(1000),
"bob",
"carol",
"dan");
125 env(
pay(gw,
"bob", USD(100)));
126 env(
pay(gw,
"dan", USD(100)));
127 env(
offer(
"bob",
XRP(100), USD(100)));
128 env(
offer(
"bob",
XRP(1000), USD(100)));
129 env(
offer(
"dan",
XRP(100), USD(100)));
130 env(
pay(
"alice",
"carol", USD(10000)),
151BEAST_DEFINE_TESTSUITE(DeliverMin, app,
ripple);
testcase_t testcase
Memberspace for declaring test cases.
void test_convert_all_of_an_asset(FeatureBitset features)
void run() override
Runs the suite.
Immutable cryptographic account descriptor.
A transaction testing environment.
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)
Sets the DeliverMin on a JTx.
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.
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
FeatureBitset testable_amendments()
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.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr std::uint32_t tfPartialPayment