xrpld
Loading...
Searching...
No Matches
tx/transactors/lending/LoanManage.h
1#pragma once
2
3#include <xrpl/beast/utility/Journal.h>
4#include <xrpl/core/ServiceRegistry.h>
5#include <xrpl/ledger/ApplyView.h>
6#include <xrpl/ledger/ReadView.h>
7#include <xrpl/protocol/Asset.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 <cstdint>
15
16namespace xrpl {
17
18class LoanManage : public Transactor
19{
20public:
22
23 explicit LoanManage(ApplyContext& ctx) : Transactor(ctx)
24 {
25 }
26
27 static bool
29
30 static std::uint32_t
32
33 static NotTEC
34 preflight(PreflightContext const& ctx);
35
36 static TER
37 preclaim(PreclaimContext const& ctx);
38
42 static TER
45 SLE::ref loanSle,
46 SLE::ref brokerSle,
47 SLE::ref vaultSle,
48 Asset const& vaultAsset,
50
54 static TER
57 SLE::ref loanSle,
58 SLE::ref vaultSle,
59 Asset const& vaultAsset,
61
65 [[nodiscard]] static TER
68 SLE::ref loanSle,
69 SLE::ref vaultSle,
70 Asset const& vaultAsset,
72
73 TER
74 doApply() override;
75
76 void
77 visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override;
78
79 [[nodiscard]] bool
81 STTx const& tx,
82 TER result,
83 XRPAmount fee,
84 ReadView const& view,
85 beast::Journal const& j) override;
86};
87
88//------------------------------------------------------------------------------
89
90} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:44
State information when applying a tx.
Writeable view to a ledger, for applying a transaction.
Definition ApplyView.h:134
void visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override
Inspect a single ledger entry modified by this transaction.
static TER defaultLoan(ApplyView &view, SLE::ref loanSle, SLE::ref brokerSle, SLE::ref vaultSle, Asset const &vaultAsset, beast::Journal j)
Helper function that might be needed by other transactors.
static TER preclaim(PreclaimContext const &ctx)
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 std::uint32_t getFlagsMask(PreflightContext const &ctx)
static TER unimpairLoan(ApplyView &view, SLE::ref loanSle, SLE::ref vaultSle, Asset const &vaultAsset, beast::Journal j)
Helper function that might be needed by other transactors.
static TER impairLoan(ApplyView &view, SLE::ref loanSle, SLE::ref vaultSle, Asset const &vaultAsset, beast::Journal j)
Helper function that might be needed by other transactors.
TER doApply() override
static NotTEC preflight(PreflightContext const &ctx)
static bool checkExtraFeatures(PreflightContext const &ctx)
static constexpr auto kConsequencesFactory
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
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
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:572
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