1#include <xrpl/tx/transactors/token/MPTokenAuthorize.h>
3#include <xrpl/core/ServiceRegistry.h>
4#include <xrpl/ledger/helpers/AccountRootHelpers.h>
5#include <xrpl/ledger/helpers/MPTokenHelpers.h>
6#include <xrpl/protocol/Feature.h>
7#include <xrpl/protocol/Indexes.h>
8#include <xrpl/protocol/LedgerFormats.h>
9#include <xrpl/protocol/SField.h>
10#include <xrpl/protocol/STLedgerEntry.h>
11#include <xrpl/protocol/STTx.h>
12#include <xrpl/protocol/TER.h>
13#include <xrpl/protocol/TxFlags.h>
14#include <xrpl/protocol/XRPAmount.h>
15#include <xrpl/tx/Transactor.h>
23 return tfMPTokenAuthorizeMask;
29 if (ctx.
tx[sfAccount] == ctx.
tx[~sfHolder])
38 auto const accountID = ctx.
tx[sfAccount];
39 auto const holderID = ctx.
tx[~sfHolder];
64 if ((*sleMpt)[sfMPTAmount] != 0)
66 auto const sleMptIssuance =
74 if ((*sleMpt)[~sfLockedAmount].value_or(0) != 0)
76 auto const sleMptIssuance =
83 if (ctx.
view.
rules().
enabled(featureSingleAssetVault) && sleMpt->isFlag(lsfMPTLocked))
88 auto const sleMptIssuance =
94 (*sleMptIssuance)[~sfConfidentialOutstandingAmount].value_or(0) != 0)
99 if (sleMpt->isFieldPresent(sfConfidentialBalanceInbox) ||
100 sleMpt->isFieldPresent(sfConfidentialBalanceSpending))
109 auto const sleMptIssuance =
115 if (accountID == (*sleMptIssuance)[sfIssuer])
140 if (accountID != (*sleMptIssuance)[sfIssuer])
145 if (!sleMptIssuance->isFlag(lsfMPTRequireAuth))
165 auto const& tx =
ctx_.tx;
169 tx[sfMPTokenIssuanceID],
A generic endpoint for log messages.
void visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override
Inspect a single ledger entry modified by this transaction.
static std::uint32_t getFlagsMask(PreflightContext const &ctx)
static TER preclaim(PreclaimContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
bool finalizeInvariants(STTx const &tx, TER result, XRPAmount fee, ReadView const &view, beast::Journal const &j) override
Check transaction-specific post-conditions after all entries have been visited.
virtual Rules const & rules() const =0
Returns the tx processing rules.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
virtual SLE::const_pointer read(Keylet const &k) const =0
Return the state item associated with a key.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
std::shared_ptr< STLedgerEntry const > const & const_ref
std::shared_ptr< STLedgerEntry const > const_pointer
bool isFlag(std::uint32_t) const
AccountID const accountID_
Keylet mptokenIssuance(std::uint32_t seq, AccountID const &issuer) noexcept
Keylet mptoken(MPTID const &issuanceID, AccountID const &holder) noexcept
Keylet account(AccountID const &id) noexcept
AccountID root.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags=0, std::optional< AccountID > holderID=std::nullopt)
TERSubset< CanCvtToNotTEC > NotTEC
TERSubset< CanCvtToTER > TER
bool isPseudoAccount(SLE::const_pointer sleAcct, std::set< SField const * > const &pseudoFieldFilter={})
Returns true if and only if sleAcct is a pseudo-account or specific pseudo-accounts in pseudoFieldFil...
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.