switch to &&

This commit is contained in:
Mayukha Vadari
2026-06-29 18:45:58 -04:00
parent 4395da1f3e
commit 8f470b750d
35 changed files with 93 additions and 102 deletions

View File

@@ -201,7 +201,7 @@ canWithdraw(ReadView const& view, STTx const& tx);
[[nodiscard]] TER
doWithdraw(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& senderAcct,
AccountID const& dstAcct,
AccountID const& sourceAcct,

View File

@@ -17,7 +17,7 @@ namespace xrpl {
template <ValidIssueType T>
TER
escrowUnlockApplyHelper(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
Rate lockedRate,
SLE::ref sleDest,
STAmount const& xrpBalance,
@@ -31,7 +31,7 @@ escrowUnlockApplyHelper(
template <>
inline TER
escrowUnlockApplyHelper<Issue>(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
Rate lockedRate,
SLE::ref sleDest,
STAmount const& xrpBalance,
@@ -58,7 +58,7 @@ escrowUnlockApplyHelper<Issue>(
if (!view.exists(trustLineKey) && createAsset)
{
// Can the account cover the trust line's reserve?
auto const sponsorSle = getTxReserveSponsor(ctx);
auto const sponsorSle = getTxReserveSponsor({.view = ctx.view, .tx = ctx.tx});
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
@@ -168,7 +168,7 @@ escrowUnlockApplyHelper<Issue>(
template <>
inline TER
escrowUnlockApplyHelper<MPTIssue>(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
Rate lockedRate,
SLE::ref sleDest,
STAmount const& xrpBalance,
@@ -188,7 +188,7 @@ escrowUnlockApplyHelper<MPTIssue>(
auto const mptKeylet = keylet::mptoken(issuanceKey.key, receiver);
if (!view.exists(mptKeylet) && createAsset && !receiverIssuer)
{
auto const sponsorSle = getTxReserveSponsor(ctx);
auto const sponsorSle = getTxReserveSponsor({.view = ctx.view, .tx = ctx.tx});
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE

View File

@@ -71,7 +71,7 @@ canAddHolding(ReadView const& view, MPTIssue const& mptIssue);
[[nodiscard]] TER
authorizeMPToken(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
XRPAmount const& priorBalance,
MPTID const& mptIssuanceID,
AccountID const& account,
@@ -102,7 +102,7 @@ requireAuth(
*/
[[nodiscard]] TER
enforceMPTokenAuthorization(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
MPTID const& mptIssuanceID,
AccountID const& account,
XRPAmount const& priorBalance,
@@ -188,7 +188,7 @@ canMPTTradeAndTransfer(
[[nodiscard]] TER
addEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
MPTIssue const& mptIssue,
@@ -196,7 +196,7 @@ addEmptyHolding(
[[nodiscard]] TER
removeEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
MPTIssue const& mptIssue,
beast::Journal journal);

View File

@@ -229,7 +229,7 @@ canTransfer(ReadView const& view, Issue const& issue, AccountID const& from, Acc
/// canAddHolding() in preflight with the same View and Asset
[[nodiscard]] TER
addEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
Issue const& issue,
@@ -237,7 +237,7 @@ addEmptyHolding(
[[nodiscard]] TER
removeEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
Issue const& issue,
beast::Journal journal);

View File

@@ -35,7 +35,7 @@ getTxReserveSponsorAccountID(STTx const& tx)
}
inline std::expected<SLE::pointer, TER>
getTxReserveSponsor(ApplyViewContext& ctx)
getTxReserveSponsor(ApplyViewContext&& ctx)
{
auto const sponsorID = getTxReserveSponsorAccountID(ctx.tx);
if (sponsorID)

View File

@@ -230,7 +230,7 @@ canAddHolding(ReadView const& view, Asset const& asset);
[[nodiscard]] TER
addEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
Asset const& asset,
@@ -238,7 +238,7 @@ addEmptyHolding(
[[nodiscard]] TER
removeEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
Asset const& asset,
beast::Journal journal);

View File

@@ -63,7 +63,7 @@ public:
beast::Journal const& j) override;
static std::expected<MPTID, TER>
create(ApplyViewContext& ctx, beast::Journal journal, MPTCreateArgs const& args);
create(ApplyViewContext&& ctx, beast::Journal journal, MPTCreateArgs const& args);
};
} // namespace xrpl

View File

@@ -432,7 +432,7 @@ canWithdraw(ReadView const& view, STTx const& tx)
TER
doWithdraw(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& senderAcct,
AccountID const& dstAcct,
AccountID const& sourceAcct,
@@ -443,7 +443,8 @@ doWithdraw(
// Create trust line or MPToken for the receiving account
if (dstAcct == senderAcct)
{
if (auto const ter = addEmptyHolding(ctx, senderAcct, priorBalance, amount.asset(), j);
if (auto const ter = addEmptyHolding(
{.view = ctx.view, .tx = ctx.tx}, senderAcct, priorBalance, amount.asset(), j);
!isTesSuccess(ter) && ter != tecDUPLICATE)
return ter;
}
@@ -469,7 +470,7 @@ doWithdraw(
// LCOV_EXCL_STOP
}
auto const sponsorSle = getTxReserveSponsor(ctx);
auto const sponsorSle = getTxReserveSponsor({.view = ctx.view, .tx = ctx.tx});
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE

View File

@@ -125,7 +125,7 @@ canAddHolding(ReadView const& view, MPTIssue const& mptIssue)
[[nodiscard]] TER
addEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
MPTIssue const& mptIssue,
@@ -143,12 +143,13 @@ addEmptyHolding(
if (accountID == mptIssue.getIssuer())
return tesSUCCESS;
return authorizeMPToken(ctx, priorBalance, mptID, accountID, journal);
return authorizeMPToken(
{.view = ctx.view, .tx = ctx.tx}, priorBalance, mptID, accountID, journal);
}
[[nodiscard]] TER
authorizeMPToken(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
XRPAmount const& priorBalance,
MPTID const& mptIssuanceID,
AccountID const& account,
@@ -192,7 +193,7 @@ authorizeMPToken(
// - add the new mptokenKey to the owner directory
// - create the MPToken object for the holder
auto const sponsorSle = getTxReserveSponsor(ctx);
auto const sponsorSle = getTxReserveSponsor({.view = ctx.view, .tx = ctx.tx});
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
@@ -279,7 +280,7 @@ authorizeMPToken(
[[nodiscard]] TER
removeEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
MPTIssue const& mptIssue,
beast::Journal journal)
@@ -302,7 +303,7 @@ removeEmptyHolding(
return tecHAS_OBLIGATIONS;
return authorizeMPToken(
ctx,
{.view = ctx.view, .tx = ctx.tx},
{}, // priorBalance
mptID,
accountID,
@@ -411,7 +412,7 @@ requireAuth(
[[nodiscard]] TER
enforceMPTokenAuthorization(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
MPTID const& mptIssuanceID,
AccountID const& account,
XRPAmount const& priorBalance, // for MPToken authorization
@@ -493,7 +494,7 @@ enforceMPTokenAuthorization(
maybeDomainID.has_value() && sleToken == nullptr,
"xrpl::enforceMPTokenAuthorization : new MPToken for domain");
if (auto const err = authorizeMPToken(
ctx,
{.view = ctx.view, .tx = ctx.tx},
priorBalance, // priorBalance
mptIssuanceID, // mptIssuanceID
account, // account

View File

@@ -633,7 +633,7 @@ canTransfer(ReadView const& view, Issue const& issue, AccountID const& from, Acc
TER
addEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
Issue const& issue,
@@ -666,7 +666,7 @@ addEmptyHolding(
SLE::pointer sponsorSle;
if (!isPseudoAccount(sleDst))
{
auto sle = getTxReserveSponsor(ctx);
auto sle = getTxReserveSponsor({.view = ctx.view, .tx = ctx.tx});
if (!sle)
return sle.error(); // LCOV_EXCL_LINE
sponsorSle = std::move(*sle);
@@ -699,7 +699,7 @@ addEmptyHolding(
TER
removeEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
Issue const& issue,
beast::Journal journal)

View File

@@ -473,7 +473,7 @@ canAddHolding(ReadView const& view, Asset const& asset)
TER
addEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
XRPAmount priorBalance,
Asset const& asset,
@@ -481,14 +481,15 @@ addEmptyHolding(
{
return std::visit(
[&]<ValidIssueType TIss>(TIss const& issue) -> TER {
return addEmptyHolding(ctx, accountID, priorBalance, issue, journal);
return addEmptyHolding(
{.view = ctx.view, .tx = ctx.tx}, accountID, priorBalance, issue, journal);
},
asset.value());
}
TER
removeEmptyHolding(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
AccountID const& accountID,
Asset const& asset,
beast::Journal journal)
@@ -497,11 +498,13 @@ removeEmptyHolding(
[&]<ValidIssueType TIss>(TIss const& issue) -> TER {
if constexpr (std::is_same_v<TIss, Issue>)
{
return removeEmptyHolding(ctx, accountID, issue, journal);
return removeEmptyHolding(
{.view = ctx.view, .tx = ctx.tx}, accountID, issue, journal);
}
else
{
return removeEmptyHolding(ctx, accountID, issue, journal);
return removeEmptyHolding(
{.view = ctx.view, .tx = ctx.tx}, accountID, issue, journal);
}
},
asset.value());

View File

@@ -203,9 +203,7 @@ SponsorshipSet::doApply()
auto const feeAmount = ctx_.tx[~sfFeeAmount];
auto const maxFee = ctx_.tx[~sfMaxFee];
auto const remainingOwnerCount = ctx_.tx[~sfRemainingOwnerCount];
auto applyViewContext = ctx_.getApplyViewContext();
auto reserveSponsorAccSle = getTxReserveSponsor(applyViewContext);
auto reserveSponsorAccSle = getTxReserveSponsor(ctx_.getApplyViewContext());
if (!reserveSponsorAccSle)
return reserveSponsorAccSle.error(); // LCOV_EXCL_LINE

View File

@@ -322,8 +322,7 @@ SignerListSet::replaceSignerList()
// We check the reserve against the starting balance because we want to
// allow dipping into the reserve to pay fees. This behavior is consistent
// with TicketCreate.
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret = checkInsufficientReserve(

View File

@@ -389,8 +389,7 @@ CheckCash::doApply()
STAmount const flowDeliver{
optDeliverMin ? maxDeliverMin() : ctx_.tx.getFieldAmount(sfAmount)};
auto applyViewContext = ApplyViewContext({.view = psb, .tx = ctx_.tx});
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
auto const sponsorSle = getTxReserveSponsor({.view = psb, .tx = ctx_.tx});
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE

View File

@@ -195,8 +195,7 @@ CheckCreate::doApply()
// A check counts against the reserve of the issuing account, but we
// check the starting balance because we want to allow dipping into the
// reserve to pay fees.
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret = checkInsufficientReserve(

View File

@@ -94,9 +94,7 @@ DelegateSet::doApply()
auto const& permissions = ctx_.tx.getFieldArray(sfPermissions);
if (permissions.empty())
return tecINTERNAL; // LCOV_EXCL_LINE
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret = checkInsufficientReserve(

View File

@@ -178,11 +178,10 @@ EscrowCancel::doApply()
auto const issuer = amount.getIssuer();
bool const createAsset = account == accountID_;
auto applyViewContext = ctx_.getApplyViewContext();
if (auto const ret = std::visit(
[&]<typename T>(T const&) {
return escrowUnlockApplyHelper<T>(
applyViewContext,
ctx_.getApplyViewContext(),
kParityRate,
ctx_.view().rules().enabled(fixCleanup3_2_0) ? sle : slep,
preFeeBalance_,

View File

@@ -436,8 +436,7 @@ EscrowCreate::doApply()
STAmount const amount{ctx_.tx[sfAmount]};
auto const balance = sle->getFieldAmount(sfBalance).xrp();
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret =

View File

@@ -362,11 +362,10 @@ EscrowFinish::doApply()
: kParityRate;
auto const issuer = amount.getIssuer();
bool const createAsset = destID == accountID_;
auto applyViewContext = ctx_.getApplyViewContext();
if (auto const ret = std::visit(
[&]<typename T>(T const&) {
return escrowUnlockApplyHelper<T>(
applyViewContext,
ctx_.getApplyViewContext(),
lockedRate,
sled,
preFeeBalance_,

View File

@@ -197,10 +197,14 @@ LoanBrokerCoverWithdraw::doApply()
view().update(broker);
associateAsset(*broker, vaultAsset);
auto applyViewContext = ctx_.getApplyViewContext();
return doWithdraw(
applyViewContext, accountID_, dstAcct, brokerPseudoID, preFeeBalance_, amount, j_);
ctx_.getApplyViewContext(),
accountID_,
dstAcct,
brokerPseudoID,
preFeeBalance_,
amount,
j_);
}
void

View File

@@ -158,9 +158,7 @@ LoanBrokerDelete::doApply()
view(), brokerPseudoID, accountID_, coverAvailable, j_, {}, WaiveTransferFee::Yes))
return ter;
}
auto applyViewContext = ctx_.getApplyViewContext();
if (auto ter = removeEmptyHolding(applyViewContext, brokerPseudoID, vaultAsset, j_))
if (auto ter = removeEmptyHolding(ctx_.getApplyViewContext(), brokerPseudoID, vaultAsset, j_))
return ter;
auto brokerPseudoSLE = view().peek(keylet::account(brokerPseudoID));

View File

@@ -247,10 +247,8 @@ LoanBrokerSet::doApply()
return maybePseudo.error(); // LCOV_EXCL_LINE
auto& pseudo = *maybePseudo;
auto pseudoId = pseudo->at(sfAccount);
auto applyViewContext = ctx_.getApplyViewContext();
if (auto ter = addEmptyHolding(
applyViewContext, pseudoId, preFeeBalance_, sleVault->at(sfAsset), j_))
ctx_.getApplyViewContext(), pseudoId, preFeeBalance_, sleVault->at(sfAsset), j_))
return ter;
// Initialize data fields:

View File

@@ -624,9 +624,8 @@ LoanPay::doApply()
if (brokerPayee == accountID_)
{
// The broker may have deleted their holding. Recreate it if needed
auto applyViewContext = ctx_.getApplyViewContext();
if (auto const ter = addEmptyHolding(
applyViewContext,
ctx_.getApplyViewContext(),
brokerPayee,
brokerPayeeSle->at(sfBalance).value().xrp(),
asset,

View File

@@ -531,9 +531,12 @@ LoanSet::doApply()
borrower == accountID_ || borrower == counterparty,
"xrpl::LoanSet::doApply",
"borrower signed transaction");
auto applyViewContext = ctx_.getApplyViewContext();
if (auto const ter = addEmptyHolding(
applyViewContext, borrower, borrowerSle->at(sfBalance).value().xrp(), vaultAsset, j_);
ctx_.getApplyViewContext(),
borrower,
borrowerSle->at(sfBalance).value().xrp(),
vaultAsset,
j_);
ter && ter != tecDUPLICATE)
{
// ignore tecDUPLICATE. That means the holding already exists, and
@@ -556,7 +559,7 @@ LoanSet::doApply()
"broker owner signed transaction");
if (auto const ter = addEmptyHolding(
applyViewContext,
ctx_.getApplyViewContext(),
brokerOwner,
brokerOwnerSle->at(sfBalance).value().xrp(),
vaultAsset,

View File

@@ -152,7 +152,6 @@ DepositPreauth::preclaim(PreclaimContext const& ctx)
TER
DepositPreauth::doApply()
{
auto applyViewContext = ctx_.getApplyViewContext();
if (ctx_.tx.isFieldPresent(sfAuthorize))
{
auto const sleOwner = view().peek(keylet::account(accountID_));
@@ -162,7 +161,7 @@ DepositPreauth::doApply()
// A preauth counts against the reserve of the issuing account, but we
// check the starting balance because we want to allow dipping into the
// reserve to pay fees.
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret = checkInsufficientReserve(
@@ -210,7 +209,7 @@ DepositPreauth::doApply()
// A preauth counts against the reserve of the issuing account, but we
// check the starting balance because we want to allow dipping into the
// reserve to pay fees.
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret = checkInsufficientReserve(

View File

@@ -203,8 +203,7 @@ PaymentChannelCreate::doApply()
// Deduct owner's balance, increment owner count
(*sle)[sfBalance] = (*sle)[sfBalance] - ctx_.tx[sfAmount];
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
adjustOwnerCount(ctx_.view(), sle, *sponsorSle, 1, ctx_.journal);

View File

@@ -90,8 +90,7 @@ PaymentChannelFund::doApply()
{
// Check reserve and funds availability
auto const balance = (*sle)[sfBalance];
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE
if (auto const ret =

View File

@@ -143,9 +143,8 @@ TER
MPTokenAuthorize::doApply()
{
auto const& tx = ctx_.tx;
auto applyViewContext = ctx_.getApplyViewContext();
return authorizeMPToken(
applyViewContext,
ctx_.getApplyViewContext(),
preFeeBalance_,
tx[sfMPTokenIssuanceID],
accountID_,

View File

@@ -104,7 +104,7 @@ MPTokenIssuanceCreate::preflight(PreflightContext const& ctx)
std::expected<MPTID, TER>
MPTokenIssuanceCreate::create(
ApplyViewContext& ctx,
ApplyViewContext&& ctx,
beast::Journal journal,
MPTCreateArgs const& args)
{
@@ -116,7 +116,7 @@ MPTokenIssuanceCreate::create(
SLE::pointer sponsorSle;
if (!isPseudoAccount(acct))
{
auto sle = getTxReserveSponsor(ctx);
auto sle = getTxReserveSponsor({.view = ctx.view, .tx = ctx.tx});
if (!sle)
return std::unexpected(sle.error());
sponsorSle = std::move(*sle);
@@ -197,9 +197,8 @@ TER
MPTokenIssuanceCreate::doApply()
{
auto const& tx = ctx_.tx;
auto applyViewContext = ctx_.getApplyViewContext();
auto const result = create(
applyViewContext,
ctx_.getApplyViewContext(),
j_,
{
.priorBalance = preFeeBalance_,

View File

@@ -327,9 +327,7 @@ TrustSet::doApply()
// but the incremental reserve for the trust line as
// well. A person with no intention of using the gateway
// could use the extra XRP for their own purposes.
auto applyViewContext = ctx_.getApplyViewContext();
auto const sponsorSle = getTxReserveSponsor(applyViewContext);
auto const sponsorSle = getTxReserveSponsor(ctx_.getApplyViewContext());
if (!sponsorSle)
return sponsorSle.error(); // LCOV_EXCL_LINE

View File

@@ -399,9 +399,8 @@ VaultClawback::doApply()
// Keep MPToken if holder is the vault owner.
if (holder != vault->at(sfOwner))
{
auto applyViewContext = ctx_.getApplyViewContext();
if (auto const ter =
removeEmptyHolding(applyViewContext, holder, sharesDestroyed.asset(), j_);
removeEmptyHolding(ctx_.getApplyViewContext(), holder, sharesDestroyed.asset(), j_);
isTesSuccess(ter))
{
JLOG(j_.debug()) //

View File

@@ -146,7 +146,6 @@ VaultCreate::doApply()
// we can consider downgrading them to `tef` or `tem`.
auto const& tx = ctx_.tx;
auto applyViewContext = ctx_.getApplyViewContext();
auto const sequence = tx.getSeqValue();
auto const owner = view().peek(keylet::account(accountID_));
if (owner == nullptr)
@@ -168,7 +167,7 @@ VaultCreate::doApply()
AccountID const pseudoId = pseudo->at(sfAccount);
auto const asset = tx[sfAsset];
if (auto ter = addEmptyHolding(applyViewContext, pseudoId, preFeeBalance_, asset, j_);
if (auto ter = addEmptyHolding(ctx_.getApplyViewContext(), pseudoId, preFeeBalance_, asset, j_);
!isTesSuccess(ter))
return ter;
@@ -198,7 +197,7 @@ VaultCreate::doApply()
: keylet::line(pseudoId, asset.get<Issue>()).key;
}();
auto const maybeShare = MPTokenIssuanceCreate::create(
applyViewContext,
ctx_.getApplyViewContext(),
j_,
{
.priorBalance = std::nullopt,
@@ -245,7 +244,7 @@ VaultCreate::doApply()
// Explicitly create MPToken for the vault owner
if (auto const err = authorizeMPToken(
applyViewContext, preFeeBalance_, mptIssuanceID, accountID_, ctx_.journal);
ctx_.getApplyViewContext(), preFeeBalance_, mptIssuanceID, accountID_, ctx_.journal);
!isTesSuccess(err))
return err;
@@ -253,7 +252,7 @@ VaultCreate::doApply()
if (tx.isFlag(tfVaultPrivate))
{
if (auto const err = authorizeMPToken(
applyViewContext,
ctx_.getApplyViewContext(),
preFeeBalance_,
mptIssuanceID,
pseudoId,

View File

@@ -88,14 +88,13 @@ TER
VaultDelete::doApply()
{
auto const vault = view().peek(keylet::vault(ctx_.tx[sfVaultID]));
auto applyViewContext = ctx_.getApplyViewContext();
if (!vault)
return tefINTERNAL; // LCOV_EXCL_LINE
// Destroy the asset holding.
auto asset = vault->at(sfAsset);
if (auto ter = removeEmptyHolding(applyViewContext, vault->at(sfAccount), asset, j_);
if (auto ter = removeEmptyHolding(ctx_.getApplyViewContext(), vault->at(sfAccount), asset, j_);
!isTesSuccess(ter))
return ter;
@@ -124,8 +123,8 @@ VaultDelete::doApply()
// Try to remove MPToken for vault shares for the vault owner if it exists.
if (auto const mptoken = view().peek(keylet::mptoken(shareMPTID, accountID_)))
{
if (auto const ter =
removeEmptyHolding(applyViewContext, accountID_, MPTIssue(shareMPTID), j_);
if (auto const ter = removeEmptyHolding(
ctx_.getApplyViewContext(), accountID_, MPTIssue(shareMPTID), j_);
!isTesSuccess(ter))
{
// LCOV_EXCL_START

View File

@@ -187,7 +187,6 @@ VaultDeposit::doApply()
{
bool const fix320Enabled = view().rules().enabled(fixCleanup3_2_0);
auto const vault = view().peek(keylet::vault(ctx_.tx[sfVaultID]));
auto applyViewContext = ctx_.getApplyViewContext();
if (!vault)
return tefINTERNAL; // LCOV_EXCL_LINE
auto const vaultAsset = vault->at(sfAsset);
@@ -222,7 +221,7 @@ VaultDeposit::doApply()
if (vault->isFlag(lsfVaultPrivate) && accountID_ != vault->at(sfOwner))
{
if (auto const err = enforceMPTokenAuthorization(
applyViewContext, mptIssuanceID, accountID_, preFeeBalance_, j_);
ctx_.getApplyViewContext(), mptIssuanceID, accountID_, preFeeBalance_, j_);
!isTesSuccess(err))
return err;
}
@@ -232,7 +231,7 @@ VaultDeposit::doApply()
if (!view().exists(keylet::mptoken(mptIssuanceID, accountID_)))
{
if (auto const err = authorizeMPToken(
applyViewContext,
ctx_.getApplyViewContext(),
preFeeBalance_,
mptIssuanceID->value(),
accountID_,
@@ -248,7 +247,7 @@ VaultDeposit::doApply()
XRPL_ASSERT(
accountID_ == vault->at(sfOwner), "xrpl::VaultDeposit::doApply : account is owner");
if (auto const err = authorizeMPToken(
applyViewContext,
ctx_.getApplyViewContext(),
preFeeBalance_, // priorBalance
mptIssuanceID->value(), // mptIssuanceID
sleIssuance->at(sfIssuer), // account

View File

@@ -176,7 +176,6 @@ TER
VaultWithdraw::doApply()
{
auto const vault = view().peek(keylet::vault(ctx_.tx[sfVaultID]));
auto applyViewContext = ctx_.getApplyViewContext();
if (!vault)
return tefINTERNAL; // LCOV_EXCL_LINE
@@ -338,8 +337,8 @@ VaultWithdraw::doApply()
// Keep MPToken if holder is the vault owner.
if (accountID_ != vault->at(sfOwner))
{
if (auto const ter =
removeEmptyHolding(applyViewContext, accountID_, sharesRedeemed.asset(), j_);
if (auto const ter = removeEmptyHolding(
ctx_.getApplyViewContext(), accountID_, sharesRedeemed.asset(), j_);
isTesSuccess(ter))
{
JLOG(j_.debug()) //
@@ -366,7 +365,13 @@ VaultWithdraw::doApply()
associateAsset(*vault, vaultAsset);
return doWithdraw(
applyViewContext, accountID_, dstAcct, vaultAccount, preFeeBalance_, assetsWithdrawn, j_);
ctx_.getApplyViewContext(),
accountID_,
dstAcct,
vaultAccount,
preFeeBalance_,
assetsWithdrawn,
j_);
}
void