2#include <test/jtx/Account.h>
3#include <test/jtx/Env.h>
4#include <test/jtx/amount.h>
5#include <test/jtx/flags.h>
6#include <test/jtx/pay.h>
7#include <test/jtx/ter.h>
8#include <test/jtx/trust.h>
10#include <xrpl/beast/unit_test/suite.h>
11#include <xrpl/json/json_value.h>
12#include <xrpl/protocol/Feature.h>
13#include <xrpl/protocol/Indexes.h>
14#include <xrpl/protocol/TER.h>
15#include <xrpl/protocol/TxFlags.h>
16#include <xrpl/protocol/UintTypes.h>
17#include <xrpl/protocol/jss.h>
33 jv[jss::Account] = account.human();
34 jv[jss::LimitAmount] =
36 jv[jss::TransactionType] = jss::TrustSet;
37 jv[jss::Flags] = tfSetfAuth;
46 auto const usd = gw[
"USD"];
50 env.
fund(
XRP(100000),
"alice",
"bob", gw);
51 env(
fset(gw, asfRequireAuth));
53 env(
auth(gw,
"alice",
"USD"));
55 env(
trust(
"alice", usd(1000)));
56 env(
trust(
"bob", usd(1000)));
57 env(
pay(gw,
"alice", usd(100)));
58 env(
pay(gw,
"bob", usd(100)),
60 env(
pay(
"alice",
"bob", usd(50)),
69 testAuth(sa - featurePermissionedDEX);
A currency issued by an account.
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)
Set the expected result code for a JTx The test will fail if the code doesn't match.
Keylet trustLine(AccountID const &id0, AccountID const &id1, Currency const ¤cy) noexcept
The index of a trust line for a given currency.
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 trust(Account const &account, STAmount const &amount, std::uint32_t flags)
Modify a trust line.
json::Value fset(Account const &account, std::uint32_t on, std::uint32_t off=0)
Add and/or remove flag.
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool toCurrency(Currency &, std::string const &)
Tries to convert a string to a Currency, returns true on success.
json::Value getJson(LedgerFill const &fill)
Return a new json::Value representing the ledger with given options.
static json::Value auth(jtx::Account const &account, jtx::Account const &dest, std::string const ¤cy)
void run() override
Runs the suite.
void testAuth(FeatureBitset features)