Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make megavault withdrawal logging more succinct #2607

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 4 additions & 37 deletions protocol/x/vault/keeper/withdraw.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func (k Keeper) RedeemFromMainAndSubVaults(

_, perpetual, marketParam, marketPrice, err := k.GetVaultClobPerpAndMarket(ctx, *vaultId)
if err != nil {
if simulate {
if !simulate {
log.DebugLog(
ctx,
"Megavault withdrawal: failed to get perpetual and market. Skipping this vault",
Expand All @@ -299,20 +299,12 @@ func (k Keeper) RedeemFromMainAndSubVaults(
"Error",
err,
)
} else {
log.ErrorLogWithError(
ctx,
"Megavault withdrawal: error when getting perpetual and market. Skipping this vault",
err,
"Vault ID",
vaultId,
)
}
continue
}
leverage, equity, err := k.GetVaultLeverageAndEquity(ctx, *vaultId, &perpetual, &marketPrice)
if err != nil {
if simulate {
if !simulate {
log.DebugLog(
ctx,
"Megavault withdrawal: failed to get vault leverage and equity. Skipping this vault",
Expand All @@ -321,14 +313,6 @@ func (k Keeper) RedeemFromMainAndSubVaults(
"Error",
err,
)
} else {
log.ErrorLogWithError(
ctx,
"Megavault withdrawal: error when getting vault leverage and equity. Skipping this vault",
err,
"Vault ID",
vaultId,
)
}
continue
}
Expand All @@ -343,7 +327,7 @@ func (k Keeper) RedeemFromMainAndSubVaults(
&marketParam,
)
if err != nil {
if simulate {
if !simulate {
log.DebugLog(
ctx,
"Megavault withdrawal: failed to get vault withdrawal slippage. Skipping this vault",
Expand All @@ -352,14 +336,6 @@ func (k Keeper) RedeemFromMainAndSubVaults(
"Error",
err,
)
} else {
log.ErrorLogWithError(
ctx,
"Megavault withdrawal: error when getting vault withdrawal slippage. Skipping this vault",
err,
"Vault ID",
vaultId,
)
}
continue
}
Expand All @@ -371,7 +347,7 @@ func (k Keeper) RedeemFromMainAndSubVaults(
quantumsToTransfer := new(big.Int).Quo(redeemedFromSubVault.Num(), redeemedFromSubVault.Denom())

if quantumsToTransfer.Sign() <= 0 || !quantumsToTransfer.IsUint64() {
if simulate {
if !simulate {
log.DebugLog(
ctx,
"Megavault withdrawal: quantums to transfer is invalid. Skipping this vault",
Expand All @@ -380,15 +356,6 @@ func (k Keeper) RedeemFromMainAndSubVaults(
"Quantums",
quantumsToTransfer,
)
} else {
log.ErrorLog(
ctx,
"Megavault withdrawal: quantums to transfer is invalid. Skipping this vault",
"Vault ID",
vaultId,
"Quantums",
quantumsToTransfer,
)
}
continue
}
Expand Down
Loading