2#include <test/jtx/Env.h>
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/beast/unit_test/suite.h>
6#include <xrpl/beast/utility/Journal.h>
7#include <xrpl/ledger/ApplyView.h>
8#include <xrpl/ledger/OpenView.h>
9#include <xrpl/protocol/Feature.h>
10#include <xrpl/protocol/Rules.h>
11#include <xrpl/protocol/SField.h>
12#include <xrpl/protocol/STTx.h>
13#include <xrpl/protocol/TER.h>
14#include <xrpl/protocol/TxFormats.h>
15#include <xrpl/tx/apply.h>
32 obj[sfLedgerSequence] = seq;
33 if (rules.
enabled(featureXRPFees))
37 obj[sfReserveIncrementDrops] =
XRPAmount{0};
42 obj[sfReserveBase] = 0;
43 obj[sfReserveIncrement] = 0;
44 obj[sfReferenceFeeUnits] = 0;
50 obj.setFieldH256(sfAmendment,
uint256(2));
51 obj.setFieldU32(sfLedgerSequence, seq);
65 obj.setAccountID(sfAccount,
AccountID(2));
66 obj.setAccountID(sfDestination,
AccountID(3));
76 Env env(*
this, features);
83 BEAST_EXPECT(reason ==
"Cannot submit pseudo transactions.");
86 BEAST_EXPECT(!result.applied && result.ter ==
temINVALID);
87 return result.applied;
A generic endpoint for log messages.
bool modify(modify_type const &f)
Modify the open ledger.
Writable ledger view that accumulates state and tx changes.
Rules controlling protocol behavior.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
virtual OpenLedger & getOpenLedger()=0
A transaction testing environment.
std::shared_ptr< ReadView const > closed()
Returns the last closed ledger.
T emplace_back(T... args)
FeatureBitset testableAmendments()
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
constexpr XRPAmount
Convert XRP to drops (integral types).
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
ApplyResult apply(ServiceRegistry ®istry, OpenView &view, STTx const &tx, ApplyFlags flags, beast::Journal journal)
Apply a transaction to an OpenView.
bool passesLocalChecks(STObject const &st, std::string &)
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
bool isPseudoTx(STObject const &tx)
Check whether a transaction is a pseudo-transaction.
void run() override
Runs the suite.
void testPrevented(FeatureBitset features)
static std::vector< STTx > getPseudoTxs(Rules const &rules, std::uint32_t seq)
static std::vector< STTx > getRealTxs()