Skip to content

Commit

Permalink
Merge pull request #2 from BLV-Labs/fix/get-uusd-price
Browse files Browse the repository at this point in the history
add logic get uusd
  • Loading branch information
duonghb53 authored Nov 4, 2024
2 parents 0832c67 + ae8d370 commit 2f33b29
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions custom/gov/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (math.Int, error
// Get exchange rate betweent Lunc/uusd from oracle
// save it to store
price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, core.MicroUSDDenom)
if err != nil && price.LTE(sdk.ZeroDec()) {
return sdk.ZeroInt(), err
// If can't get price from oracle, use min deposit
if err != nil {
return keeper.GetParams(ctx).MinDeposit[0].Amount, nil
}

minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit
totalLuncDeposit := sdk.NewDecFromInt(minUusdDeposit.Amount).Quo(price).TruncateInt()
if err != nil {
return sdk.ZeroInt(), err
}

return totalLuncDeposit, nil
}

Expand Down

0 comments on commit 2f33b29

Please sign in to comment.