xrpld
Loading...
Searching...
No Matches
tx/transactors/dex/AMMClawback.h
1#pragma once
2
3#include <xrpl/tx/Transactor.h>
4
5namespace xrpl {
6class Sandbox;
7class AMMClawback : public Transactor
8{
9public:
11
12 explicit AMMClawback(ApplyContext& ctx) : Transactor(ctx)
13 {
14 }
15
16 static bool
18
19 static std::uint32_t
21
22 static NotTEC
23 preflight(PreflightContext const& ctx);
24
25 static TER
26 preclaim(PreclaimContext const& ctx);
27
28 TER
29 doApply() override;
30
31 void
32 visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override;
33
34 [[nodiscard]] bool
36 STTx const& tx,
37 TER result,
38 XRPAmount fee,
39 ReadView const& view,
40 beast::Journal const& j) override;
41
42private:
43 TER
45
60 SLE const& ammSle,
61 AccountID const& holder,
62 AccountID const& ammAccount,
63 STAmount const& amountBalance,
64 STAmount const& amount2Balance,
65 STAmount const& lptAMMBalance,
66 STAmount const& holdLPtokens,
67 STAmount const& amount);
68};
69
70} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:38
static NotTEC preflight(PreflightContext const &ctx)
static TER preclaim(PreclaimContext const &ctx)
static std::uint32_t getFlagsMask(PreflightContext const &ctx)
void visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override
Inspect a single ledger entry modified by this transaction.
bool finalizeInvariants(STTx const &tx, TER result, XRPAmount fee, ReadView const &view, beast::Journal const &j) override
Check transaction-specific post-conditions after all entries have been visited.
static bool checkExtraFeatures(PreflightContext const &ctx)
TER applyGuts(Sandbox &view)
std::tuple< TER, STAmount, STAmount, std::optional< STAmount > > equalWithdrawMatchingOneAmount(Sandbox &view, SLE const &ammSle, AccountID const &holder, AccountID const &ammAccount, STAmount const &amountBalance, STAmount const &amount2Balance, STAmount const &lptAMMBalance, STAmount const &holdLPtokens, STAmount const &amount)
Withdraw both assets by providing maximum amount of asset1, asset2's amount will be calculated accord...
TER doApply() override
static constexpr auto kConsequencesFactory
State information when applying a tx.
A view into a ledger.
Definition ReadView.h:31
std::shared_ptr< STLedgerEntry const > const & const_ref
Discardable, editable view to a ledger.
Definition Sandbox.h:15
ApplyView & view()
Definition Transactor.h:136
Transactor(Transactor const &)=delete
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
STLedgerEntry SLE
TERSubset< CanCvtToNotTEC > NotTEC
Definition TER.h:594
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:554
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:28
TERSubset< CanCvtToTER > TER
Definition TER.h:634
State information when determining if a tx is likely to claim a fee.
Definition Transactor.h:61
State information when preflighting a tx.
Definition Transactor.h:18