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/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 
51 namespace ripple {
52 
53 // Templates so preflight does the right thing with T::ConsequencesFactory.
54 //
55 // This could be done more easily using if constexpr, but Visual Studio
56 // 2017 doesn't handle if constexpr correctly. So once we're no longer
57 // building with Visual Studio 2017 we can consider replacing the four
58 // templates with a single template function that uses if constexpr.
59 //
60 // For Transactor::Normal
61 template <
62  class T,
64 TxConsequences
66 {
67  return TxConsequences(ctx.tx);
68 };
69 
70 // For Transactor::Blocker
71 template <
72  class T,
74 TxConsequences
75 consequences_helper(PreflightContext const& ctx)
76 {
77  return TxConsequences(ctx.tx, TxConsequences::blocker);
78 };
79 
80 // For Transactor::Custom
81 template <
82  class T,
84 TxConsequences
85 consequences_helper(PreflightContext const& ctx)
86 {
87  return T::makeTxConsequences(ctx);
88 };
89 
90 template <class T>
93 {
94  auto const tec = T::preflight(ctx);
95  return {
96  tec,
97  isTesSuccess(tec) ? consequences_helper<T>(ctx) : TxConsequences{tec}};
98 }
99 
102 {
103  switch (ctx.tx.getTxnType())
104  {
105  case ttACCOUNT_DELETE:
106  return invoke_preflight_helper<DeleteAccount>(ctx);
107  case ttACCOUNT_SET:
108  return invoke_preflight_helper<SetAccount>(ctx);
109  case ttCHECK_CANCEL:
110  return invoke_preflight_helper<CancelCheck>(ctx);
111  case ttCHECK_CASH:
112  return invoke_preflight_helper<CashCheck>(ctx);
113  case ttCHECK_CREATE:
114  return invoke_preflight_helper<CreateCheck>(ctx);
115  case ttDEPOSIT_PREAUTH:
116  return invoke_preflight_helper<DepositPreauth>(ctx);
117  case ttOFFER_CANCEL:
118  return invoke_preflight_helper<CancelOffer>(ctx);
119  case ttOFFER_CREATE:
120  return invoke_preflight_helper<CreateOffer>(ctx);
121  case ttESCROW_CREATE:
122  return invoke_preflight_helper<EscrowCreate>(ctx);
123  case ttESCROW_FINISH:
124  return invoke_preflight_helper<EscrowFinish>(ctx);
125  case ttESCROW_CANCEL:
126  return invoke_preflight_helper<EscrowCancel>(ctx);
127  case ttPAYCHAN_CLAIM:
128  return invoke_preflight_helper<PayChanClaim>(ctx);
129  case ttPAYCHAN_CREATE:
130  return invoke_preflight_helper<PayChanCreate>(ctx);
131  case ttPAYCHAN_FUND:
132  return invoke_preflight_helper<PayChanFund>(ctx);
133  case ttPAYMENT:
134  return invoke_preflight_helper<Payment>(ctx);
135  case ttREGULAR_KEY_SET:
136  return invoke_preflight_helper<SetRegularKey>(ctx);
137  case ttSIGNER_LIST_SET:
138  return invoke_preflight_helper<SetSignerList>(ctx);
139  case ttTICKET_CREATE:
140  return invoke_preflight_helper<CreateTicket>(ctx);
141  case ttTRUST_SET:
142  return invoke_preflight_helper<SetTrust>(ctx);
143  case ttAMENDMENT:
144  case ttFEE:
145  case ttUNL_MODIFY:
146  return invoke_preflight_helper<Change>(ctx);
147  case ttNFTOKEN_MINT:
148  return invoke_preflight_helper<NFTokenMint>(ctx);
149  case ttNFTOKEN_BURN:
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);
157  case ttCLAWBACK:
158  return invoke_preflight_helper<Clawback>(ctx);
159  case ttAMM_CREATE:
160  return invoke_preflight_helper<AMMCreate>(ctx);
161  case ttAMM_DEPOSIT:
162  return invoke_preflight_helper<AMMDeposit>(ctx);
163  case ttAMM_WITHDRAW:
164  return invoke_preflight_helper<AMMWithdraw>(ctx);
165  case ttAMM_VOTE:
166  return invoke_preflight_helper<AMMVote>(ctx);
167  case ttAMM_BID:
168  return invoke_preflight_helper<AMMBid>(ctx);
169  case ttAMM_DELETE:
170  return invoke_preflight_helper<AMMDelete>(ctx);
171  default:
172  assert(false);
174  }
175 }
176 
177 /* invoke_preclaim<T> uses name hiding to accomplish
178  compile-time polymorphism of (presumably) static
179  class functions for Transactor and derived classes.
180 */
181 template <class T>
182 static TER
184 {
185  // If the transactor requires a valid account and the transaction doesn't
186  // list one, preflight will have already a flagged a failure.
187  auto const id = ctx.tx.getAccountID(sfAccount);
188 
189  if (id != beast::zero)
190  {
191  TER result = T::checkSeqProxy(ctx.view, ctx.tx, ctx.j);
192 
193  if (result != tesSUCCESS)
194  return result;
195 
196  result = T::checkPriorTxAndLastLedger(ctx);
197 
198  if (result != tesSUCCESS)
199  return result;
200 
201  result = T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx));
202 
203  if (result != tesSUCCESS)
204  return result;
205 
206  result = T::checkSign(ctx);
207 
208  if (result != tesSUCCESS)
209  return result;
210  }
211 
212  return T::preclaim(ctx);
213 }
214 
215 static TER
216 invoke_preclaim(PreclaimContext const& ctx)
217 {
218  switch (ctx.tx.getTxnType())
219  {
220  case ttACCOUNT_DELETE:
221  return invoke_preclaim<DeleteAccount>(ctx);
222  case ttACCOUNT_SET:
223  return invoke_preclaim<SetAccount>(ctx);
224  case ttCHECK_CANCEL:
225  return invoke_preclaim<CancelCheck>(ctx);
226  case ttCHECK_CASH:
227  return invoke_preclaim<CashCheck>(ctx);
228  case ttCHECK_CREATE:
229  return invoke_preclaim<CreateCheck>(ctx);
230  case ttDEPOSIT_PREAUTH:
231  return invoke_preclaim<DepositPreauth>(ctx);
232  case ttOFFER_CANCEL:
233  return invoke_preclaim<CancelOffer>(ctx);
234  case ttOFFER_CREATE:
235  return invoke_preclaim<CreateOffer>(ctx);
236  case ttESCROW_CREATE:
237  return invoke_preclaim<EscrowCreate>(ctx);
238  case ttESCROW_FINISH:
239  return invoke_preclaim<EscrowFinish>(ctx);
240  case ttESCROW_CANCEL:
241  return invoke_preclaim<EscrowCancel>(ctx);
242  case ttPAYCHAN_CLAIM:
243  return invoke_preclaim<PayChanClaim>(ctx);
244  case ttPAYCHAN_CREATE:
245  return invoke_preclaim<PayChanCreate>(ctx);
246  case ttPAYCHAN_FUND:
247  return invoke_preclaim<PayChanFund>(ctx);
248  case ttPAYMENT:
249  return invoke_preclaim<Payment>(ctx);
250  case ttREGULAR_KEY_SET:
251  return invoke_preclaim<SetRegularKey>(ctx);
252  case ttSIGNER_LIST_SET:
253  return invoke_preclaim<SetSignerList>(ctx);
254  case ttTICKET_CREATE:
255  return invoke_preclaim<CreateTicket>(ctx);
256  case ttTRUST_SET:
257  return invoke_preclaim<SetTrust>(ctx);
258  case ttAMENDMENT:
259  case ttFEE:
260  case ttUNL_MODIFY:
261  return invoke_preclaim<Change>(ctx);
262  case ttNFTOKEN_MINT:
263  return invoke_preclaim<NFTokenMint>(ctx);
264  case ttNFTOKEN_BURN:
265  return invoke_preclaim<NFTokenBurn>(ctx);
267  return invoke_preclaim<NFTokenCreateOffer>(ctx);
269  return invoke_preclaim<NFTokenCancelOffer>(ctx);
271  return invoke_preclaim<NFTokenAcceptOffer>(ctx);
272  case ttCLAWBACK:
273  return invoke_preclaim<Clawback>(ctx);
274  case ttAMM_CREATE:
275  return invoke_preclaim<AMMCreate>(ctx);
276  case ttAMM_DEPOSIT:
277  return invoke_preclaim<AMMDeposit>(ctx);
278  case ttAMM_WITHDRAW:
279  return invoke_preclaim<AMMWithdraw>(ctx);
280  case ttAMM_VOTE:
281  return invoke_preclaim<AMMVote>(ctx);
282  case ttAMM_BID:
283  return invoke_preclaim<AMMBid>(ctx);
284  case ttAMM_DELETE:
285  return invoke_preclaim<AMMDelete>(ctx);
286  default:
287  assert(false);
288  return temUNKNOWN;
289  }
290 }
291 
292 static XRPAmount
293 invoke_calculateBaseFee(ReadView const& view, STTx const& tx)
294 {
295  switch (tx.getTxnType())
296  {
297  case ttACCOUNT_DELETE:
298  return DeleteAccount::calculateBaseFee(view, tx);
299  case ttACCOUNT_SET:
300  return SetAccount::calculateBaseFee(view, tx);
301  case ttCHECK_CANCEL:
302  return CancelCheck::calculateBaseFee(view, tx);
303  case ttCHECK_CASH:
304  return CashCheck::calculateBaseFee(view, tx);
305  case ttCHECK_CREATE:
306  return CreateCheck::calculateBaseFee(view, tx);
307  case ttDEPOSIT_PREAUTH:
308  return DepositPreauth::calculateBaseFee(view, tx);
309  case ttOFFER_CANCEL:
310  return CancelOffer::calculateBaseFee(view, tx);
311  case ttOFFER_CREATE:
312  return CreateOffer::calculateBaseFee(view, tx);
313  case ttESCROW_CREATE:
314  return EscrowCreate::calculateBaseFee(view, tx);
315  case ttESCROW_FINISH:
316  return EscrowFinish::calculateBaseFee(view, tx);
317  case ttESCROW_CANCEL:
318  return EscrowCancel::calculateBaseFee(view, tx);
319  case ttPAYCHAN_CLAIM:
320  return PayChanClaim::calculateBaseFee(view, tx);
321  case ttPAYCHAN_CREATE:
322  return PayChanCreate::calculateBaseFee(view, tx);
323  case ttPAYCHAN_FUND:
324  return PayChanFund::calculateBaseFee(view, tx);
325  case ttPAYMENT:
326  return Payment::calculateBaseFee(view, tx);
327  case ttREGULAR_KEY_SET:
328  return SetRegularKey::calculateBaseFee(view, tx);
329  case ttSIGNER_LIST_SET:
330  return SetSignerList::calculateBaseFee(view, tx);
331  case ttTICKET_CREATE:
332  return CreateTicket::calculateBaseFee(view, tx);
333  case ttTRUST_SET:
334  return SetTrust::calculateBaseFee(view, tx);
335  case ttAMENDMENT:
336  case ttFEE:
337  case ttUNL_MODIFY:
338  return Change::calculateBaseFee(view, tx);
339  case ttNFTOKEN_MINT:
340  return NFTokenMint::calculateBaseFee(view, tx);
341  case ttNFTOKEN_BURN:
342  return NFTokenBurn::calculateBaseFee(view, tx);
344  return NFTokenCreateOffer::calculateBaseFee(view, tx);
346  return NFTokenCancelOffer::calculateBaseFee(view, tx);
348  return NFTokenAcceptOffer::calculateBaseFee(view, tx);
349  case ttCLAWBACK:
350  return Clawback::calculateBaseFee(view, tx);
351  case ttAMM_CREATE:
352  return AMMCreate::calculateBaseFee(view, tx);
353  case ttAMM_DEPOSIT:
354  return AMMDeposit::calculateBaseFee(view, tx);
355  case ttAMM_WITHDRAW:
356  return AMMWithdraw::calculateBaseFee(view, tx);
357  case ttAMM_VOTE:
358  return AMMVote::calculateBaseFee(view, tx);
359  case ttAMM_BID:
360  return AMMBid::calculateBaseFee(view, tx);
361  case ttAMM_DELETE:
362  return AMMDelete::calculateBaseFee(view, tx);
363  default:
364  assert(false);
365  return XRPAmount{0};
366  }
367 }
368 
370  : isBlocker_(false)
371  , fee_(beast::zero)
372  , potentialSpend_(beast::zero)
373  , seqProx_(SeqProxy::sequence(0))
374  , sequencesConsumed_(0)
375 {
376  assert(!isTesSuccess(pfresult));
377 }
378 
380  : isBlocker_(false)
381  , fee_(
382  tx[sfFee].native() && !tx[sfFee].negative() ? tx[sfFee].xrp()
383  : beast::zero)
384  , potentialSpend_(beast::zero)
385  , seqProx_(tx.getSeqProxy())
386  , sequencesConsumed_(tx.getSeqProxy().isSeq() ? 1 : 0)
387 {
388 }
389 
391  : TxConsequences(tx)
392 {
393  isBlocker_ = (category == blocker);
394 }
395 
397  : TxConsequences(tx)
398 {
400 }
401 
402 TxConsequences::TxConsequences(STTx const& tx, std::uint32_t sequencesConsumed)
403  : TxConsequences(tx)
404 {
406 }
407 
410 {
411  switch (ctx.tx.getTxnType())
412  {
413  case ttACCOUNT_DELETE: {
414  DeleteAccount p(ctx);
415  return p();
416  }
417  case ttACCOUNT_SET: {
418  SetAccount p(ctx);
419  return p();
420  }
421  case ttCHECK_CANCEL: {
422  CancelCheck p(ctx);
423  return p();
424  }
425  case ttCHECK_CASH: {
426  CashCheck p(ctx);
427  return p();
428  }
429  case ttCHECK_CREATE: {
430  CreateCheck p(ctx);
431  return p();
432  }
433  case ttDEPOSIT_PREAUTH: {
434  DepositPreauth p(ctx);
435  return p();
436  }
437  case ttOFFER_CANCEL: {
438  CancelOffer p(ctx);
439  return p();
440  }
441  case ttOFFER_CREATE: {
442  CreateOffer p(ctx);
443  return p();
444  }
445  case ttESCROW_CREATE: {
446  EscrowCreate p(ctx);
447  return p();
448  }
449  case ttESCROW_FINISH: {
450  EscrowFinish p(ctx);
451  return p();
452  }
453  case ttESCROW_CANCEL: {
454  EscrowCancel p(ctx);
455  return p();
456  }
457  case ttPAYCHAN_CLAIM: {
458  PayChanClaim p(ctx);
459  return p();
460  }
461  case ttPAYCHAN_CREATE: {
462  PayChanCreate p(ctx);
463  return p();
464  }
465  case ttPAYCHAN_FUND: {
466  PayChanFund p(ctx);
467  return p();
468  }
469  case ttPAYMENT: {
470  Payment p(ctx);
471  return p();
472  }
473  case ttREGULAR_KEY_SET: {
474  SetRegularKey p(ctx);
475  return p();
476  }
477  case ttSIGNER_LIST_SET: {
478  SetSignerList p(ctx);
479  return p();
480  }
481  case ttTICKET_CREATE: {
482  CreateTicket p(ctx);
483  return p();
484  }
485  case ttTRUST_SET: {
486  SetTrust p(ctx);
487  return p();
488  }
489  case ttAMENDMENT:
490  case ttFEE:
491  case ttUNL_MODIFY: {
492  Change p(ctx);
493  return p();
494  }
495  case ttNFTOKEN_MINT: {
496  NFTokenMint p(ctx);
497  return p();
498  }
499  case ttNFTOKEN_BURN: {
500  NFTokenBurn p(ctx);
501  return p();
502  }
503  case ttNFTOKEN_CREATE_OFFER: {
504  NFTokenCreateOffer p(ctx);
505  return p();
506  }
507  case ttNFTOKEN_CANCEL_OFFER: {
508  NFTokenCancelOffer p(ctx);
509  return p();
510  }
511  case ttNFTOKEN_ACCEPT_OFFER: {
512  NFTokenAcceptOffer p(ctx);
513  return p();
514  }
515  case ttCLAWBACK: {
516  Clawback p(ctx);
517  return p();
518  }
519  case ttAMM_CREATE: {
520  AMMCreate p(ctx);
521  return p();
522  }
523  case ttAMM_DEPOSIT: {
524  AMMDeposit p(ctx);
525  return p();
526  }
527  case ttAMM_WITHDRAW: {
528  AMMWithdraw p(ctx);
529  return p();
530  }
531  case ttAMM_VOTE: {
532  AMMVote p(ctx);
533  return p();
534  }
535  case ttAMM_BID: {
536  AMMBid p(ctx);
537  return p();
538  }
539  case ttAMM_DELETE: {
540  AMMDelete p(ctx);
541  return p();
542  }
543  default:
544  assert(false);
545  return {temUNKNOWN, false};
546  }
547 }
548 
549 PreflightResult
551  Application& app,
552  Rules const& rules,
553  STTx const& tx,
554  ApplyFlags flags,
555  beast::Journal j)
556 {
557  PreflightContext const pfctx(app, tx, rules, flags, j);
558  try
559  {
560  return {pfctx, invoke_preflight(pfctx)};
561  }
562  catch (std::exception const& e)
563  {
564  JLOG(j.fatal()) << "apply: " << e.what();
565  return {pfctx, {tefEXCEPTION, TxConsequences{tx}}};
566  }
567 }
568 
569 PreclaimResult
571  PreflightResult const& preflightResult,
572  Application& app,
573  OpenView const& view)
574 {
576  if (preflightResult.rules != view.rules())
577  {
578  auto secondFlight = preflight(
579  app,
580  view.rules(),
581  preflightResult.tx,
582  preflightResult.flags,
583  preflightResult.j);
584  ctx.emplace(
585  app,
586  view,
587  secondFlight.ter,
588  secondFlight.tx,
589  secondFlight.flags,
590  secondFlight.j);
591  }
592  else
593  {
594  ctx.emplace(
595  app,
596  view,
597  preflightResult.ter,
598  preflightResult.tx,
599  preflightResult.flags,
600  preflightResult.j);
601  }
602  try
603  {
604  if (ctx->preflightResult != tesSUCCESS)
605  return {*ctx, ctx->preflightResult};
606  return {*ctx, invoke_preclaim(*ctx)};
607  }
608  catch (std::exception const& e)
609  {
610  JLOG(ctx->j.fatal()) << "apply: " << e.what();
611  return {*ctx, tefEXCEPTION};
612  }
613 }
614 
615 XRPAmount
616 calculateBaseFee(ReadView const& view, STTx const& tx)
617 {
618  return invoke_calculateBaseFee(view, tx);
619 }
620 
621 XRPAmount
622 calculateDefaultBaseFee(ReadView const& view, STTx const& tx)
623 {
624  return Transactor::calculateBaseFee(view, tx);
625 }
626 
628 doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view)
629 {
630  if (preclaimResult.view.seq() != view.seq())
631  {
632  // Logic error from the caller. Don't have enough
633  // info to recover.
634  return {tefEXCEPTION, false};
635  }
636  try
637  {
638  if (!preclaimResult.likelyToClaimFee)
639  return {preclaimResult.ter, false};
640  ApplyContext ctx(
641  app,
642  view,
643  preclaimResult.tx,
644  preclaimResult.ter,
645  calculateBaseFee(view, preclaimResult.tx),
646  preclaimResult.flags,
647  preclaimResult.j);
648  return invoke_apply(ctx);
649  }
650  catch (std::exception const& e)
651  {
652  JLOG(preclaimResult.j.fatal()) << "apply: " << e.what();
653  return {tefEXCEPTION, false};
654  }
655 }
656 
657 } // 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:65
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::ttAMM_DELETE
@ ttAMM_DELETE
This transaction type deletes AMM in the empty state.
Definition: TxFormats.h:161
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:369
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:609
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:173
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:293
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:550
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:167
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:179
ripple::doApply
std::pair< TER, bool > doApply(PreclaimResult const &preclaimResult, Application &app, OpenView &view)
Apply a prechecked transaction to an OpenView.
Definition: applySteps.cpp:628
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:580
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:92
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:409
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:622
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:570
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:54
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:183
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:122
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:616
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::AMMDelete
AMMDelete implements AMM delete transactor.
Definition: AMMDelete.h:33
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:226
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:101
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