rippled
applySteps.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
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>
49 
50 namespace ripple {
51 
52 // Templates so preflight does the right thing with T::ConsequencesFactory.
53 //
54 // This could be done more easily using if constexpr, but Visual Studio
55 // 2017 doesn't handle if constexpr correctly. So once we're no longer
56 // building with Visual Studio 2017 we can consider replacing the four
57 // templates with a single template function that uses if constexpr.
58 //
59 // For Transactor::Normal
60 template <
61  class T,
63 TxConsequences
65 {
66  return TxConsequences(ctx.tx);
67 };
68 
69 // For Transactor::Blocker
70 template <
71  class T,
73 TxConsequences
74 consequences_helper(PreflightContext const& ctx)
75 {
76  return TxConsequences(ctx.tx, TxConsequences::blocker);
77 };
78 
79 // For Transactor::Custom
80 template <
81  class T,
83 TxConsequences
84 consequences_helper(PreflightContext const& ctx)
85 {
86  return T::makeTxConsequences(ctx);
87 };
88 
89 template <class T>
92 {
93  auto const tec = T::preflight(ctx);
94  return {
95  tec,
96  isTesSuccess(tec) ? consequences_helper<T>(ctx) : TxConsequences{tec}};
97 }
98 
101 {
102  switch (ctx.tx.getTxnType())
103  {
104  case ttACCOUNT_DELETE:
105  return invoke_preflight_helper<DeleteAccount>(ctx);
106  case ttACCOUNT_SET:
107  return invoke_preflight_helper<SetAccount>(ctx);
108  case ttCHECK_CANCEL:
109  return invoke_preflight_helper<CancelCheck>(ctx);
110  case ttCHECK_CASH:
111  return invoke_preflight_helper<CashCheck>(ctx);
112  case ttCHECK_CREATE:
113  return invoke_preflight_helper<CreateCheck>(ctx);
114  case ttDEPOSIT_PREAUTH:
115  return invoke_preflight_helper<DepositPreauth>(ctx);
116  case ttOFFER_CANCEL:
117  return invoke_preflight_helper<CancelOffer>(ctx);
118  case ttOFFER_CREATE:
119  return invoke_preflight_helper<CreateOffer>(ctx);
120  case ttESCROW_CREATE:
121  return invoke_preflight_helper<EscrowCreate>(ctx);
122  case ttESCROW_FINISH:
123  return invoke_preflight_helper<EscrowFinish>(ctx);
124  case ttESCROW_CANCEL:
125  return invoke_preflight_helper<EscrowCancel>(ctx);
126  case ttPAYCHAN_CLAIM:
127  return invoke_preflight_helper<PayChanClaim>(ctx);
128  case ttPAYCHAN_CREATE:
129  return invoke_preflight_helper<PayChanCreate>(ctx);
130  case ttPAYCHAN_FUND:
131  return invoke_preflight_helper<PayChanFund>(ctx);
132  case ttPAYMENT:
133  return invoke_preflight_helper<Payment>(ctx);
134  case ttREGULAR_KEY_SET:
135  return invoke_preflight_helper<SetRegularKey>(ctx);
136  case ttSIGNER_LIST_SET:
137  return invoke_preflight_helper<SetSignerList>(ctx);
138  case ttTICKET_CREATE:
139  return invoke_preflight_helper<CreateTicket>(ctx);
140  case ttTRUST_SET:
141  return invoke_preflight_helper<SetTrust>(ctx);
142  case ttAMENDMENT:
143  case ttFEE:
144  case ttUNL_MODIFY:
145  return invoke_preflight_helper<Change>(ctx);
146  case ttNFTOKEN_MINT:
147  return invoke_preflight_helper<NFTokenMint>(ctx);
148  case ttNFTOKEN_BURN:
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);
156  case ttCLAWBACK:
157  return invoke_preflight_helper<Clawback>(ctx);
158  case ttAMM_CREATE:
159  return invoke_preflight_helper<AMMCreate>(ctx);
160  case ttAMM_DEPOSIT:
161  return invoke_preflight_helper<AMMDeposit>(ctx);
162  case ttAMM_WITHDRAW:
163  return invoke_preflight_helper<AMMWithdraw>(ctx);
164  case ttAMM_VOTE:
165  return invoke_preflight_helper<AMMVote>(ctx);
166  case ttAMM_BID:
167  return invoke_preflight_helper<AMMBid>(ctx);
168  default:
169  assert(false);
171  }
172 }
173 
174 /* invoke_preclaim<T> uses name hiding to accomplish
175  compile-time polymorphism of (presumably) static
176  class functions for Transactor and derived classes.
177 */
178 template <class T>
179 static TER
181 {
182  // If the transactor requires a valid account and the transaction doesn't
183  // list one, preflight will have already a flagged a failure.
184  auto const id = ctx.tx.getAccountID(sfAccount);
185 
186  if (id != beast::zero)
187  {
188  TER result = T::checkSeqProxy(ctx.view, ctx.tx, ctx.j);
189 
190  if (result != tesSUCCESS)
191  return result;
192 
193  result = T::checkPriorTxAndLastLedger(ctx);
194 
195  if (result != tesSUCCESS)
196  return result;
197 
198  result = T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx));
199 
200  if (result != tesSUCCESS)
201  return result;
202 
203  result = T::checkSign(ctx);
204 
205  if (result != tesSUCCESS)
206  return result;
207  }
208 
209  return T::preclaim(ctx);
210 }
211 
212 static TER
213 invoke_preclaim(PreclaimContext const& ctx)
214 {
215  switch (ctx.tx.getTxnType())
216  {
217  case ttACCOUNT_DELETE:
218  return invoke_preclaim<DeleteAccount>(ctx);
219  case ttACCOUNT_SET:
220  return invoke_preclaim<SetAccount>(ctx);
221  case ttCHECK_CANCEL:
222  return invoke_preclaim<CancelCheck>(ctx);
223  case ttCHECK_CASH:
224  return invoke_preclaim<CashCheck>(ctx);
225  case ttCHECK_CREATE:
226  return invoke_preclaim<CreateCheck>(ctx);
227  case ttDEPOSIT_PREAUTH:
228  return invoke_preclaim<DepositPreauth>(ctx);
229  case ttOFFER_CANCEL:
230  return invoke_preclaim<CancelOffer>(ctx);
231  case ttOFFER_CREATE:
232  return invoke_preclaim<CreateOffer>(ctx);
233  case ttESCROW_CREATE:
234  return invoke_preclaim<EscrowCreate>(ctx);
235  case ttESCROW_FINISH:
236  return invoke_preclaim<EscrowFinish>(ctx);
237  case ttESCROW_CANCEL:
238  return invoke_preclaim<EscrowCancel>(ctx);
239  case ttPAYCHAN_CLAIM:
240  return invoke_preclaim<PayChanClaim>(ctx);
241  case ttPAYCHAN_CREATE:
242  return invoke_preclaim<PayChanCreate>(ctx);
243  case ttPAYCHAN_FUND:
244  return invoke_preclaim<PayChanFund>(ctx);
245  case ttPAYMENT:
246  return invoke_preclaim<Payment>(ctx);
247  case ttREGULAR_KEY_SET:
248  return invoke_preclaim<SetRegularKey>(ctx);
249  case ttSIGNER_LIST_SET:
250  return invoke_preclaim<SetSignerList>(ctx);
251  case ttTICKET_CREATE:
252  return invoke_preclaim<CreateTicket>(ctx);
253  case ttTRUST_SET:
254  return invoke_preclaim<SetTrust>(ctx);
255  case ttAMENDMENT:
256  case ttFEE:
257  case ttUNL_MODIFY:
258  return invoke_preclaim<Change>(ctx);
259  case ttNFTOKEN_MINT:
260  return invoke_preclaim<NFTokenMint>(ctx);
261  case ttNFTOKEN_BURN:
262  return invoke_preclaim<NFTokenBurn>(ctx);
264  return invoke_preclaim<NFTokenCreateOffer>(ctx);
266  return invoke_preclaim<NFTokenCancelOffer>(ctx);
268  return invoke_preclaim<NFTokenAcceptOffer>(ctx);
269  case ttCLAWBACK:
270  return invoke_preclaim<Clawback>(ctx);
271  case ttAMM_CREATE:
272  return invoke_preclaim<AMMCreate>(ctx);
273  case ttAMM_DEPOSIT:
274  return invoke_preclaim<AMMDeposit>(ctx);
275  case ttAMM_WITHDRAW:
276  return invoke_preclaim<AMMWithdraw>(ctx);
277  case ttAMM_VOTE:
278  return invoke_preclaim<AMMVote>(ctx);
279  case ttAMM_BID:
280  return invoke_preclaim<AMMBid>(ctx);
281  default:
282  assert(false);
283  return temUNKNOWN;
284  }
285 }
286 
287 static XRPAmount
288 invoke_calculateBaseFee(ReadView const& view, STTx const& tx)
289 {
290  switch (tx.getTxnType())
291  {
292  case ttACCOUNT_DELETE:
293  return DeleteAccount::calculateBaseFee(view, tx);
294  case ttACCOUNT_SET:
295  return SetAccount::calculateBaseFee(view, tx);
296  case ttCHECK_CANCEL:
297  return CancelCheck::calculateBaseFee(view, tx);
298  case ttCHECK_CASH:
299  return CashCheck::calculateBaseFee(view, tx);
300  case ttCHECK_CREATE:
301  return CreateCheck::calculateBaseFee(view, tx);
302  case ttDEPOSIT_PREAUTH:
303  return DepositPreauth::calculateBaseFee(view, tx);
304  case ttOFFER_CANCEL:
305  return CancelOffer::calculateBaseFee(view, tx);
306  case ttOFFER_CREATE:
307  return CreateOffer::calculateBaseFee(view, tx);
308  case ttESCROW_CREATE:
309  return EscrowCreate::calculateBaseFee(view, tx);
310  case ttESCROW_FINISH:
311  return EscrowFinish::calculateBaseFee(view, tx);
312  case ttESCROW_CANCEL:
313  return EscrowCancel::calculateBaseFee(view, tx);
314  case ttPAYCHAN_CLAIM:
315  return PayChanClaim::calculateBaseFee(view, tx);
316  case ttPAYCHAN_CREATE:
317  return PayChanCreate::calculateBaseFee(view, tx);
318  case ttPAYCHAN_FUND:
319  return PayChanFund::calculateBaseFee(view, tx);
320  case ttPAYMENT:
321  return Payment::calculateBaseFee(view, tx);
322  case ttREGULAR_KEY_SET:
323  return SetRegularKey::calculateBaseFee(view, tx);
324  case ttSIGNER_LIST_SET:
325  return SetSignerList::calculateBaseFee(view, tx);
326  case ttTICKET_CREATE:
327  return CreateTicket::calculateBaseFee(view, tx);
328  case ttTRUST_SET:
329  return SetTrust::calculateBaseFee(view, tx);
330  case ttAMENDMENT:
331  case ttFEE:
332  case ttUNL_MODIFY:
333  return Change::calculateBaseFee(view, tx);
334  case ttNFTOKEN_MINT:
335  return NFTokenMint::calculateBaseFee(view, tx);
336  case ttNFTOKEN_BURN:
337  return NFTokenBurn::calculateBaseFee(view, tx);
339  return NFTokenCreateOffer::calculateBaseFee(view, tx);
341  return NFTokenCancelOffer::calculateBaseFee(view, tx);
343  return NFTokenAcceptOffer::calculateBaseFee(view, tx);
344  case ttCLAWBACK:
345  return Clawback::calculateBaseFee(view, tx);
346  case ttAMM_CREATE:
347  return AMMCreate::calculateBaseFee(view, tx);
348  case ttAMM_DEPOSIT:
349  return AMMDeposit::calculateBaseFee(view, tx);
350  case ttAMM_WITHDRAW:
351  return AMMWithdraw::calculateBaseFee(view, tx);
352  case ttAMM_VOTE:
353  return AMMVote::calculateBaseFee(view, tx);
354  case ttAMM_BID:
355  return AMMBid::calculateBaseFee(view, tx);
356  default:
357  assert(false);
358  return XRPAmount{0};
359  }
360 }
361 
363  : isBlocker_(false)
364  , fee_(beast::zero)
365  , potentialSpend_(beast::zero)
366  , seqProx_(SeqProxy::sequence(0))
367  , sequencesConsumed_(0)
368 {
369  assert(!isTesSuccess(pfresult));
370 }
371 
373  : isBlocker_(false)
374  , fee_(
375  tx[sfFee].native() && !tx[sfFee].negative() ? tx[sfFee].xrp()
376  : beast::zero)
377  , potentialSpend_(beast::zero)
378  , seqProx_(tx.getSeqProxy())
379  , sequencesConsumed_(tx.getSeqProxy().isSeq() ? 1 : 0)
380 {
381 }
382 
384  : TxConsequences(tx)
385 {
386  isBlocker_ = (category == blocker);
387 }
388 
390  : TxConsequences(tx)
391 {
393 }
394 
395 TxConsequences::TxConsequences(STTx const& tx, std::uint32_t sequencesConsumed)
396  : TxConsequences(tx)
397 {
399 }
400 
403 {
404  switch (ctx.tx.getTxnType())
405  {
406  case ttACCOUNT_DELETE: {
407  DeleteAccount p(ctx);
408  return p();
409  }
410  case ttACCOUNT_SET: {
411  SetAccount p(ctx);
412  return p();
413  }
414  case ttCHECK_CANCEL: {
415  CancelCheck p(ctx);
416  return p();
417  }
418  case ttCHECK_CASH: {
419  CashCheck p(ctx);
420  return p();
421  }
422  case ttCHECK_CREATE: {
423  CreateCheck p(ctx);
424  return p();
425  }
426  case ttDEPOSIT_PREAUTH: {
427  DepositPreauth p(ctx);
428  return p();
429  }
430  case ttOFFER_CANCEL: {
431  CancelOffer p(ctx);
432  return p();
433  }
434  case ttOFFER_CREATE: {
435  CreateOffer p(ctx);
436  return p();
437  }
438  case ttESCROW_CREATE: {
439  EscrowCreate p(ctx);
440  return p();
441  }
442  case ttESCROW_FINISH: {
443  EscrowFinish p(ctx);
444  return p();
445  }
446  case ttESCROW_CANCEL: {
447  EscrowCancel p(ctx);
448  return p();
449  }
450  case ttPAYCHAN_CLAIM: {
451  PayChanClaim p(ctx);
452  return p();
453  }
454  case ttPAYCHAN_CREATE: {
455  PayChanCreate p(ctx);
456  return p();
457  }
458  case ttPAYCHAN_FUND: {
459  PayChanFund p(ctx);
460  return p();
461  }
462  case ttPAYMENT: {
463  Payment p(ctx);
464  return p();
465  }
466  case ttREGULAR_KEY_SET: {
467  SetRegularKey p(ctx);
468  return p();
469  }
470  case ttSIGNER_LIST_SET: {
471  SetSignerList p(ctx);
472  return p();
473  }
474  case ttTICKET_CREATE: {
475  CreateTicket p(ctx);
476  return p();
477  }
478  case ttTRUST_SET: {
479  SetTrust p(ctx);
480  return p();
481  }
482  case ttAMENDMENT:
483  case ttFEE:
484  case ttUNL_MODIFY: {
485  Change p(ctx);
486  return p();
487  }
488  case ttNFTOKEN_MINT: {
489  NFTokenMint p(ctx);
490  return p();
491  }
492  case ttNFTOKEN_BURN: {
493  NFTokenBurn p(ctx);
494  return p();
495  }
496  case ttNFTOKEN_CREATE_OFFER: {
497  NFTokenCreateOffer p(ctx);
498  return p();
499  }
500  case ttNFTOKEN_CANCEL_OFFER: {
501  NFTokenCancelOffer p(ctx);
502  return p();
503  }
504  case ttNFTOKEN_ACCEPT_OFFER: {
505  NFTokenAcceptOffer p(ctx);
506  return p();
507  }
508  case ttCLAWBACK: {
509  Clawback p(ctx);
510  return p();
511  }
512  case ttAMM_CREATE: {
513  AMMCreate p(ctx);
514  return p();
515  }
516  case ttAMM_DEPOSIT: {
517  AMMDeposit p(ctx);
518  return p();
519  }
520  case ttAMM_WITHDRAW: {
521  AMMWithdraw p(ctx);
522  return p();
523  }
524  case ttAMM_VOTE: {
525  AMMVote p(ctx);
526  return p();
527  }
528  case ttAMM_BID: {
529  AMMBid p(ctx);
530  return p();
531  }
532  default:
533  assert(false);
534  return {temUNKNOWN, false};
535  }
536 }
537 
538 PreflightResult
540  Application& app,
541  Rules const& rules,
542  STTx const& tx,
543  ApplyFlags flags,
544  beast::Journal j)
545 {
546  PreflightContext const pfctx(app, tx, rules, flags, j);
547  try
548  {
549  return {pfctx, invoke_preflight(pfctx)};
550  }
551  catch (std::exception const& e)
552  {
553  JLOG(j.fatal()) << "apply: " << e.what();
554  return {pfctx, {tefEXCEPTION, TxConsequences{tx}}};
555  }
556 }
557 
558 PreclaimResult
560  PreflightResult const& preflightResult,
561  Application& app,
562  OpenView const& view)
563 {
565  if (preflightResult.rules != view.rules())
566  {
567  auto secondFlight = preflight(
568  app,
569  view.rules(),
570  preflightResult.tx,
571  preflightResult.flags,
572  preflightResult.j);
573  ctx.emplace(
574  app,
575  view,
576  secondFlight.ter,
577  secondFlight.tx,
578  secondFlight.flags,
579  secondFlight.j);
580  }
581  else
582  {
583  ctx.emplace(
584  app,
585  view,
586  preflightResult.ter,
587  preflightResult.tx,
588  preflightResult.flags,
589  preflightResult.j);
590  }
591  try
592  {
593  if (ctx->preflightResult != tesSUCCESS)
594  return {*ctx, ctx->preflightResult};
595  return {*ctx, invoke_preclaim(*ctx)};
596  }
597  catch (std::exception const& e)
598  {
599  JLOG(ctx->j.fatal()) << "apply: " << e.what();
600  return {*ctx, tefEXCEPTION};
601  }
602 }
603 
604 XRPAmount
605 calculateBaseFee(ReadView const& view, STTx const& tx)
606 {
607  return invoke_calculateBaseFee(view, tx);
608 }
609 
610 XRPAmount
611 calculateDefaultBaseFee(ReadView const& view, STTx const& tx)
612 {
613  return Transactor::calculateBaseFee(view, tx);
614 }
615 
617 doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
618 {
619  if (preclaimResult.view.seq() != view.seq())
620  {
621  // Logic error from the caller. Don't have enough
622  // info to recover.
623  return {tefEXCEPTION, false};
624  }
625  try
626  {
627  if (!preclaimResult.likelyToClaimFee)
628  return {preclaimResult.ter, false};
629  ApplyContext ctx(
630  app,
631  view,
632  preclaimResult.tx,
633  preclaimResult.ter,
634  calculateBaseFee(view, preclaimResult.tx),
635  preclaimResult.flags,
636  preclaimResult.j);
637  return invoke_apply(ctx);
638  }
639  catch (std::exception const& e)
640  {
641  JLOG(preclaimResult.j.fatal()) << "apply: " << e.what();
642  return {tefEXCEPTION, false};
643  }
644 }
645 
646 } // namespace ripple
ripple::AMMDeposit
AMMDeposit implements AMM deposit Transactor.
Definition: AMMDeposit.h:62
beast::Journal::fatal
Stream fatal() const
Definition: Journal.h:339
ripple::STTx::getTxnType
TxType getTxnType() const
Definition: STTx.h:179
ripple::PayChanClaim
Definition: app/tx/impl/PayChan.h:72
ripple::ttNFTOKEN_CREATE_OFFER
@ ttNFTOKEN_CREATE_OFFER
This transaction creates a new offer to buy or sell an NFT.
Definition: TxFormats.h:134
ripple::consequences_helper
TxConsequences consequences_helper(PreflightContext const &ctx)
Definition: applySteps.cpp:64
ripple::Application
Definition: Application.h:116
ripple::PreclaimResult::view
ReadView const & view
From the input - the ledger view.
Definition: applySteps.h:197
ripple::ttACCOUNT_DELETE
@ ttACCOUNT_DELETE
This transaction type deletes an existing account.
Definition: TxFormats.h:122
ripple::PreclaimResult::j
const beast::Journal j
From the input - the journal.
Definition: applySteps.h:203
ripple::NFTokenMint
Definition: NFTokenMint.h:28
ripple::TxConsequences::TxConsequences
TxConsequences(NotTEC pfresult)
Definition: applySteps.cpp:362
ripple::PreclaimContext::view
ReadView const & view
Definition: Transactor.h:56
ripple::AMMCreate::calculateBaseFee
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: AMMCreate.cpp:82
std::exception
STL class.
ripple::PreclaimContext::j
const beast::Journal j
Definition: Transactor.h:60
ripple::ttREGULAR_KEY_SET
@ ttREGULAR_KEY_SET
This transaction type sets or clears an account's "regular key".
Definition: TxFormats.h:74
ripple::ttCLAWBACK
@ ttCLAWBACK
This transaction claws back issued tokens.
Definition: TxFormats.h:143
ripple::isTesSuccess
bool isTesSuccess(TER x)
Definition: TER.h:604
ripple::ttSIGNER_LIST_SET
@ ttSIGNER_LIST_SET
This transaction type modifies the signer list associated with an account.
Definition: TxFormats.h:95
std::pair
ripple::ttESCROW_CANCEL
@ ttESCROW_CANCEL
This transaction type cancels an existing escrow.
Definition: TxFormats.h:71
ripple::Payment
Definition: Payment.h:30
ripple::OpenView
Writable ledger view that accumulates state and tx changes.
Definition: OpenView.h:55
ripple::CreateCheck
Definition: CreateCheck.h:27
ripple::CancelOffer
Definition: CancelOffer.h:30
ripple::ttFEE
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
Definition: TxFormats.h:170
ripple::ApplyFlags
ApplyFlags
Definition: ApplyView.h:29
ripple::ttAMM_DEPOSIT
@ ttAMM_DEPOSIT
This transaction type deposits into an AMM instance.
Definition: TxFormats.h:149
ripple::TxConsequences::Category
Category
Describes how the transaction affects subsequent transactions.
Definition: applySteps.h:50
ripple::ttOFFER_CANCEL
@ ttOFFER_CANCEL
This transaction type cancels existing offers to trade one asset for another.
Definition: TxFormats.h:83
ripple::SetAccount
Definition: SetAccount.h:32
ripple::DepositPreauth
Definition: DepositPreauth.h:27
ripple::EscrowCreate
Definition: Escrow.h:27
ripple::ttPAYCHAN_CREATE
@ ttPAYCHAN_CREATE
This transaction type creates a new unidirectional XRP payment channel.
Definition: TxFormats.h:98
std::optional::emplace
T emplace(T... args)
ripple::invoke_calculateBaseFee
static XRPAmount invoke_calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: applySteps.cpp:288
ripple::AMMCreate
AMMCreate implements Automatic Market Maker(AMM) creation Transactor.
Definition: AMMCreate.h:57
ripple::PreflightResult::tx
STTx const & tx
From the input - the transaction.
Definition: applySteps.h:154
ripple::preflight
PreflightResult preflight(Application &app, Rules const &rules, STTx const &tx, ApplyFlags flags, beast::Journal j)
Gate a transaction based on static information.
Definition: applySteps.cpp:539
ripple::ttNFTOKEN_ACCEPT_OFFER
@ ttNFTOKEN_ACCEPT_OFFER
This transaction accepts an existing offer to buy or sell an existing NFT.
Definition: TxFormats.h:140
ripple::Change::calculateBaseFee
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: Change.h:50
ripple::DeleteAccount
Definition: DeleteAccount.h:29
ripple::ttAMENDMENT
@ ttAMENDMENT
This system-generated transaction type is used to update the status of the various amendments.
Definition: TxFormats.h:164
ripple::PreclaimResult::likelyToClaimFee
const bool likelyToClaimFee
Success flag - whether the transaction is likely to claim a fee.
Definition: applySteps.h:209
ripple::PreclaimResult::ter
const TER ter
Intermediate transaction result.
Definition: applySteps.h:206
ripple::SetSignerList
See the README.md for an overview of the SetSignerList transaction that this class implements.
Definition: SetSignerList.h:42
ripple::ttCHECK_CANCEL
@ ttCHECK_CANCEL
This transaction type cancels an existing check.
Definition: TxFormats.h:113
ripple::ttPAYMENT
@ ttPAYMENT
This transaction type executes a payment.
Definition: TxFormats.h:59
ripple::Transactor::calculateBaseFee
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: Transactor.cpp:162
ripple::ttUNL_MODIFY
@ ttUNL_MODIFY
This system-generated transaction type is used to update the network's negative UNL.
Definition: TxFormats.h:176
ripple::doApply
std::pair< TER, bool > doApply(PreclaimResult const &preclaimResult, Application &app, OpenView &view)
Apply a prechecked transaction to an OpenView.
Definition: applySteps.cpp:617
ripple::ttCHECK_CREATE
@ ttCHECK_CREATE
This transaction type creates a new check.
Definition: TxFormats.h:107
ripple::PreflightResult
Describes the results of the preflight check.
Definition: applySteps.h:150
std::enable_if_t
ripple::ttAMM_CREATE
@ ttAMM_CREATE
This transaction type creates an AMM instance.
Definition: TxFormats.h:146
ripple::TxConsequences::potentialSpend
XRPAmount const & potentialSpend() const
Potential Spend.
Definition: applySteps.h:108
ripple::PreflightResult::rules
const Rules rules
From the input - the rules.
Definition: applySteps.h:156
ripple::ttTRUST_SET
@ ttTRUST_SET
This transaction type modifies a trustline between two accounts.
Definition: TxFormats.h:119
ripple::STObject::getAccountID
AccountID getAccountID(SField const &field) const
Definition: STObject.cpp:589
ripple::TxConsequences::blocker
@ blocker
Affects the ability of subsequent transactions to claim a fee.
Definition: applySteps.h:55
ripple::PreflightResult::ter
const NotTEC ter
Intermediate transaction result.
Definition: applySteps.h:165
ripple::TERSubset< CanCvtToTER >
ripple::Change
Definition: Change.h:32
ripple::ttNFTOKEN_MINT
@ ttNFTOKEN_MINT
This transaction mints a new NFT.
Definition: TxFormats.h:128
ripple::ttESCROW_CREATE
@ ttESCROW_CREATE
This transaction type creates an escrow object.
Definition: TxFormats.h:62
ripple::SetTrust
Definition: SetTrust.h:31
ripple::TER
TERSubset< CanCvtToTER > TER
Definition: TER.h:575
ripple::AMMVote
AMMVote implements AMM vote Transactor.
Definition: AMMVote.h:50
ripple::ttAMM_WITHDRAW
@ ttAMM_WITHDRAW
This transaction type withdraws from an AMM instance.
Definition: TxFormats.h:152
ripple::ttESCROW_FINISH
@ ttESCROW_FINISH
This transaction type completes an existing escrow.
Definition: TxFormats.h:65
ripple::invoke_preflight_helper
std::pair< NotTEC, TxConsequences > invoke_preflight_helper(PreflightContext const &ctx)
Definition: applySteps.cpp:91
ripple::AMMWithdraw
AMMWithdraw implements AMM withdraw Transactor.
Definition: AMMWithdraw.h:65
ripple::STTx
Definition: STTx.h:45
ripple::ApplyContext
State information when applying a tx.
Definition: ApplyContext.h:35
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
ripple::CreateOffer
Transactor specialized for creating offers in the ledger.
Definition: CreateOffer.h:34
std::uint32_t
ripple::temUNKNOWN
@ temUNKNOWN
Definition: TER.h:122
ripple::NFTokenCreateOffer
Definition: NFTokenCreateOffer.h:27
ripple::TxConsequences::isBlocker_
bool isBlocker_
Describes how the transaction affects subsequent transactions.
Definition: applySteps.h:61
ripple::PreclaimContext::tx
STTx const & tx
Definition: Transactor.h:58
ripple::ttNFTOKEN_CANCEL_OFFER
@ ttNFTOKEN_CANCEL_OFFER
This transaction cancels an existing offer to buy or sell an existing NFT.
Definition: TxFormats.h:137
ripple::ttOFFER_CREATE
@ ttOFFER_CREATE
This transaction type creates an offer to trade one asset for another.
Definition: TxFormats.h:80
ripple::invoke_apply
static std::pair< TER, bool > invoke_apply(ApplyContext &ctx)
Definition: applySteps.cpp:402
ripple::PreclaimContext
State information when determining if a tx is likely to claim a fee.
Definition: Transactor.h:52
ripple::calculateDefaultBaseFee
XRPAmount calculateDefaultBaseFee(ReadView const &view, STTx const &tx)
Return the minimum fee that an "ordinary" transaction would pay.
Definition: applySteps.cpp:611
ripple::ttACCOUNT_SET
@ ttACCOUNT_SET
This transaction type adjusts various account settings.
Definition: TxFormats.h:68
ripple::preclaim
PreclaimResult preclaim(PreflightResult const &preflightResult, Application &app, OpenView const &view)
Gate a transaction based on static ledger information.
Definition: applySteps.cpp:559
ripple::CancelCheck
Definition: CancelCheck.h:27
ripple::EscrowCancel
Definition: Escrow.h:72
ripple::TxConsequences::sequencesConsumed
std::uint32_t sequencesConsumed() const
Sequences consumed.
Definition: applySteps.h:122
ripple::ReadView
A view into a ledger.
Definition: ReadView.h:125
ripple::NFTokenCancelOffer
Definition: NFTokenCancelOffer.h:27
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::invoke_preclaim
static TER invoke_preclaim(PreclaimContext const &ctx)
Definition: applySteps.cpp:180
ripple::SetRegularKey
Definition: SetRegularKey.h:30
ripple::PayChanFund
Definition: app/tx/impl/PayChan.h:51
ripple::ReadView::seq
LedgerIndex seq() const
Returns the sequence number of the base ledger.
Definition: ReadView.h:193
ripple::ttDEPOSIT_PREAUTH
@ ttDEPOSIT_PREAUTH
This transaction type grants or revokes authorization to transfer funds.
Definition: TxFormats.h:116
ripple::Clawback
Definition: Clawback.h:27
ripple::ttCHECK_CASH
@ ttCHECK_CASH
This transaction type cashes an existing check.
Definition: TxFormats.h:110
ripple::PreclaimResult
Describes the results of the preclaim check.
Definition: applySteps.h:193
ripple::ttPAYCHAN_FUND
@ ttPAYCHAN_FUND
This transaction type funds an existing unidirectional XRP payment channel.
Definition: TxFormats.h:101
ripple::SeqProxy
A type that represents either a sequence value or a ticket value.
Definition: SeqProxy.h:55
ripple::TxConsequences::potentialSpend_
XRPAmount potentialSpend_
Does NOT include the fee.
Definition: applySteps.h:65
ripple::ttAMM_VOTE
@ ttAMM_VOTE
This transaction type votes for the trading fee.
Definition: TxFormats.h:155
ripple::ttPAYCHAN_CLAIM
@ ttPAYCHAN_CLAIM
This transaction type submits a claim against an existing unidirectional payment channel.
Definition: TxFormats.h:104
ripple::Rules
Rules controlling protocol behavior.
Definition: Rules.h:33
ripple::calculateBaseFee
XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Compute only the expected base fee for a transaction.
Definition: applySteps.cpp:605
std::optional
ripple::ttNFTOKEN_BURN
@ ttNFTOKEN_BURN
This transaction burns (i.e.
Definition: TxFormats.h:131
ripple::PreclaimResult::flags
const ApplyFlags flags
From the input - the flags.
Definition: applySteps.h:201
ripple::sfFee
const SF_AMOUNT sfFee
ripple::sfAccount
const SF_ACCOUNT sfAccount
ripple::PreflightResult::flags
const ApplyFlags flags
From the input - the flags.
Definition: applySteps.h:160
ripple::CreateTicket
Definition: CreateTicket.h:30
ripple::TxConsequences::sequencesConsumed_
std::uint32_t sequencesConsumed_
Number of sequences consumed.
Definition: applySteps.h:69
ripple::EscrowFinish::calculateBaseFee
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: Escrow.cpp:354
ripple::tefEXCEPTION
@ tefEXCEPTION
Definition: TER.h:156
ripple::PreflightContext::tx
STTx const & tx
Definition: Transactor.h:35
ripple::PreflightContext
State information when preflighting a tx.
Definition: Transactor.h:31
ripple::AMMBid
AMMBid implements AMM bid Transactor.
Definition: AMMBid.h:65
ripple::CashCheck
Definition: CashCheck.h:27
ripple::PayChanCreate
Definition: app/tx/impl/PayChan.h:27
ripple::NFTokenBurn
Definition: NFTokenBurn.h:27
ripple::TxConsequences
Class describing the consequences to the account of applying a transaction if the transaction consume...
Definition: applySteps.h:45
ripple::SetRegularKey::calculateBaseFee
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: SetRegularKey.cpp:28
ripple::EscrowFinish
Definition: Escrow.h:51
ripple::DeleteAccount::calculateBaseFee
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Definition: DeleteAccount.cpp:56
ripple::tesSUCCESS
@ tesSUCCESS
Definition: TER.h:225
ripple::OpenView::rules
Rules const & rules() const override
Returns the tx processing rules.
Definition: OpenView.cpp:152
ripple::invoke_preflight
static std::pair< NotTEC, TxConsequences > invoke_preflight(PreflightContext const &ctx)
Definition: applySteps.cpp:100
ripple::ApplyContext::tx
STTx const & tx
Definition: ApplyContext.h:48
ripple::ttTICKET_CREATE
@ ttTICKET_CREATE
This transaction type creates a new set of tickets.
Definition: TxFormats.h:89
std::exception::what
T what(T... args)
ripple::PreclaimResult::tx
STTx const & tx
From the input - the transaction.
Definition: applySteps.h:199
ripple::XRPAmount
Definition: XRPAmount.h:46
ripple::ttAMM_BID
@ ttAMM_BID
This transaction type bids for the auction slot.
Definition: TxFormats.h:158
ripple::NFTokenAcceptOffer
Definition: NFTokenAcceptOffer.h:27
ripple::PreflightResult::j
const beast::Journal j
From the input - the journal.
Definition: applySteps.h:162
beast
Definition: base_uint.h:641