rippled
Loading...
Searching...
No Matches
CreateOffer.h
1#pragma once
2
3#include <xrpld/app/tx/detail/Transactor.h>
4
5#include <xrpl/protocol/Quality.h>
6
7namespace xrpl {
8
9class PaymentSandbox;
10class Sandbox;
11
13class CreateOffer : public Transactor
14{
15public:
17
19 explicit CreateOffer(ApplyContext& ctx) : Transactor(ctx)
20 {
21 }
22
23 static TxConsequences
25
26 static bool
28
29 static std::uint32_t
31
33 static NotTEC
34 preflight(PreflightContext const& ctx);
35
37 static TER
38 preclaim(PreclaimContext const& ctx);
39
41 TER
42 doApply() override;
43
44private:
46 applyGuts(Sandbox& view, Sandbox& view_cancel);
47
48 // Determine if we are authorized to hold the asset we want to get.
49 static TER
51 ReadView const& view,
52 ApplyFlags const flags,
53 AccountID const id,
54 beast::Journal const j,
55 Issue const& issue);
56
57 // Use the payment flow code to perform offer crossing.
60 PaymentSandbox& psb,
61 PaymentSandbox& psbCancel,
62 Amounts const& takerAmount,
63 std::optional<uint256> const& domainID);
64
65 static std::string
66 format_amount(STAmount const& amount);
67
68 TER
70 Sandbox& sb,
72 Keylet const& offer_index,
73 STAmount const& saTakerPays,
74 STAmount const& saTakerGets,
75 std::function<void(SLE::ref, std::optional<uint256>)> const& setDir);
76};
77
79
80} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:40
State information when applying a tx.
Transactor specialized for creating offers in the ledger.
Definition CreateOffer.h:14
static TER preclaim(PreclaimContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
CreateOffer(ApplyContext &ctx)
Construct a Transactor subclass that creates an offer in the ledger.
Definition CreateOffer.h:19
static constexpr ConsequencesFactoryType ConsequencesFactory
Definition CreateOffer.h:16
TER doApply() override
Precondition: fee collection is likely.
static std::uint32_t getFlagsMask(PreflightContext const &ctx)
static TxConsequences makeTxConsequences(PreflightContext const &ctx)
static bool checkExtraFeatures(PreflightContext const &ctx)
static std::string format_amount(STAmount const &amount)
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)
std::pair< TER, Amounts > flowCross(PaymentSandbox &psb, PaymentSandbox &psbCancel, Amounts const &takerAmount, std::optional< uint256 > const &domainID)
std::pair< TER, bool > applyGuts(Sandbox &view, Sandbox &view_cancel)
static NotTEC preflight(PreflightContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
static TER checkAcceptAsset(ReadView const &view, ApplyFlags const flags, AccountID const id, beast::Journal const j, Issue const &issue)
A currency issued by an account.
Definition Issue.h:13
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:128
Class describing the consequences to the account of applying a transaction if the transaction consume...
Definition applySteps.h:37
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:53
State information when preflighting a tx.
Definition Transactor.h:15