Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(leverage): liquidation threshold must be bigger than collateral_weight #1956

Merged
merged 10 commits into from
Mar 28, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Fixes

- [1929](https://github.com/umee-network/umee/pull/1929) Leverage: `MaxWithdraw` now accounts for `MinCollateralLiquidity`
- [1956](https://github.com/umee-network/umee/pull/1956) Leverage: token liquidation threshold must be bigger than collateral_weight.

## [v4.2.0](https://github.com/umee-network/umee/releases/tag/v4.2.0) - 2023-03-15

Expand Down
9 changes: 7 additions & 2 deletions proto/umee/leverage/v1/leverage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ message Token {
// Collateral Weight defines what portion of the total value of the asset
// can contribute to a users borrowing power. If the collateral weight is
// zero, using this asset as collateral against borrowing will be disabled.
// Must be smaller than `liquidation_threshold`.
// Valid values: 0-1.
string collateral_weight = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
Expand All @@ -107,8 +108,9 @@ message Token {
// Liquidation Threshold defines what amount of the total value of the
// asset as a collateral can contribute to a user's liquidation threshold
// (above which they become eligible for liquidation).
// See also: min_close_factor.
// Must be bigger than `collateral_weight`.
// Valid values: 0-1.
// See also: min_close_factor.
string liquidation_threshold = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
Expand Down Expand Up @@ -215,7 +217,10 @@ message Token {
// Borrowing, collateralizing, or withdrawing assets is not allowed when the
// result of such action invalidates min_collateral_liquidity.
// Liquidity can only drop below this value due to interest or liquidations.
// Valid values: 0 - 1
// The goal is to assure that there is enough available (not borrowed) token to be available
// for withdraw when there is a collateral liquidation and the liquidator needs to
// withdraw uToken.
// Valid values: 0 - inf
string min_collateral_liquidity = 17 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
Expand Down
47 changes: 41 additions & 6 deletions swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,8 @@ paths:
zero, using this asset as collateral against borrowing
will be disabled.

Must be smaller than `liquidation_threshold`.

Valid values: 0-1.
liquidation_threshold:
type: string
Expand All @@ -858,9 +860,11 @@ paths:

(above which they become eligible for liquidation).

See also: min_close_factor.
Must be bigger than `collateral_weight`.

Valid values: 0-1.

See also: min_close_factor.
base_borrow_rate:
type: string
title: >-
Expand Down Expand Up @@ -1010,7 +1014,15 @@ paths:
Liquidity can only drop below this value due to interest
or liquidations.

Valid values: 0 - 1
The goal is to assure that there is enough available
(not borrowed) token to be available

for withdraw when there is a collateral liquidation and
the liquidator needs to

withdraw uToken.

Valid values: 0 - inf
max_supply:
type: string
description: >-
Expand Down Expand Up @@ -2515,6 +2527,8 @@ definitions:
zero, using this asset as collateral against borrowing will be
disabled.

Must be smaller than `liquidation_threshold`.

Valid values: 0-1.
liquidation_threshold:
type: string
Expand All @@ -2527,9 +2541,11 @@ definitions:

(above which they become eligible for liquidation).

See also: min_close_factor.
Must be bigger than `collateral_weight`.

Valid values: 0-1.

See also: min_close_factor.
base_borrow_rate:
type: string
title: >-
Expand Down Expand Up @@ -2662,7 +2678,15 @@ definitions:
Liquidity can only drop below this value due to interest or
liquidations.

Valid values: 0 - 1
The goal is to assure that there is enough available (not
borrowed) token to be available

for withdraw when there is a collateral liquidation and the
liquidator needs to

withdraw uToken.

Valid values: 0 - inf
max_supply:
type: string
description: >-
Expand Down Expand Up @@ -2741,15 +2765,18 @@ definitions:
zero, using this asset as collateral against borrowing will be
disabled.

Must be smaller than `liquidation_threshold`.

Valid values: 0-1.
liquidation_threshold:
type: string
description: |-
Liquidation Threshold defines what amount of the total value of the
asset as a collateral can contribute to a user's liquidation threshold
(above which they become eligible for liquidation).
See also: min_close_factor.
Must be bigger than `collateral_weight`.
Valid values: 0-1.
See also: min_close_factor.
base_borrow_rate:
type: string
title: |-
Expand Down Expand Up @@ -2875,7 +2902,15 @@ definitions:
Liquidity can only drop below this value due to interest or
liquidations.

Valid values: 0 - 1
The goal is to assure that there is enough available (not borrowed)
token to be available

for withdraw when there is a collateral liquidation and the liquidator
needs to

withdraw uToken.

Valid values: 0 - inf
max_supply:
type: string
description: >-
Expand Down
Loading