fix issues

This commit is contained in:
Mayukha Vadari
2026-03-23 12:46:42 -07:00
parent b0c8404d35
commit 4a5ad8925c
6 changed files with 14 additions and 35 deletions

View File

@@ -78,7 +78,7 @@ public:
WritableMPToken mptoken(issuance, account);
auto const ownerNode = mptoken.applyView().dirInsert(
keylet::ownerDir(account), mptoken.key(), describeOwnerDir(account));
keylet::ownerDir(account), mptoken->key(), describeOwnerDir(account));
if (!ownerNode)
return tecDIR_FULL; // LCOV_EXCL_LINE

View File

@@ -90,17 +90,13 @@ public:
return writableIOUToken_;
}
static Expected<std::unique_ptr<WritableRippleState>, TER>
createHolding(
ApplyView& view,
WritableIOUToken& token,
AccountID const& accountID,
beast::Journal journal)
static Expected<WritableRippleState, TER>
makeNew(WritableIOUToken& token, AccountID const& accountID, beast::Journal journal)
{
auto const ter = token.addEmptyHolding(accountID, XRPAmount{0}, journal);
if (ter != tesSUCCESS)
return Unexpected(ter);
return std::make_unique<WritableRippleState>(view, token, accountID);
return WritableRippleState{token.applyView(), token, accountID};
}
//--------------------------------------------------------------------------

View File

@@ -20,16 +20,6 @@ public:
{
}
/** Constructor with explicit keylet (for when SLE lookup is needed) */
TokenHolderBase(
ReadView const& view,
Keylet const& key,
TokenBase const& token,
AccountID const& holder)
: ReadOnlySLE(key, view), token_(token), holder_(holder), holderAccount_(holder, view)
{
}
TokenHolderBase() = delete;
AccountID const&
@@ -128,20 +118,6 @@ public:
{
}
/** Constructor with explicit keylet (for creation or lookup by key) */
WritableTokenHolderBase(
ApplyView& view,
Keylet const& key,
WritableTokenBase& token,
AccountID const& holder)
: ReadOnlySLE(key, view)
, TokenHolderBase(view, key, token, holder)
, WritableSLE(key, view)
, writableToken_(token)
, writableHolderAccount_(holder, view)
{
}
WritableTokenBase&
getWritableToken()
{

View File

@@ -342,7 +342,7 @@ updateMPToken(WritableMPToken& mpt, STTx const& tx)
if (txFlags & tfMPTLock)
{
mpt->setFlag(flagsIn & lsfMPTLocked);
mpt->setFlag(flagsIn | lsfMPTLocked);
}
else if (txFlags & tfMPTUnlock)
{

View File

@@ -80,8 +80,11 @@ VaultDeposit::preclaim(PreclaimContext const& ctx)
}
// Cannot deposit inside Vault an Asset frozen for the depositor
if (token->isFrozen(account))
return vaultAsset.holds<Issue>() ? tecFROZEN : tecLOCKED;
if (auto const ret = token->checkFrozen(account))
return ret;
// Cannot deposit if the vault account's asset holding is frozen/locked
if (token->isFrozen(vaultAccount))
return tecLOCKED;
// Cannot deposit if the shares of the vault are frozen
if (shareIssuance.isFrozen(account))

View File

@@ -82,6 +82,10 @@ VaultWithdraw::preclaim(PreclaimContext const& ctx)
if (auto const ret = vaultAssetToken->checkFrozen(dstAcct))
return ret;
// Cannot withdraw if the vault account's asset holding is frozen/locked
if (vaultAssetToken->isFrozen(vaultAccount))
return tecLOCKED;
// Cannot return shares to the vault, if the underlying asset was frozen for
// the submitter
if (auto const ret = MPTokenIssuance(ctx.view, vaultShare).checkFrozen(account))