mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Checks (RIPD-1487):
Introduce a new ledger type: ltCHECK Introduce three new transactions that operate on checks: - "CheckCreate" which adds the check entry to the ledger. The check is a promise from the source of the check that the destination of the check may cash the check and receive up to the SendMax specified on the check. The check may have an expiration, after which the check may no longer be cashed. - "CheckCash" is a request by the destination of the check to transfer a requested amount of funds, up to the check's SendMax, from the source to the destination. The destination may receive less than the SendMax due to transfer fees. When cashing a check, the destination specifies the smallest amount of funds that will be acceptable. If the transfer completes and delivers the requested amount, then the check is considered cashed and removed from the ledger. If enough funds cannot be delivered, then the transaction fails and the check remains in the ledger. Attempting to cash the check after its expiration will fail. - "CheckCancel" removes the check from the ledger without transferring funds. Either the check's source or destination can cancel the check at any time. After a check has expired, any account can cancel the check. Facilities related to checks are on the "Checks" amendment.
This commit is contained in:
@@ -20,9 +20,12 @@
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/tx/applySteps.h>
|
||||
#include <ripple/app/tx/impl/ApplyContext.h>
|
||||
#include <ripple/app/tx/impl/CancelCheck.h>
|
||||
#include <ripple/app/tx/impl/CancelOffer.h>
|
||||
#include <ripple/app/tx/impl/CancelTicket.h>
|
||||
#include <ripple/app/tx/impl/CashCheck.h>
|
||||
#include <ripple/app/tx/impl/Change.h>
|
||||
#include <ripple/app/tx/impl/CreateCheck.h>
|
||||
#include <ripple/app/tx/impl/CreateOffer.h>
|
||||
#include <ripple/app/tx/impl/CreateTicket.h>
|
||||
#include <ripple/app/tx/impl/Escrow.h>
|
||||
@@ -42,12 +45,18 @@ invoke_preflight (PreflightContext const& ctx)
|
||||
switch(ctx.tx.getTxnType())
|
||||
{
|
||||
case ttACCOUNT_SET: return SetAccount ::preflight(ctx);
|
||||
case ttCHECK_CANCEL: return CancelCheck ::preflight(ctx);
|
||||
case ttCHECK_CASH: return CashCheck ::preflight(ctx);
|
||||
case ttCHECK_CREATE: return CreateCheck ::preflight(ctx);
|
||||
case ttOFFER_CANCEL: return CancelOffer ::preflight(ctx);
|
||||
case ttOFFER_CREATE: return CreateOffer ::preflight(ctx);
|
||||
case ttPAYMENT: return Payment ::preflight(ctx);
|
||||
case ttESCROW_CREATE: return EscrowCreate ::preflight(ctx);
|
||||
case ttESCROW_FINISH: return EscrowFinish ::preflight(ctx);
|
||||
case ttESCROW_CANCEL: return EscrowCancel ::preflight(ctx);
|
||||
case ttPAYCHAN_CLAIM: return PayChanClaim ::preflight(ctx);
|
||||
case ttPAYCHAN_CREATE: return PayChanCreate ::preflight(ctx);
|
||||
case ttPAYCHAN_FUND: return PayChanFund ::preflight(ctx);
|
||||
case ttPAYMENT: return Payment ::preflight(ctx);
|
||||
case ttREGULAR_KEY_SET: return SetRegularKey ::preflight(ctx);
|
||||
case ttSIGNER_LIST_SET: return SetSignerList ::preflight(ctx);
|
||||
case ttTICKET_CANCEL: return CancelTicket ::preflight(ctx);
|
||||
@@ -55,9 +64,6 @@ invoke_preflight (PreflightContext const& ctx)
|
||||
case ttTRUST_SET: return SetTrust ::preflight(ctx);
|
||||
case ttAMENDMENT:
|
||||
case ttFEE: return Change ::preflight(ctx);
|
||||
case ttPAYCHAN_CREATE: return PayChanCreate ::preflight(ctx);
|
||||
case ttPAYCHAN_FUND: return PayChanFund ::preflight(ctx);
|
||||
case ttPAYCHAN_CLAIM: return PayChanClaim ::preflight(ctx);
|
||||
default:
|
||||
assert(false);
|
||||
return temUNKNOWN;
|
||||
@@ -107,12 +113,18 @@ invoke_preclaim (PreclaimContext const& ctx)
|
||||
switch(ctx.tx.getTxnType())
|
||||
{
|
||||
case ttACCOUNT_SET: return invoke_preclaim<SetAccount>(ctx);
|
||||
case ttCHECK_CANCEL: return invoke_preclaim<CancelCheck>(ctx);
|
||||
case ttCHECK_CASH: return invoke_preclaim<CashCheck>(ctx);
|
||||
case ttCHECK_CREATE: return invoke_preclaim<CreateCheck>(ctx);
|
||||
case ttOFFER_CANCEL: return invoke_preclaim<CancelOffer>(ctx);
|
||||
case ttOFFER_CREATE: return invoke_preclaim<CreateOffer>(ctx);
|
||||
case ttPAYMENT: return invoke_preclaim<Payment>(ctx);
|
||||
case ttESCROW_CREATE: return invoke_preclaim<EscrowCreate>(ctx);
|
||||
case ttESCROW_FINISH: return invoke_preclaim<EscrowFinish>(ctx);
|
||||
case ttESCROW_CANCEL: return invoke_preclaim<EscrowCancel>(ctx);
|
||||
case ttPAYCHAN_CLAIM: return invoke_preclaim<PayChanClaim>(ctx);
|
||||
case ttPAYCHAN_CREATE: return invoke_preclaim<PayChanCreate>(ctx);
|
||||
case ttPAYCHAN_FUND: return invoke_preclaim<PayChanFund>(ctx);
|
||||
case ttPAYMENT: return invoke_preclaim<Payment>(ctx);
|
||||
case ttREGULAR_KEY_SET: return invoke_preclaim<SetRegularKey>(ctx);
|
||||
case ttSIGNER_LIST_SET: return invoke_preclaim<SetSignerList>(ctx);
|
||||
case ttTICKET_CANCEL: return invoke_preclaim<CancelTicket>(ctx);
|
||||
@@ -120,9 +132,6 @@ invoke_preclaim (PreclaimContext const& ctx)
|
||||
case ttTRUST_SET: return invoke_preclaim<SetTrust>(ctx);
|
||||
case ttAMENDMENT:
|
||||
case ttFEE: return invoke_preclaim<Change>(ctx);
|
||||
case ttPAYCHAN_CREATE: return invoke_preclaim<PayChanCreate>(ctx);
|
||||
case ttPAYCHAN_FUND: return invoke_preclaim<PayChanFund>(ctx);
|
||||
case ttPAYCHAN_CLAIM: return invoke_preclaim<PayChanClaim>(ctx);
|
||||
default:
|
||||
assert(false);
|
||||
return { temUNKNOWN, 0 };
|
||||
@@ -136,12 +145,18 @@ invoke_calculateBaseFee(PreclaimContext const& ctx)
|
||||
switch (ctx.tx.getTxnType())
|
||||
{
|
||||
case ttACCOUNT_SET: return SetAccount::calculateBaseFee(ctx);
|
||||
case ttCHECK_CANCEL: return CancelCheck::calculateBaseFee(ctx);
|
||||
case ttCHECK_CASH: return CashCheck::calculateBaseFee(ctx);
|
||||
case ttCHECK_CREATE: return CreateCheck::calculateBaseFee(ctx);
|
||||
case ttOFFER_CANCEL: return CancelOffer::calculateBaseFee(ctx);
|
||||
case ttOFFER_CREATE: return CreateOffer::calculateBaseFee(ctx);
|
||||
case ttPAYMENT: return Payment::calculateBaseFee(ctx);
|
||||
case ttESCROW_CREATE: return EscrowCreate::calculateBaseFee(ctx);
|
||||
case ttESCROW_FINISH: return EscrowFinish::calculateBaseFee(ctx);
|
||||
case ttESCROW_CANCEL: return EscrowCancel::calculateBaseFee(ctx);
|
||||
case ttPAYCHAN_CLAIM: return PayChanClaim::calculateBaseFee(ctx);
|
||||
case ttPAYCHAN_CREATE: return PayChanCreate::calculateBaseFee(ctx);
|
||||
case ttPAYCHAN_FUND: return PayChanFund::calculateBaseFee(ctx);
|
||||
case ttPAYMENT: return Payment::calculateBaseFee(ctx);
|
||||
case ttREGULAR_KEY_SET: return SetRegularKey::calculateBaseFee(ctx);
|
||||
case ttSIGNER_LIST_SET: return SetSignerList::calculateBaseFee(ctx);
|
||||
case ttTICKET_CANCEL: return CancelTicket::calculateBaseFee(ctx);
|
||||
@@ -149,9 +164,6 @@ invoke_calculateBaseFee(PreclaimContext const& ctx)
|
||||
case ttTRUST_SET: return SetTrust::calculateBaseFee(ctx);
|
||||
case ttAMENDMENT:
|
||||
case ttFEE: return Change::calculateBaseFee(ctx);
|
||||
case ttPAYCHAN_CREATE: return PayChanCreate::calculateBaseFee(ctx);
|
||||
case ttPAYCHAN_FUND: return PayChanFund::calculateBaseFee(ctx);
|
||||
case ttPAYCHAN_CLAIM: return PayChanClaim::calculateBaseFee(ctx);
|
||||
default:
|
||||
assert(false);
|
||||
return 0;
|
||||
@@ -178,20 +190,23 @@ invoke_calculateConsequences(STTx const& tx)
|
||||
switch (tx.getTxnType())
|
||||
{
|
||||
case ttACCOUNT_SET: return invoke_calculateConsequences<SetAccount>(tx);
|
||||
case ttCHECK_CANCEL: return invoke_calculateConsequences<CancelCheck>(tx);
|
||||
case ttCHECK_CASH: return invoke_calculateConsequences<CashCheck>(tx);
|
||||
case ttCHECK_CREATE: return invoke_calculateConsequences<CreateCheck>(tx);
|
||||
case ttOFFER_CANCEL: return invoke_calculateConsequences<CancelOffer>(tx);
|
||||
case ttOFFER_CREATE: return invoke_calculateConsequences<CreateOffer>(tx);
|
||||
case ttPAYMENT: return invoke_calculateConsequences<Payment>(tx);
|
||||
case ttESCROW_CREATE: return invoke_calculateConsequences<EscrowCreate>(tx);
|
||||
case ttESCROW_FINISH: return invoke_calculateConsequences<EscrowFinish>(tx);
|
||||
case ttESCROW_CANCEL: return invoke_calculateConsequences<EscrowCancel>(tx);
|
||||
case ttPAYCHAN_CLAIM: return invoke_calculateConsequences<PayChanClaim>(tx);
|
||||
case ttPAYCHAN_CREATE: return invoke_calculateConsequences<PayChanCreate>(tx);
|
||||
case ttPAYCHAN_FUND: return invoke_calculateConsequences<PayChanFund>(tx);
|
||||
case ttPAYMENT: return invoke_calculateConsequences<Payment>(tx);
|
||||
case ttREGULAR_KEY_SET: return invoke_calculateConsequences<SetRegularKey>(tx);
|
||||
case ttSIGNER_LIST_SET: return invoke_calculateConsequences<SetSignerList>(tx);
|
||||
case ttTICKET_CANCEL: return invoke_calculateConsequences<CancelTicket>(tx);
|
||||
case ttTICKET_CREATE: return invoke_calculateConsequences<CreateTicket>(tx);
|
||||
case ttTRUST_SET: return invoke_calculateConsequences<SetTrust>(tx);
|
||||
case ttPAYCHAN_CREATE: return invoke_calculateConsequences<PayChanCreate>(tx);
|
||||
case ttPAYCHAN_FUND: return invoke_calculateConsequences<PayChanFund>(tx);
|
||||
case ttPAYCHAN_CLAIM: return invoke_calculateConsequences<PayChanClaim>(tx);
|
||||
case ttAMENDMENT:
|
||||
case ttFEE:
|
||||
// fall through to default
|
||||
@@ -209,12 +224,18 @@ invoke_apply (ApplyContext& ctx)
|
||||
switch(ctx.tx.getTxnType())
|
||||
{
|
||||
case ttACCOUNT_SET: { SetAccount p(ctx); return p(); }
|
||||
case ttCHECK_CANCEL: { CancelCheck p(ctx); return p(); }
|
||||
case ttCHECK_CASH: { CashCheck p(ctx); return p(); }
|
||||
case ttCHECK_CREATE: { CreateCheck p(ctx); return p(); }
|
||||
case ttOFFER_CANCEL: { CancelOffer p(ctx); return p(); }
|
||||
case ttOFFER_CREATE: { CreateOffer p(ctx); return p(); }
|
||||
case ttPAYMENT: { Payment p(ctx); return p(); }
|
||||
case ttESCROW_CREATE: { EscrowCreate p(ctx); return p(); }
|
||||
case ttESCROW_FINISH: { EscrowFinish p(ctx); return p(); }
|
||||
case ttESCROW_CANCEL: { EscrowCancel p(ctx); return p(); }
|
||||
case ttPAYCHAN_CLAIM: { PayChanClaim p(ctx); return p(); }
|
||||
case ttPAYCHAN_CREATE: { PayChanCreate p(ctx); return p(); }
|
||||
case ttPAYCHAN_FUND: { PayChanFund p(ctx); return p(); }
|
||||
case ttPAYMENT: { Payment p(ctx); return p(); }
|
||||
case ttREGULAR_KEY_SET: { SetRegularKey p(ctx); return p(); }
|
||||
case ttSIGNER_LIST_SET: { SetSignerList p(ctx); return p(); }
|
||||
case ttTICKET_CANCEL: { CancelTicket p(ctx); return p(); }
|
||||
@@ -222,9 +243,6 @@ invoke_apply (ApplyContext& ctx)
|
||||
case ttTRUST_SET: { SetTrust p(ctx); return p(); }
|
||||
case ttAMENDMENT:
|
||||
case ttFEE: { Change p(ctx); return p(); }
|
||||
case ttPAYCHAN_CREATE: { PayChanCreate p(ctx); return p(); }
|
||||
case ttPAYCHAN_FUND: { PayChanFund p(ctx); return p(); }
|
||||
case ttPAYCHAN_CLAIM: { PayChanClaim p(ctx); return p(); }
|
||||
default:
|
||||
assert(false);
|
||||
return { temUNKNOWN, false };
|
||||
|
||||
Reference in New Issue
Block a user