20 #include <ripple/app/tx/applySteps.h>
21 #include <ripple/app/tx/impl/AMMBid.h>
22 #include <ripple/app/tx/impl/AMMCreate.h>
23 #include <ripple/app/tx/impl/AMMDeposit.h>
24 #include <ripple/app/tx/impl/AMMVote.h>
25 #include <ripple/app/tx/impl/AMMWithdraw.h>
26 #include <ripple/app/tx/impl/ApplyContext.h>
27 #include <ripple/app/tx/impl/CancelCheck.h>
28 #include <ripple/app/tx/impl/CancelOffer.h>
29 #include <ripple/app/tx/impl/CashCheck.h>
30 #include <ripple/app/tx/impl/Change.h>
31 #include <ripple/app/tx/impl/Clawback.h>
32 #include <ripple/app/tx/impl/CreateCheck.h>
33 #include <ripple/app/tx/impl/CreateOffer.h>
34 #include <ripple/app/tx/impl/CreateTicket.h>
35 #include <ripple/app/tx/impl/DeleteAccount.h>
36 #include <ripple/app/tx/impl/DepositPreauth.h>
37 #include <ripple/app/tx/impl/Escrow.h>
38 #include <ripple/app/tx/impl/NFTokenAcceptOffer.h>
39 #include <ripple/app/tx/impl/NFTokenBurn.h>
40 #include <ripple/app/tx/impl/NFTokenCancelOffer.h>
41 #include <ripple/app/tx/impl/NFTokenCreateOffer.h>
42 #include <ripple/app/tx/impl/NFTokenMint.h>
43 #include <ripple/app/tx/impl/PayChan.h>
44 #include <ripple/app/tx/impl/Payment.h>
45 #include <ripple/app/tx/impl/SetAccount.h>
46 #include <ripple/app/tx/impl/SetRegularKey.h>
47 #include <ripple/app/tx/impl/SetSignerList.h>
48 #include <ripple/app/tx/impl/SetTrust.h>
86 return T::makeTxConsequences(ctx);
93 auto const tec = T::preflight(ctx);
105 return invoke_preflight_helper<DeleteAccount>(ctx);
107 return invoke_preflight_helper<SetAccount>(ctx);
109 return invoke_preflight_helper<CancelCheck>(ctx);
111 return invoke_preflight_helper<CashCheck>(ctx);
113 return invoke_preflight_helper<CreateCheck>(ctx);
115 return invoke_preflight_helper<DepositPreauth>(ctx);
117 return invoke_preflight_helper<CancelOffer>(ctx);
119 return invoke_preflight_helper<CreateOffer>(ctx);
121 return invoke_preflight_helper<EscrowCreate>(ctx);
123 return invoke_preflight_helper<EscrowFinish>(ctx);
125 return invoke_preflight_helper<EscrowCancel>(ctx);
127 return invoke_preflight_helper<PayChanClaim>(ctx);
129 return invoke_preflight_helper<PayChanCreate>(ctx);
131 return invoke_preflight_helper<PayChanFund>(ctx);
133 return invoke_preflight_helper<Payment>(ctx);
135 return invoke_preflight_helper<SetRegularKey>(ctx);
137 return invoke_preflight_helper<SetSignerList>(ctx);
139 return invoke_preflight_helper<CreateTicket>(ctx);
141 return invoke_preflight_helper<SetTrust>(ctx);
145 return invoke_preflight_helper<Change>(ctx);
147 return invoke_preflight_helper<NFTokenMint>(ctx);
149 return invoke_preflight_helper<NFTokenBurn>(ctx);
151 return invoke_preflight_helper<NFTokenCreateOffer>(ctx);
153 return invoke_preflight_helper<NFTokenCancelOffer>(ctx);
155 return invoke_preflight_helper<NFTokenAcceptOffer>(ctx);
157 return invoke_preflight_helper<Clawback>(ctx);
159 return invoke_preflight_helper<AMMCreate>(ctx);
161 return invoke_preflight_helper<AMMDeposit>(ctx);
163 return invoke_preflight_helper<AMMWithdraw>(ctx);
165 return invoke_preflight_helper<AMMVote>(ctx);
167 return invoke_preflight_helper<AMMBid>(ctx);
186 if (
id != beast::zero)
188 TER result = T::checkSeqProxy(ctx.
view, ctx.
tx, ctx.
j);
193 result = T::checkPriorTxAndLastLedger(ctx);
203 result = T::checkSign(ctx);
209 return T::preclaim(ctx);
215 switch (ctx.tx.getTxnType())
218 return invoke_preclaim<DeleteAccount>(ctx);
220 return invoke_preclaim<SetAccount>(ctx);
222 return invoke_preclaim<CancelCheck>(ctx);
224 return invoke_preclaim<CashCheck>(ctx);
226 return invoke_preclaim<CreateCheck>(ctx);
228 return invoke_preclaim<DepositPreauth>(ctx);
230 return invoke_preclaim<CancelOffer>(ctx);
232 return invoke_preclaim<CreateOffer>(ctx);
234 return invoke_preclaim<EscrowCreate>(ctx);
236 return invoke_preclaim<EscrowFinish>(ctx);
238 return invoke_preclaim<EscrowCancel>(ctx);
240 return invoke_preclaim<PayChanClaim>(ctx);
242 return invoke_preclaim<PayChanCreate>(ctx);
244 return invoke_preclaim<PayChanFund>(ctx);
246 return invoke_preclaim<Payment>(ctx);
248 return invoke_preclaim<SetRegularKey>(ctx);
250 return invoke_preclaim<SetSignerList>(ctx);
252 return invoke_preclaim<CreateTicket>(ctx);
254 return invoke_preclaim<SetTrust>(ctx);
258 return invoke_preclaim<Change>(ctx);
260 return invoke_preclaim<NFTokenMint>(ctx);
262 return invoke_preclaim<NFTokenBurn>(ctx);
264 return invoke_preclaim<NFTokenCreateOffer>(ctx);
266 return invoke_preclaim<NFTokenCancelOffer>(ctx);
268 return invoke_preclaim<NFTokenAcceptOffer>(ctx);
270 return invoke_preclaim<Clawback>(ctx);
272 return invoke_preclaim<AMMCreate>(ctx);
274 return invoke_preclaim<AMMDeposit>(ctx);
276 return invoke_preclaim<AMMWithdraw>(ctx);
278 return invoke_preclaim<AMMVote>(ctx);
280 return invoke_preclaim<AMMBid>(ctx);
365 , potentialSpend_(
beast::zero)
367 , sequencesConsumed_(0)
377 , potentialSpend_(
beast::zero)
378 , seqProx_(tx.getSeqProxy())
379 , sequencesConsumed_(tx.getSeqProxy().isSeq() ? 1 : 0)
553 JLOG(j.
fatal()) <<
"apply: " << e.
what();
571 preflightResult.
flags,
588 preflightResult.
flags,
594 return {*ctx, ctx->preflightResult};
599 JLOG(ctx->j.fatal()) <<
"apply: " << e.
what();
628 return {preclaimResult.
ter,
false};
635 preclaimResult.
flags,
641 JLOG(preclaimResult.
j.
fatal()) <<
"apply: " << e.
what();
AMMDeposit implements AMM deposit Transactor.
TxType getTxnType() const
@ ttNFTOKEN_CREATE_OFFER
This transaction creates a new offer to buy or sell an NFT.
TxConsequences consequences_helper(PreflightContext const &ctx)
ReadView const & view
From the input - the ledger view.
@ ttACCOUNT_DELETE
This transaction type deletes an existing account.
const beast::Journal j
From the input - the journal.
TxConsequences(NotTEC pfresult)
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
@ ttREGULAR_KEY_SET
This transaction type sets or clears an account's "regular key".
@ ttCLAWBACK
This transaction claws back issued tokens.
@ ttSIGNER_LIST_SET
This transaction type modifies the signer list associated with an account.
@ ttESCROW_CANCEL
This transaction type cancels an existing escrow.
Writable ledger view that accumulates state and tx changes.
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
@ ttAMM_DEPOSIT
This transaction type deposits into an AMM instance.
Category
Describes how the transaction affects subsequent transactions.
@ ttOFFER_CANCEL
This transaction type cancels existing offers to trade one asset for another.
@ ttPAYCHAN_CREATE
This transaction type creates a new unidirectional XRP payment channel.
static XRPAmount invoke_calculateBaseFee(ReadView const &view, STTx const &tx)
AMMCreate implements Automatic Market Maker(AMM) creation Transactor.
STTx const & tx
From the input - the transaction.
PreflightResult preflight(Application &app, Rules const &rules, STTx const &tx, ApplyFlags flags, beast::Journal j)
Gate a transaction based on static information.
@ ttNFTOKEN_ACCEPT_OFFER
This transaction accepts an existing offer to buy or sell an existing NFT.
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
@ ttAMENDMENT
This system-generated transaction type is used to update the status of the various amendments.
const bool likelyToClaimFee
Success flag - whether the transaction is likely to claim a fee.
const TER ter
Intermediate transaction result.
See the README.md for an overview of the SetSignerList transaction that this class implements.
@ ttCHECK_CANCEL
This transaction type cancels an existing check.
@ ttPAYMENT
This transaction type executes a payment.
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
@ ttUNL_MODIFY
This system-generated transaction type is used to update the network's negative UNL.
std::pair< TER, bool > doApply(PreclaimResult const &preclaimResult, Application &app, OpenView &view)
Apply a prechecked transaction to an OpenView.
@ ttCHECK_CREATE
This transaction type creates a new check.
Describes the results of the preflight check.
@ ttAMM_CREATE
This transaction type creates an AMM instance.
XRPAmount const & potentialSpend() const
Potential Spend.
const Rules rules
From the input - the rules.
@ ttTRUST_SET
This transaction type modifies a trustline between two accounts.
AccountID getAccountID(SField const &field) const
@ blocker
Affects the ability of subsequent transactions to claim a fee.
const NotTEC ter
Intermediate transaction result.
@ ttNFTOKEN_MINT
This transaction mints a new NFT.
@ ttESCROW_CREATE
This transaction type creates an escrow object.
TERSubset< CanCvtToTER > TER
AMMVote implements AMM vote Transactor.
@ ttAMM_WITHDRAW
This transaction type withdraws from an AMM instance.
@ ttESCROW_FINISH
This transaction type completes an existing escrow.
std::pair< NotTEC, TxConsequences > invoke_preflight_helper(PreflightContext const &ctx)
AMMWithdraw implements AMM withdraw Transactor.
State information when applying a tx.
A generic endpoint for log messages.
Transactor specialized for creating offers in the ledger.
bool isBlocker_
Describes how the transaction affects subsequent transactions.
@ ttNFTOKEN_CANCEL_OFFER
This transaction cancels an existing offer to buy or sell an existing NFT.
@ ttOFFER_CREATE
This transaction type creates an offer to trade one asset for another.
static std::pair< TER, bool > invoke_apply(ApplyContext &ctx)
State information when determining if a tx is likely to claim a fee.
XRPAmount calculateDefaultBaseFee(ReadView const &view, STTx const &tx)
Return the minimum fee that an "ordinary" transaction would pay.
@ ttACCOUNT_SET
This transaction type adjusts various account settings.
PreclaimResult preclaim(PreflightResult const &preflightResult, Application &app, OpenView const &view)
Gate a transaction based on static ledger information.
std::uint32_t sequencesConsumed() const
Sequences consumed.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static TER invoke_preclaim(PreclaimContext const &ctx)
LedgerIndex seq() const
Returns the sequence number of the base ledger.
@ ttDEPOSIT_PREAUTH
This transaction type grants or revokes authorization to transfer funds.
@ ttCHECK_CASH
This transaction type cashes an existing check.
Describes the results of the preclaim check.
@ ttPAYCHAN_FUND
This transaction type funds an existing unidirectional XRP payment channel.
A type that represents either a sequence value or a ticket value.
XRPAmount potentialSpend_
Does NOT include the fee.
@ ttAMM_VOTE
This transaction type votes for the trading fee.
@ ttPAYCHAN_CLAIM
This transaction type submits a claim against an existing unidirectional payment channel.
Rules controlling protocol behavior.
XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Compute only the expected base fee for a transaction.
@ ttNFTOKEN_BURN
This transaction burns (i.e.
const ApplyFlags flags
From the input - the flags.
const SF_ACCOUNT sfAccount
const ApplyFlags flags
From the input - the flags.
std::uint32_t sequencesConsumed_
Number of sequences consumed.
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
State information when preflighting a tx.
AMMBid implements AMM bid Transactor.
Class describing the consequences to the account of applying a transaction if the transaction consume...
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Rules const & rules() const override
Returns the tx processing rules.
static std::pair< NotTEC, TxConsequences > invoke_preflight(PreflightContext const &ctx)
@ ttTICKET_CREATE
This transaction type creates a new set of tickets.
STTx const & tx
From the input - the transaction.
@ ttAMM_BID
This transaction type bids for the auction slot.
const beast::Journal j
From the input - the journal.