3#include <xrpl/beast/unit_test.h>
4#include <xrpl/protocol/Feature.h>
15 testcase(
"Convert all of an asset using DeliverMin");
18 auto const gw =
Account(
"gateway");
19 auto const USD = gw[
"USD"];
22 Env env(*
this, features);
23 env.
fund(
XRP(10000),
"alice",
"bob",
"carol", gw);
25 env.
trust(USD(100),
"alice",
"bob",
"carol");
30 env(
pay(
"alice",
"bob", USD(10)),
35 env(
pay(gw,
"carol", USD(50)));
37 env(
pay(
"alice",
"bob", USD(10)),
48 Env env(*
this, features);
49 env.
fund(
XRP(10000),
"alice",
"bob", gw);
51 env.
trust(USD(1000),
"alice",
"bob");
53 env(
pay(gw,
"bob", USD(100)));
54 env(
offer(
"bob",
XRP(100), USD(100)));
55 env(
pay(
"alice",
"alice", USD(10000)),
64 Env env(*
this, features);
65 env.
fund(
XRP(10000),
"alice",
"bob",
"carol", gw);
67 env.
trust(USD(1000),
"bob",
"carol");
69 env(
pay(gw,
"bob", USD(200)));
70 env(
offer(
"bob",
XRP(100), USD(100)));
71 env(
offer(
"bob",
XRP(1000), USD(100)));
72 env(
offer(
"bob",
XRP(10000), USD(100)));
73 env(
pay(
"alice",
"carol", USD(10000)),
79 env(
pay(
"alice",
"carol", USD(10000)),
89 Env env(*
this, features);
90 env.
fund(
XRP(10000),
"alice",
"bob",
"carol",
"dan", gw);
92 env.
trust(USD(1000),
"bob",
"carol",
"dan");
94 env(
pay(gw,
"bob", USD(100)));
95 env(
pay(gw,
"dan", USD(100)));
96 env(
offer(
"bob",
XRP(100), USD(100)));
97 env(
offer(
"bob",
XRP(1000), USD(100)));
98 env(
offer(
"dan",
XRP(100), USD(100)));
99 env(
pay(
"alice",
"carol", USD(10000)),
120BEAST_DEFINE_TESTSUITE(DeliverMin, app,
xrpl);
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.
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.
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.
XRP_t const XRP
Converts to XRP Issue or STAmount.
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
FeatureBitset testable_amendments()
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
Json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr std::uint32_t tfPartialPayment