20#include <xrpld/app/tx/detail/NFTokenMint.h> 
   22#include <xrpl/basics/Expected.h> 
   23#include <xrpl/ledger/View.h> 
   24#include <xrpl/protocol/Feature.h> 
   25#include <xrpl/protocol/InnerObjectFormats.h> 
   26#include <xrpl/protocol/Rate.h> 
   27#include <xrpl/protocol/TxFlags.h> 
   29#include <boost/endian/conversion.hpp> 
   80    return nfTokenMintMask;
 
 
   86    if (
auto const f = ctx.
tx[~sfTransferFee])
 
   98    if (
auto iss = ctx.
tx[~sfIssuer]; iss == ctx.
tx[sfAccount])
 
  101    if (
auto uri = ctx.
tx[~sfURI])
 
  120                ctx.
tx[~sfDestination],
 
  121                ctx.
tx[~sfExpiration],
 
 
  149    flags = boost::endian::native_to_big(flags);
 
  150    fee = boost::endian::native_to_big(fee);
 
  152    tokenSeq = boost::endian::native_to_big(tokenSeq);
 
  156    auto ptr = buf.
data();
 
  161    ptr += 
sizeof(flags);
 
  167    ptr += issuer.
size();
 
  170    ptr += 
sizeof(taxon);
 
  173    ptr += 
sizeof(tokenSeq);
 
  176        "ripple::NFTokenMint::createNFTokenID : data size matches the buffer");
 
 
  186    if (
auto issuer = ctx.
tx[~sfIssuer])
 
  193        if (
auto const minter = (*sle)[~sfNFTokenMinter];
 
  194            minter != ctx.
tx[sfAccount])
 
  210                ctx.
tx[~sfIssuer].value_or(ctx.
tx[sfAccount]),
 
  212                ctx.
tx[~sfDestination],
 
  214                ctx.
tx[~sfTransferFee].value_or(0),
 
 
  248        if (!
root->isFieldPresent(sfFirstNFTokenSequence))
 
  252            root->at(sfFirstNFTokenSequence) =
 
  260            (*root)[~sfMintedNFTokens].value_or(0u);
 
  262        (*root)[sfMintedNFTokens] = mintedNftCnt + 1u;
 
  263        if ((*
root)[sfMintedNFTokens] == 0u)
 
  268        std::uint32_t const offset = (*root)[sfFirstNFTokenSequence];
 
  272        if (tokenSeq + 1u == 0u || tokenSeq < offset)
 
  279    if (!tokenSeq.has_value())
 
  280        return (tokenSeq.error());
 
  289    if (nfTokenTemplate == 
nullptr)
 
  295        ctx_.
tx[~sfTransferFee].value_or(0),
 
  301        *nfTokenTemplate, sfNFToken, [
this, &nftokenID](
STObject& 
object) {
 
  302            object.setFieldH256(sfNFTokenID, nftokenID);
 
  304            if (
auto const uri = 
ctx_.
tx[~sfURI])
 
  305                object.setFieldVL(sfURI, *uri);
 
  336    if (
auto const ownerCountAfter =
 
  338        ownerCountAfter > ownerCountBefore)
 
 
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
 
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
 
static NotTEC preflight(PreflightContext const &ctx)
 
static bool checkExtraFeatures(PreflightContext const &ctx)
 
static std::uint32_t getFlagsMask(PreflightContext const &ctx)
 
static uint256 createNFTokenID(std::uint16_t flags, std::uint16_t fee, AccountID const &issuer, nft::Taxon taxon, std::uint32_t tokenSeq)
 
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 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.
 
Defines the fields and their attributes within a STObject.
 
bool isFlag(std::uint32_t) const
 
bool isFieldPresent(SField const &field) const
 
std::uint32_t getFlags() const
 
SeqProxy getSeqProxy() const
 
constexpr bool isTicket() const
 
static base_uint fromVoid(void const *data)
 
static constexpr std::size_t size()
 
A type-safe wrap around standard integral types.
 
Keylet account(AccountID const &id) noexcept
AccountID root.
 
std::uint32_t toUInt32(Taxon t)
 
NotTEC tokenOfferCreatePreflight(AccountID const &acctID, STAmount const &amount, std::optional< AccountID > const &dest, std::optional< std::uint32_t > const &expiration, std::uint16_t nftFlags, Rules const &rules, std::optional< AccountID > const &owner, std::uint32_t txFlags)
Preflight checks shared by NFTokenCreateOffer and NFTokenMint.
 
TER tokenOfferCreateApply(ApplyView &view, AccountID const &acctID, STAmount const &amount, std::optional< AccountID > const &dest, std::optional< std::uint32_t > const &expiration, SeqProxy seqProxy, uint256 const &nftokenID, XRPAmount const &priorBalance, beast::Journal j, std::uint32_t txFlags)
doApply implementation shared by NFTokenCreateOffer and NFTokenMint
 
Taxon cipheredTaxon(std::uint32_t tokenSeq, Taxon taxon)
 
TER tokenOfferCreatePreclaim(ReadView const &view, AccountID const &acctID, AccountID const &nftIssuer, STAmount const &amount, std::optional< AccountID > const &dest, std::uint16_t nftFlags, std::uint16_t xferFee, beast::Journal j, std::optional< AccountID > const &owner, std::uint32_t txFlags)
Preclaim checks shared by NFTokenCreateOffer and NFTokenMint.
 
TER insertToken(ApplyView &view, AccountID owner, STObject &&nft)
Insert the token in the owner's token directory.
 
Taxon toTaxon(std::uint32_t i)
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
static bool hasOfferFields(PreflightContext const &ctx)
 
constexpr std::uint32_t const tfNFTokenMintOldMaskWithMutable
 
constexpr std::uint32_t const tfNFTokenMintMaskWithMutable
 
constexpr std::uint32_t const tfNFTokenMintOldMask
 
std::uint16_t constexpr maxTransferFee
The maximum token transfer fee allowed.
 
bool hasExpired(ReadView const &view, std::optional< std::uint32_t > const &exp)
Determines whether the given expiration time has passed.
 
std::size_t constexpr maxTokenURILength
The maximum length of a URI inside an NFT.
 
@ tecMAX_SEQUENCE_REACHED
 
@ tecINSUFFICIENT_RESERVE
 
bool isTesSuccess(TER x) noexcept
 
Number root(Number f, unsigned d)
 
static std::uint16_t extractNFTokenFlagsFromTxFlags(std::uint32_t txFlags)
 
constexpr std::uint32_t const tfTransferable
 
constexpr std::uint32_t const tfNFTokenMintMask
 
@ temBAD_NFTOKEN_TRANSFER_FEE
 
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
 
State information when determining if a tx is likely to claim a fee.
 
State information when preflighting a tx.