1#include <xrpl/tx/transactors/dex/OfferCancel.h>
3#include <xrpl/basics/Log.h>
4#include <xrpl/ledger/helpers/OfferHelpers.h>
5#include <xrpl/protocol/Indexes.h>
6#include <xrpl/protocol/SField.h>
7#include <xrpl/protocol/STLedgerEntry.h>
8#include <xrpl/protocol/STTx.h>
9#include <xrpl/protocol/TER.h>
10#include <xrpl/protocol/XRPAmount.h>
11#include <xrpl/tx/Transactor.h>
18 if (ctx.
tx[sfOfferSequence] == 0u)
20 JLOG(ctx.
j.
trace()) <<
"OfferCancel::preflight: missing sequence";
32 auto const id = ctx.
tx[sfAccount];
33 auto const offerSequence = ctx.
tx[sfOfferSequence];
39 if ((*sle)[sfSequence] <= offerSequence)
41 JLOG(ctx.
j.
trace()) <<
"Malformed transaction: "
42 <<
"Sequence " << offerSequence <<
" is invalid.";
54 auto const offerSequence =
ctx_.tx[sfOfferSequence];
62 JLOG(
j_.debug()) <<
"Trying to cancel offer #" << offerSequence;
66 JLOG(
j_.debug()) <<
"Offer #" << offerSequence <<
" can't be found.";
A generic endpoint for log messages.
Stream trace() const
Severity stream access functions.
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 NotTEC preflight(PreflightContext const &ctx)
void visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override
Inspect a single ledger entry modified by this transaction.
virtual SLE::const_pointer read(Keylet const &k) const =0
Return the state item associated with a key.
std::shared_ptr< STLedgerEntry const > const & const_ref
AccountID const accountID_
Keylet offer(AccountID const &id, std::uint32_t seq) noexcept
An offer from an account.
Keylet account(AccountID const &id) noexcept
AccountID root.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
TER offerDelete(ApplyView &view, SLE::ref sle, beast::Journal j)
Delete an offer.
TERSubset< CanCvtToNotTEC > NotTEC
TERSubset< CanCvtToTER > TER
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.