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>
50 #include <ripple/app/tx/impl/XChainBridge.h>
51 #include <ripple/protocol/TxFormats.h>
89 return T::makeTxConsequences(ctx);
96 auto const tec = T::preflight(ctx);
108 return invoke_preflight_helper<DeleteAccount>(ctx);
110 return invoke_preflight_helper<SetAccount>(ctx);
112 return invoke_preflight_helper<CancelCheck>(ctx);
114 return invoke_preflight_helper<CashCheck>(ctx);
116 return invoke_preflight_helper<CreateCheck>(ctx);
118 return invoke_preflight_helper<DepositPreauth>(ctx);
120 return invoke_preflight_helper<CancelOffer>(ctx);
122 return invoke_preflight_helper<CreateOffer>(ctx);
124 return invoke_preflight_helper<EscrowCreate>(ctx);
126 return invoke_preflight_helper<EscrowFinish>(ctx);
128 return invoke_preflight_helper<EscrowCancel>(ctx);
130 return invoke_preflight_helper<PayChanClaim>(ctx);
132 return invoke_preflight_helper<PayChanCreate>(ctx);
134 return invoke_preflight_helper<PayChanFund>(ctx);
136 return invoke_preflight_helper<Payment>(ctx);
138 return invoke_preflight_helper<SetRegularKey>(ctx);
140 return invoke_preflight_helper<SetSignerList>(ctx);
142 return invoke_preflight_helper<CreateTicket>(ctx);
144 return invoke_preflight_helper<SetTrust>(ctx);
148 return invoke_preflight_helper<Change>(ctx);
150 return invoke_preflight_helper<NFTokenMint>(ctx);
152 return invoke_preflight_helper<NFTokenBurn>(ctx);
154 return invoke_preflight_helper<NFTokenCreateOffer>(ctx);
156 return invoke_preflight_helper<NFTokenCancelOffer>(ctx);
158 return invoke_preflight_helper<NFTokenAcceptOffer>(ctx);
160 return invoke_preflight_helper<Clawback>(ctx);
162 return invoke_preflight_helper<AMMCreate>(ctx);
164 return invoke_preflight_helper<AMMDeposit>(ctx);
166 return invoke_preflight_helper<AMMWithdraw>(ctx);
168 return invoke_preflight_helper<AMMVote>(ctx);
170 return invoke_preflight_helper<AMMBid>(ctx);
172 return invoke_preflight_helper<AMMDelete>(ctx);
174 return invoke_preflight_helper<XChainCreateBridge>(ctx);
176 return invoke_preflight_helper<BridgeModify>(ctx);
178 return invoke_preflight_helper<XChainCreateClaimID>(ctx);
180 return invoke_preflight_helper<XChainCommit>(ctx);
182 return invoke_preflight_helper<XChainClaim>(ctx);
184 return invoke_preflight_helper<XChainAddClaimAttestation>(ctx);
186 return invoke_preflight_helper<XChainAddAccountCreateAttestation>(
189 return invoke_preflight_helper<XChainCreateAccountCommit>(ctx);
208 if (
id != beast::zero)
210 TER result = T::checkSeqProxy(ctx.
view, ctx.
tx, ctx.
j);
215 result = T::checkPriorTxAndLastLedger(ctx);
225 result = T::checkSign(ctx);
231 return T::preclaim(ctx);
237 switch (ctx.tx.getTxnType())
240 return invoke_preclaim<DeleteAccount>(ctx);
242 return invoke_preclaim<SetAccount>(ctx);
244 return invoke_preclaim<CancelCheck>(ctx);
246 return invoke_preclaim<CashCheck>(ctx);
248 return invoke_preclaim<CreateCheck>(ctx);
250 return invoke_preclaim<DepositPreauth>(ctx);
252 return invoke_preclaim<CancelOffer>(ctx);
254 return invoke_preclaim<CreateOffer>(ctx);
256 return invoke_preclaim<EscrowCreate>(ctx);
258 return invoke_preclaim<EscrowFinish>(ctx);
260 return invoke_preclaim<EscrowCancel>(ctx);
262 return invoke_preclaim<PayChanClaim>(ctx);
264 return invoke_preclaim<PayChanCreate>(ctx);
266 return invoke_preclaim<PayChanFund>(ctx);
268 return invoke_preclaim<Payment>(ctx);
270 return invoke_preclaim<SetRegularKey>(ctx);
272 return invoke_preclaim<SetSignerList>(ctx);
274 return invoke_preclaim<CreateTicket>(ctx);
276 return invoke_preclaim<SetTrust>(ctx);
280 return invoke_preclaim<Change>(ctx);
282 return invoke_preclaim<NFTokenMint>(ctx);
284 return invoke_preclaim<NFTokenBurn>(ctx);
286 return invoke_preclaim<NFTokenCreateOffer>(ctx);
288 return invoke_preclaim<NFTokenCancelOffer>(ctx);
290 return invoke_preclaim<NFTokenAcceptOffer>(ctx);
292 return invoke_preclaim<Clawback>(ctx);
294 return invoke_preclaim<AMMCreate>(ctx);
296 return invoke_preclaim<AMMDeposit>(ctx);
298 return invoke_preclaim<AMMWithdraw>(ctx);
300 return invoke_preclaim<AMMVote>(ctx);
302 return invoke_preclaim<AMMBid>(ctx);
304 return invoke_preclaim<AMMDelete>(ctx);
306 return invoke_preclaim<XChainCreateBridge>(ctx);
308 return invoke_preclaim<BridgeModify>(ctx);
310 return invoke_preclaim<XChainCreateClaimID>(ctx);
312 return invoke_preclaim<XChainCommit>(ctx);
314 return invoke_preclaim<XChainClaim>(ctx);
316 return invoke_preclaim<XChainCreateAccountCommit>(ctx);
318 return invoke_preclaim<XChainAddClaimAttestation>(ctx);
320 return invoke_preclaim<XChainAddAccountCreateAttestation>(ctx);
424 , potentialSpend_(
beast::zero)
426 , sequencesConsumed_(0)
436 , potentialSpend_(
beast::zero)
437 , seqProx_(tx.getSeqProxy())
438 , sequencesConsumed_(tx.getSeqProxy().isSeq() ? 1 : 0)
648 JLOG(j.
fatal()) <<
"apply: " << e.
what();
666 preflightResult.
flags,
683 preflightResult.
flags,
689 return {*ctx, ctx->preflightResult};
694 JLOG(ctx->j.fatal()) <<
"apply: " << e.
what();
723 return {preclaimResult.
ter,
false};
730 preclaimResult.
flags,
736 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.
@ ttXCHAIN_CLAIM
This transaction completes a crosschain transaction.
@ ttESCROW_CANCEL
This transaction type cancels an existing escrow.
Writable ledger view that accumulates state and tx changes.
@ ttXCHAIN_CREATE_BRIDGE
This transactions creates a sidechain.
@ 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.
@ ttXCHAIN_CREATE_CLAIM_ID
This transactions creates a crosschain sequence number.
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.
@ ttXCHAIN_COMMIT
This transactions initiates a crosschain transaction.
@ 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
@ ttXCHAIN_MODIFY_BRIDGE
This transaction modifies a sidechain.
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.
@ ttXCHAIN_ACCOUNT_CREATE_COMMIT
This transaction initiates a crosschain account create transaction.
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)
@ ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION
This transaction adds an attestation to a claimid.
@ 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.
@ ttXCHAIN_ADD_CLAIM_ATTESTATION
This transaction adds an attestation to a claimid.