rippled
Loading...
Searching...
No Matches
CreateOffer.h
1#ifndef XRPL_TX_CREATEOFFER_H_INCLUDED
2#define XRPL_TX_CREATEOFFER_H_INCLUDED
3
4#include <xrpld/app/tx/detail/Transactor.h>
5
6#include <xrpl/protocol/Quality.h>
7
8namespace ripple {
9
10class PaymentSandbox;
11class Sandbox;
12
14class CreateOffer : public Transactor
15{
16public:
18
20 explicit CreateOffer(ApplyContext& ctx) : Transactor(ctx)
21 {
22 }
23
24 static TxConsequences
26
27 static bool
29
30 static std::uint32_t
32
34 static NotTEC
35 preflight(PreflightContext const& ctx);
36
38 static TER
39 preclaim(PreclaimContext const& ctx);
40
42 TER
43 doApply() override;
44
45private:
47 applyGuts(Sandbox& view, Sandbox& view_cancel);
48
49 // Determine if we are authorized to hold the asset we want to get.
50 static TER
52 ReadView const& view,
53 ApplyFlags const flags,
54 AccountID const id,
55 beast::Journal const j,
56 Issue const& issue);
57
58 // Use the payment flow code to perform offer crossing.
61 PaymentSandbox& psb,
62 PaymentSandbox& psbCancel,
63 Amounts const& takerAmount,
64 std::optional<uint256> const& domainID);
65
66 static std::string
67 format_amount(STAmount const& amount);
68
69 TER
71 Sandbox& sb,
73 Keylet const& offer_index,
74 STAmount const& saTakerPays,
75 STAmount const& saTakerGets,
76 std::function<void(SLE::ref, std::optional<uint256>)> const& setDir);
77};
78
80
81} // namespace ripple
82
83#endif
A generic endpoint for log messages.
Definition Journal.h:41
State information when applying a tx.
Transactor specialized for creating offers in the ledger.
Definition CreateOffer.h:15
std::pair< TER, Amounts > flowCross(PaymentSandbox &psb, PaymentSandbox &psbCancel, Amounts const &takerAmount, std::optional< uint256 > const &domainID)
static TER checkAcceptAsset(ReadView const &view, ApplyFlags const flags, AccountID const id, beast::Journal const j, Issue const &issue)
CreateOffer(ApplyContext &ctx)
Construct a Transactor subclass that creates an offer in the ledger.
Definition CreateOffer.h:20
static TER preclaim(PreclaimContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
static std::string format_amount(STAmount const &amount)
static constexpr ConsequencesFactoryType ConsequencesFactory
Definition CreateOffer.h:17
static std::uint32_t getFlagsMask(PreflightContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
static TxConsequences makeTxConsequences(PreflightContext const &ctx)
TER applyHybrid(Sandbox &sb, std::shared_ptr< STLedgerEntry > sleOffer, Keylet const &offer_index, STAmount const &saTakerPays, STAmount const &saTakerGets, std::function< void(SLE::ref, std::optional< uint256 >)> const &setDir)
TER doApply() override
Precondition: fee collection is likely.
static bool checkExtraFeatures(PreflightContext const &ctx)
std::pair< TER, bool > applyGuts(Sandbox &view, Sandbox &view_cancel)
A currency issued by an account.
Definition Issue.h:14
A wrapper which makes credits unavailable to balances.
A view into a ledger.
Definition ReadView.h:32
Discardable, editable view to a ledger.
Definition Sandbox.h:16
ApplyView & view()
Definition Transactor.h:144
Class describing the consequences to the account of applying a transaction if the transaction consume...
Definition applySteps.h:39
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:20
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:16