From 521a65d13483eadb18230b845b7536d14398b5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDongLieu=E2=80=9D?= Date: Tue, 12 Nov 2024 10:52:13 +0700 Subject: [PATCH] fix getprice --- x/vaults/keeper/vault.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x/vaults/keeper/vault.go b/x/vaults/keeper/vault.go index ad722e7..a0fa30c 100644 --- a/x/vaults/keeper/vault.go +++ b/x/vaults/keeper/vault.go @@ -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 @@ -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 }