xrpld
Loading...
Searching...
No Matches
tx/transactors/vault/VaultClawback.h
1#pragma once
2
3#include <xrpl/beast/utility/Journal.h>
4#include <xrpl/core/ServiceRegistry.h>
5#include <xrpl/ledger/ReadView.h>
6#include <xrpl/protocol/AccountID.h>
7#include <xrpl/protocol/STAmount.h>
8#include <xrpl/protocol/STTx.h>
9#include <xrpl/protocol/TER.h>
10#include <xrpl/protocol/XRPAmount.h>
11#include <xrpl/tx/ApplyContext.h>
12#include <xrpl/tx/Transactor.h>
13
14#include <expected>
15#include <utility>
16
17namespace xrpl {
18
20{
21public:
23
25 {
26 }
27
28 static NotTEC
29 preflight(PreflightContext const& ctx);
30
31 static TER
32 preclaim(PreclaimContext const& ctx);
33
34 TER
35 doApply() override;
36
37 void
38 visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override;
39
40 [[nodiscard]] bool
42 STTx const& tx,
43 TER result,
44 XRPAmount fee,
45 ReadView const& view,
46 beast::Journal const& j) override;
47
48private:
49 std::expected<std::pair<STAmount, STAmount>, TER>
51 SLE::ref vault,
52 SLE::const_ref sleShareIssuance,
53 AccountID const& holder,
55};
56
57} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:44
State information when applying a tx.
A view into a ledger.
Definition ReadView.h:41
std::shared_ptr< STLedgerEntry > const & ref
std::shared_ptr< STLedgerEntry const > const & const_ref
ApplyView & view()
Definition Transactor.h:175
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:607
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:572
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:34
TERSubset< CanCvtToTER > TER
Definition TER.h:647
State information when determining if a tx is likely to claim a fee.
Definition Transactor.h:83
State information when preflighting a tx.
Definition Transactor.h:38