20#include <xrpld/app/tx/detail/MPTokenAuthorize.h>
21#include <xrpld/ledger/View.h>
23#include <xrpl/protocol/Feature.h>
24#include <xrpl/protocol/TxFlags.h>
25#include <xrpl/protocol/st.h>
41 if (ctx.
tx[sfAccount] == ctx.
tx[~sfHolder])
50 auto const accountID = ctx.
tx[sfAccount];
51 auto const holderID = ctx.
tx[~sfHolder];
76 if ((*sleMpt)[sfMPTAmount] != 0)
78 auto const sleMptIssuance = ctx.
view.
read(
86 if ((*sleMpt)[~sfLockedAmount].value_or(0) != 0)
88 auto const sleMptIssuance = ctx.
view.
read(
103 auto const sleMptIssuance =
109 if (accountID == (*sleMptIssuance)[sfIssuer])
122 auto const sleMptIssuance =
127 std::uint32_t const mptIssuanceFlags = sleMptIssuance->getFieldU32(sfFlags);
136 if (accountID != (*sleMptIssuance)[sfIssuer])
155 MPTID const& mptIssuanceID,
168 (*mptoken)[sfAccount] = account;
169 (*mptoken)[sfMPTokenIssuanceID] = mptIssuanceID;
170 (*mptoken)[sfFlags] = flags;
171 (*mptoken)[sfOwnerNode] = *ownerNode;
185 tx[sfMPTokenIssuanceID],
beast::Journal const journal
Writeable view to a ledger, for applying a transaction.
virtual void insert(std::shared_ptr< SLE > const &sle)=0
Insert a new state SLE.
std::optional< std::uint64_t > dirInsert(Keylet const &directory, uint256 const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
Insert an entry to a directory.
static TER createMPToken(ApplyView &view, MPTID const &mptIssuanceID, AccountID const &account, std::uint32_t const flags)
static NotTEC preflight(PreflightContext const &ctx)
static TER preclaim(PreclaimContext const &ctx)
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
virtual Rules const & rules() const =0
Returns the tx processing rules.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
std::uint32_t getFlags() const
Keylet mptoken(MPTID const &issuanceID, AccountID const &holder) noexcept
Keylet mptIssuance(std::uint32_t seq, AccountID const &issuer) noexcept
Keylet account(AccountID const &id) noexcept
AccountID root.
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr std::uint32_t const tfMPTokenAuthorizeMask
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags, std::optional< AccountID > holderID)
constexpr std::uint32_t const tfMPTUnauthorize
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
bool isTesSuccess(TER x) noexcept
TERSubset< CanCvtToNotTEC > NotTEC
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.