Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
toteki committed Jun 27, 2023
1 parent 43bb420 commit ed33f8b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion x/leverage/keeper/borrows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion x/leverage/keeper/collateral.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions x/leverage/keeper/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions x/leverage/keeper/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ed33f8b

Please sign in to comment.