Skip to content

Commit

Permalink
safer exit when asset not found
Browse files Browse the repository at this point in the history
  • Loading branch information
kosegor committed Jul 26, 2023
1 parent 380f05d commit a922fe8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions x/metoken/keeper/reserves.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (

sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

"github.com/umee-network/umee/v5/x/metoken"
lerrors "github.com/umee-network/umee/v5/x/metoken/errors"
)
Expand Down Expand Up @@ -44,7 +42,13 @@ func (k Keeper) RebalanceReserves() error {
if balance.AvailableSupply().IsPositive() {
i, assetSettings := index.AcceptedAsset(balance.Denom)
if i < 0 {
return sdkerrors.ErrNotFound.Wrapf("asset %s not found in the index", balance.Denom)
k.Logger().Debug(
"rebalancing reserves: failed getting accepted asset",
"asset", balance.Denom,
"index", index.Denom,
"block_time", k.ctx.BlockTime(),
)
continue
}

// Calculate the desired reserves amount
Expand Down

0 comments on commit a922fe8

Please sign in to comment.