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