diff --git a/x/leverage/keeper/borrows.go b/x/leverage/keeper/borrows.go index de6307016e..dcf3419654 100644 --- a/x/leverage/keeper/borrows.go +++ b/x/leverage/keeper/borrows.go @@ -37,7 +37,7 @@ func (k Keeper) assertBorrowerHealth(ctx sdk.Context, borrowerAddr sdk.AccAddres } // check health using borrow factor - weightedBorrowValue, err := k.WeightedBorrowValue(ctx, borrowed, types.PriceModeHigh) + weightedBorrowValue, err := k.ValueWithBorrowFactor(ctx, borrowed, types.PriceModeHigh) if err != nil { return err } diff --git a/x/leverage/keeper/collateral.go b/x/leverage/keeper/collateral.go index 7d5d12f045..200fc78494 100644 --- a/x/leverage/keeper/collateral.go +++ b/x/leverage/keeper/collateral.go @@ -91,7 +91,7 @@ func (k Keeper) CalculateCollateralValue(ctx sdk.Context, collateral sdk.Coins, return sdk.ZeroDec(), err } - // add each collateral coin's weighted value to borrow limit + // add each collateral coin's value to borrow limit total = total.Add(v) } diff --git a/x/leverage/keeper/limits.go b/x/leverage/keeper/limits.go index ac9188f612..16cb9030ba 100644 --- a/x/leverage/keeper/limits.go +++ b/x/leverage/keeper/limits.go @@ -46,7 +46,7 @@ func (k *Keeper) userMaxWithdraw(ctx sdk.Context, addr sdk.AccAddress, denom str } // calculate weighted borrowed value - used by the borrow factor limit - weightedBorrowValue, err := k.WeightedBorrowValue(ctx, totalBorrowed, types.PriceModeHigh) + weightedBorrowValue, err := k.ValueWithBorrowFactor(ctx, totalBorrowed, types.PriceModeHigh) if nonOracleError(err) { // for errors besides a missing price, the whole transaction fails return sdk.Coin{}, sdk.Coin{}, err @@ -169,7 +169,7 @@ func (k *Keeper) userMaxBorrow(ctx sdk.Context, addr sdk.AccAddress, denom strin } // calculate weighted borrowed value for the account, using the higher of spot or historic prices - weightedBorrowedValue, err := k.WeightedBorrowValue(ctx, totalBorrowed, types.PriceModeHigh) + weightedBorrowedValue, err := k.ValueWithBorrowFactor(ctx, totalBorrowed, types.PriceModeHigh) if nonOracleError(err) { // non-oracle errors fail the transaction (or query) return sdk.Coin{}, err diff --git a/x/leverage/keeper/oracle.go b/x/leverage/keeper/oracle.go index 051ed76874..7b27072b2e 100644 --- a/x/leverage/keeper/oracle.go +++ b/x/leverage/keeper/oracle.go @@ -119,11 +119,11 @@ func (k Keeper) TotalTokenValue(ctx sdk.Context, coins sdk.Coins, mode types.Pri return total, nil } -// WeightedBorrowValue returns the total value of all input tokens, each multiplied +// ValueWithBorrowFactor returns the total value of all input tokens, each multiplied // by borrow factor (which is the minimum of 2.0 and 1/collateral weight). It // ignores unregistered and blacklisted tokens instead of returning an error, but // will error on unavailable prices. -func (k Keeper) WeightedBorrowValue(ctx sdk.Context, coins sdk.Coins, mode types.PriceMode) (sdk.Dec, error) { +func (k Keeper) ValueWithBorrowFactor(ctx sdk.Context, coins sdk.Coins, mode types.PriceMode) (sdk.Dec, error) { total := sdk.ZeroDec() for _, c := range coins {