1#include <xrpld/app/tx/detail/MPTokenIssuanceCreate.h>
3#include <xrpl/ledger/View.h>
4#include <xrpl/protocol/Feature.h>
5#include <xrpl/protocol/TxFlags.h>
36 if (
auto const mutableFlags = ctx.
tx[~sfMutableFlags]; mutableFlags &&
40 if (
auto const fee = ctx.
tx[~sfTransferFee])
51 if (
auto const domain = ctx.
tx[~sfDomainID])
53 if (*domain == beast::zero)
61 if (
auto const metadata = ctx.
tx[~sfMPTokenMetadata])
63 if (metadata->length() == 0 ||
69 if (
auto const maxAmt = ctx.
tx[~sfMaximumAmount])
109 (*mptIssuance)[sfFlags] = args.
flags & ~tfUniversal;
110 (*mptIssuance)[sfIssuer] = args.
account;
111 (*mptIssuance)[sfOutstandingAmount] = 0;
112 (*mptIssuance)[sfOwnerNode] = *ownerNode;
113 (*mptIssuance)[sfSequence] = args.
sequence;
116 (*mptIssuance)[sfMaximumAmount] = *args.
maxAmount;
119 (*mptIssuance)[sfAssetScale] = *args.
assetScale;
125 (*mptIssuance)[sfMPTokenMetadata] = *args.
metadata;
128 (*mptIssuance)[sfDomainID] = *args.
domainId;
146 auto const result =
create(
152 .sequence = tx.getSeqValue(),
153 .flags = tx.getFlags(),
154 .maxAmount = tx[~sfMaximumAmount],
155 .assetScale = tx[~sfAssetScale],
156 .transferFee = tx[~sfTransferFee],
157 .metadata = tx[~sfMPTokenMetadata],
158 .domainId = tx[~sfDomainID],
159 .mutableFlags = tx[~sfMutableFlags],
A generic endpoint for log messages.
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.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
static bool checkExtraFeatures(PreflightContext const &ctx)
static Expected< MPTID, TER > create(ApplyView &view, beast::Journal journal, MPTCreateArgs const &args)
static NotTEC preflight(PreflightContext const &ctx)
static std::uint32_t getFlagsMask(PreflightContext const &ctx)
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
bool isFlag(std::uint32_t) const
bool isFieldPresent(SField const &field) const
std::uint32_t getFlags() const
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 tfMPTCanTransfer
std::uint64_t constexpr maxMPTokenAmount
The maximum amount of MPTokenIssuance.
constexpr std::uint32_t const tfMPTokenIssuanceCreateMask
std::uint16_t constexpr maxTransferFee
The maximum token transfer fee allowed.
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
constexpr std::uint32_t const tmfMPTokenIssuanceCreateMutableMask
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
std::size_t constexpr maxMPTokenMetadataLength
The maximum length of MPTokenMetadata.
@ tecINSUFFICIENT_RESERVE
MPTID makeMptID(std::uint32_t sequence, AccountID const &account)
constexpr std::uint32_t const tfMPTRequireAuth
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
std::optional< std::uint16_t > transferFee
std::optional< XRPAmount > priorBalance
std::optional< std::uint32_t > mutableFlags
std::optional< std::uint8_t > assetScale
AccountID const & account
std::optional< uint256 > domainId
std::optional< std::uint64_t > maxAmount
std::optional< Slice > const & metadata
State information when preflighting a tx.