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/AMMDelete.h>
24 #include <ripple/app/tx/impl/AMMDeposit.h>
25 #include <ripple/app/tx/impl/AMMVote.h>
26 #include <ripple/app/tx/impl/AMMWithdraw.h>
27 #include <ripple/app/tx/impl/ApplyContext.h>
28 #include <ripple/app/tx/impl/CancelCheck.h>
29 #include <ripple/app/tx/impl/CancelOffer.h>
30 #include <ripple/app/tx/impl/CashCheck.h>
31 #include <ripple/app/tx/impl/Change.h>
32 #include <ripple/app/tx/impl/Clawback.h>
33 #include <ripple/app/tx/impl/CreateCheck.h>
34 #include <ripple/app/tx/impl/CreateOffer.h>
35 #include <ripple/app/tx/impl/CreateTicket.h>
36 #include <ripple/app/tx/impl/DeleteAccount.h>
37 #include <ripple/app/tx/impl/DepositPreauth.h>
38 #include <ripple/app/tx/impl/Escrow.h>
39 #include <ripple/app/tx/impl/NFTokenAcceptOffer.h>
40 #include <ripple/app/tx/impl/NFTokenBurn.h>
41 #include <ripple/app/tx/impl/NFTokenCancelOffer.h>
42 #include <ripple/app/tx/impl/NFTokenCreateOffer.h>
43 #include <ripple/app/tx/impl/NFTokenMint.h>
44 #include <ripple/app/tx/impl/PayChan.h>
45 #include <ripple/app/tx/impl/Payment.h>
46 #include <ripple/app/tx/impl/SetAccount.h>
47 #include <ripple/app/tx/impl/SetRegularKey.h>
48 #include <ripple/app/tx/impl/SetSignerList.h>
49 #include <ripple/app/tx/impl/SetTrust.h>
87 return T::makeTxConsequences(ctx);
94 auto const tec = T::preflight(ctx);
106 return invoke_preflight_helper<DeleteAccount>(ctx);
108 return invoke_preflight_helper<SetAccount>(ctx);
110 return invoke_preflight_helper<CancelCheck>(ctx);
112 return invoke_preflight_helper<CashCheck>(ctx);
114 return invoke_preflight_helper<CreateCheck>(ctx);
116 return invoke_preflight_helper<DepositPreauth>(ctx);
118 return invoke_preflight_helper<CancelOffer>(ctx);
120 return invoke_preflight_helper<CreateOffer>(ctx);
122 return invoke_preflight_helper<EscrowCreate>(ctx);
124 return invoke_preflight_helper<EscrowFinish>(ctx);
126 return invoke_preflight_helper<EscrowCancel>(ctx);
128 return invoke_preflight_helper<PayChanClaim>(ctx);
130 return invoke_preflight_helper<PayChanCreate>(ctx);
132 return invoke_preflight_helper<PayChanFund>(ctx);
134 return invoke_preflight_helper<Payment>(ctx);
136 return invoke_preflight_helper<SetRegularKey>(ctx);
138 return invoke_preflight_helper<SetSignerList>(ctx);
140 return invoke_preflight_helper<CreateTicket>(ctx);
142 return invoke_preflight_helper<SetTrust>(ctx);
146 return invoke_preflight_helper<Change>(ctx);
148 return invoke_preflight_helper<NFTokenMint>(ctx);
150 return invoke_preflight_helper<NFTokenBurn>(ctx);
152 return invoke_preflight_helper<NFTokenCreateOffer>(ctx);
154 return invoke_preflight_helper<NFTokenCancelOffer>(ctx);
156 return invoke_preflight_helper<NFTokenAcceptOffer>(ctx);
158 return invoke_preflight_helper<Clawback>(ctx);
160 return invoke_preflight_helper<AMMCreate>(ctx);
162 return invoke_preflight_helper<AMMDeposit>(ctx);
164 return invoke_preflight_helper<AMMWithdraw>(ctx);
166 return invoke_preflight_helper<AMMVote>(ctx);
168 return invoke_preflight_helper<AMMBid>(ctx);
170 return invoke_preflight_helper<AMMDelete>(ctx);
189 if (
id != beast::zero)
191 TER result = T::checkSeqProxy(ctx.
view, ctx.
tx, ctx.
j);
196 result = T::checkPriorTxAndLastLedger(ctx);
206 result = T::checkSign(ctx);
212 return T::preclaim(ctx);
218 switch (ctx.tx.getTxnType())
221 return invoke_preclaim<DeleteAccount>(ctx);
223 return invoke_preclaim<SetAccount>(ctx);
225 return invoke_preclaim<CancelCheck>(ctx);
227 return invoke_preclaim<CashCheck>(ctx);
229 return invoke_preclaim<CreateCheck>(ctx);
231 return invoke_preclaim<DepositPreauth>(ctx);
233 return invoke_preclaim<CancelOffer>(ctx);
235 return invoke_preclaim<CreateOffer>(ctx);
237 return invoke_preclaim<EscrowCreate>(ctx);
239 return invoke_preclaim<EscrowFinish>(ctx);
241 return invoke_preclaim<EscrowCancel>(ctx);
243 return invoke_preclaim<PayChanClaim>(ctx);
245 return invoke_preclaim<PayChanCreate>(ctx);
247 return invoke_preclaim<PayChanFund>(ctx);
249 return invoke_preclaim<Payment>(ctx);
251 return invoke_preclaim<SetRegularKey>(ctx);
253 return invoke_preclaim<SetSignerList>(ctx);
255 return invoke_preclaim<CreateTicket>(ctx);
257 return invoke_preclaim<SetTrust>(ctx);
261 return invoke_preclaim<Change>(ctx);
263 return invoke_preclaim<NFTokenMint>(ctx);
265 return invoke_preclaim<NFTokenBurn>(ctx);
267 return invoke_preclaim<NFTokenCreateOffer>(ctx);
269 return invoke_preclaim<NFTokenCancelOffer>(ctx);
271 return invoke_preclaim<NFTokenAcceptOffer>(ctx);
273 return invoke_preclaim<Clawback>(ctx);
275 return invoke_preclaim<AMMCreate>(ctx);
277 return invoke_preclaim<AMMDeposit>(ctx);
279 return invoke_preclaim<AMMWithdraw>(ctx);
281 return invoke_preclaim<AMMVote>(ctx);
283 return invoke_preclaim<AMMBid>(ctx);
285 return invoke_preclaim<AMMDelete>(ctx);
372 , potentialSpend_(
beast::zero)
374 , sequencesConsumed_(0)
384 , potentialSpend_(
beast::zero)
385 , seqProx_(tx.getSeqProxy())
386 , sequencesConsumed_(tx.getSeqProxy().isSeq() ? 1 : 0)
564 JLOG(j.
fatal()) <<
"apply: " << e.
what();
582 preflightResult.
flags,
599 preflightResult.
flags,
605 return {*ctx, ctx->preflightResult};
610 JLOG(ctx->j.fatal()) <<
"apply: " << e.
what();
639 return {preclaimResult.
ter,
false};
646 preclaimResult.
flags,
652 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.
@ ttAMM_DELETE
This transaction type deletes AMM in the empty state.
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.
AMMDelete implements AMM delete transactor.
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.