xrpld
Loading...
Searching...
No Matches
tx/transactors/vault/VaultClawback.h
1#pragma once
2
3#include <xrpl/tx/Transactor.h>
4
5#include <expected>
6
7namespace xrpl {
8
10{
11public:
13
15 {
16 }
17
18 static NotTEC
19 preflight(PreflightContext const& ctx);
20
21 static TER
22 preclaim(PreclaimContext const& ctx);
23
24 TER
25 doApply() override;
26
27 void
28 visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override;
29
30 [[nodiscard]] bool
32 STTx const& tx,
33 TER result,
34 XRPAmount fee,
35 ReadView const& view,
36 beast::Journal const& j) override;
37
38private:
39 std::expected<std::pair<STAmount, STAmount>, TER>
41 SLE::ref vault,
42 SLE::const_ref sleShareIssuance,
43 AccountID const& holder,
45};
46
47} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:38
State information when applying a tx.
A view into a ledger.
Definition ReadView.h:31
std::shared_ptr< STLedgerEntry > const & ref
std::shared_ptr< STLedgerEntry const > const & const_ref
ApplyView & view()
Definition Transactor.h:136
Transactor(Transactor const &)=delete
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.
void visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override
Inspect a single ledger entry modified by this transaction.
static NotTEC preflight(PreflightContext const &ctx)
static TER preclaim(PreclaimContext const &ctx)
std::expected< std::pair< STAmount, STAmount >, TER > assetsToClawback(SLE::ref vault, SLE::const_ref sleShareIssuance, AccountID const &holder, STAmount const &clawbackAmount)
TER doApply() override
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
TERSubset< CanCvtToNotTEC > NotTEC
Definition TER.h:594
STAmount clawbackAmount(SLE::const_ref vault, std::optional< STAmount > const &maybeAmount, AccountID const &account)
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