Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ledhed2222 authored and shawnxie999 committed Sep 21, 2023
1 parent ca4f98e commit d331634
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/ripple/app/tx/impl/CFTokenIssuanceCreate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ CFTokenIssuanceCreate::preflight(PreflightContext const& ctx)
TER
CFTokenIssuanceCreate::preclaim(PreclaimContext const& ctx)
{
// if already a CFT with this asset code - error
// if a CFT issuance with this asset code already exists - error
if (ctx.view.exists(
keylet::cftIssuance(ctx.tx[sfAccount], ctx.tx[sfAssetCode])))
return tecDUPLICATE;
Expand All @@ -72,8 +72,11 @@ CFTokenIssuanceCreate::preclaim(PreclaimContext const& ctx)
TER
CFTokenIssuanceCreate::doApply()
{
if (auto const acct = view().read(keylet::account(account_));
mPriorBalance < view().fees().accountReserve((*acct)[sfOwnerCount] + 1))
auto const acct = view().read(keylet::account(account_));
if (!acct)
return tecINTERNAL;

if (mPriorBalance < view().fees().accountReserve((*acct)[sfOwnerCount] + 1))
return tecINSUFFICIENT_RESERVE;

auto const cftID = keylet::cftIssuance(account_, ctx_.tx[sfAssetCode]);
Expand All @@ -87,7 +90,7 @@ CFTokenIssuanceCreate::doApply()
return tecDIR_FULL;

auto cft = std::make_shared<SLE>(cftID);
(*cft)[sfFlags] = ctx_.tx.getFlags();
(*cft)[sfFlags] = ctx_.tx.getFlags() & ~tfUniversalMask;
(*cft)[sfIssuer] = account_;
(*cft)[sfAssetCode] = ctx_.tx[sfAssetCode];
(*cft)[sfOutstandingAmount] = 0;
Expand All @@ -110,7 +113,7 @@ CFTokenIssuanceCreate::doApply()
}

// Update owner count.
adjustOwnerCount(view(), view().peek(keylet::account(account_)), 1, j_);
adjustOwnerCount(view(), *acct, 1, j_);

return tesSUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ripple/protocol/impl/SField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ CONSTRUCT_TYPED_SFIELD(sfCreateCode, "CreateCode", VL,
CONSTRUCT_TYPED_SFIELD(sfMemoType, "MemoType", VL, 12);
CONSTRUCT_TYPED_SFIELD(sfMemoData, "MemoData", VL, 13);
CONSTRUCT_TYPED_SFIELD(sfMemoFormat, "MemoFormat", VL, 14);
CONSTRUCT_TYPED_SFIELD(sfCFTokenMetadata, "CFTokenMetadata", VL, 15);

// variable length (uncommon)
CONSTRUCT_TYPED_SFIELD(sfFulfillment, "Fulfillment", VL, 16);
Expand All @@ -304,6 +303,7 @@ CONSTRUCT_TYPED_SFIELD(sfHookStateData, "HookStateData", VL,
CONSTRUCT_TYPED_SFIELD(sfHookReturnString, "HookReturnString", VL, 23);
CONSTRUCT_TYPED_SFIELD(sfHookParameterName, "HookParameterName", VL, 24);
CONSTRUCT_TYPED_SFIELD(sfHookParameterValue, "HookParameterValue", VL, 25);
CONSTRUCT_TYPED_SFIELD(sfCFTokenMetadata, "CFTokenMetadata", VL, 26);

// account
CONSTRUCT_TYPED_SFIELD(sfAccount, "Account", ACCOUNT, 1);
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/protocol/impl/TxFormats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ TxFormats::TxFormats()
ttCFTOKEN_ISSUANCE_CREATE,
{
{sfAssetCode, soeREQUIRED},
{sfAssetScale, soeDEFAULT},
{sfTransferFee, soeDEFAULT},
{sfAssetScale, soeOPTIONAL},
{sfTransferFee, soeOPTIONAL},
{sfMaximumAmount, soeOPTIONAL},
{sfCFTokenMetadata, soeOPTIONAL},
},
Expand Down

0 comments on commit d331634

Please sign in to comment.