2#include <test/jtx/Env.h>
3#include <test/jtx/amount.h>
4#include <test/jtx/offer.h>
5#include <test/jtx/owners.h>
6#include <test/jtx/pay.h>
7#include <test/jtx/ter.h>
9#include <xrpl/beast/unit_test/suite.h>
10#include <xrpl/protocol/TER.h>
36 auto const billion = 1000000000ul;
39 auto const gw =
Account(
"gateway");
40 auto const usd = gw[
"USD"];
41 env.
fund(
XRP(billion), gw,
"alice");
42 env.
trust(usd(billion),
"alice");
43 env(
pay(gw,
"alice", usd(billion)));
92 auto const billion = 1000000000ul;
95 auto const gw =
Account(
"gateway");
96 auto const usd = gw[
"USD"];
97 env.
fund(
XRP(billion), gw,
"alice");
98 env.
trust(usd(billion),
"alice");
99 env(
pay(gw,
"alice", usd(billion)));
101 env(
pay(
"alice", gw, usd(billion)));
102 env(
offer(
"alice", usd(1),
XRP(1)));
120 template <
class Function>
148 env(
offer(
"alice",
XRP(i), iou(1)));
157 auto const billion = 1000000000ul;
160 auto const gw =
Account(
"gateway");
161 auto const usd = gw[
"USD"];
162 env.
fund(
XRP(billion), gw,
"alice");
163 env.
trust(usd(billion),
"alice");
164 env(
pay(gw,
"alice", usd(billion)));
166 env(
pay(
"alice", gw, usd(billion)));
167 env(
offer(
"alice", usd(1),
XRP(1)),
Ter(std::ignore));
175 log <<
"Min oversize offers = " << result <<
'\n';
LogOs< char > log
Logging output stream.
static void createOffers(jtx::Env &env, jtx::IOU const &iou, std::size_t n)
void run() override
Runs the suite.
bool oversize(std::size_t n)
static std::size_t bfind(std::size_t lo, std::size_t hi, Function &&f)
static void createOffers(jtx::Env &env, jtx::IOU const &iou, std::size_t n)
void run() override
Runs the suite.
void run() override
Runs the suite.
A transaction testing environment.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
TER ter() const
Return the TER for the last JTx.
void disableSigs()
Turn off signature checks.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
Converts to IOU Issue or STAmount.
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.
json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(CrossingLimits, app, xrpl, 10)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.