Skip to content

Commit

Permalink
Merge pull request #99 from onomyprotocol/dong/fix-getprice-err
Browse files Browse the repository at this point in the history
Vaults: skip vaults that can't get price
  • Loading branch information
DongLieu authored Nov 12, 2024
2 parents e41f5cb + bf63087 commit 51af20c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions x/vaults/keeper/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@ func (k *Keeper) GetLiquidations(
mintSymbol := vm.Params.MintSymbol
price := k.OracleKeeper.GetPrice(ctx, collateralSymbol, mintSymbol)
if price == nil || price.IsNil() {
return true, errors.Wrapf(oracletypes.ErrInvalidOracle, "GetLiquidations: can not get price with base %s quote %s", vm.Denom, types.DefaultMintDenoms)
return false, nil
// return true, errors.Wrapf(oracletypes.ErrInvalidOracle, "GetLiquidations: can not get price with base %s quote %s", collateralSymbol, mintSymbol)
}
prices[vm.Denom] = *price
liquidationRatios[vm.Denom] = vm.Params.LiquidationRatio
Expand All @@ -517,7 +518,8 @@ func (k *Keeper) GetLiquidations(

err = k.Vaults.Walk(ctx, nil, func(id uint64, vault types.Vault) (bool, error) {
denom := vault.CollateralLocked.Denom
if vault.Debt.Denom != mintDenom {
_, ok := liquidations[denom]
if vault.Debt.Denom != mintDenom || !ok {
return false, nil
}

Expand Down

0 comments on commit 51af20c

Please sign in to comment.