From 03a430951e0a11c1b6cc9e4ee6a018e89bdb1d7a Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Mon, 12 Sep 2022 13:13:27 +0200 Subject: [PATCH 01/11] docs: leverage proto docs update --- proto/umee/leverage/v1/leverage.proto | 50 +++++++++++++++++++++------ x/leverage/types/leverage.pb.go | 50 +++++++++++++++++++++------ 2 files changed, 78 insertions(+), 22 deletions(-) diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index bcff24720b..09f7e78a1e 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -12,15 +12,30 @@ message Params { option (gogoproto.goproto_stringer) = false; // Complete Liquidation Threshold determines how far over their borrow // limit a borrower must be in order for their positions to be liquidated - // fully in a single event. + // fully in a single event. See minimum_close_factor for more details. + // Valid values: 0-1. string complete_liquidation_threshold = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"complete_liquidation_threshold\"" ]; - // Minimum Close Factor determines the portion of a borrower's position - // that can be liquidated in a single event, when the borrower is just barely - // over their borrow limit. + // Close Factor determines the portion of a borrower's position that can be + // liquidated in a single event. Minimum Close Factor is Close Factor at + // liquidation_threshold. 0.1 means that that 10% of the borrower position can + // be liquidated when the borrowed value passes the/ liquidation_threshold. + // close_factor scales linearly between minimum_close_factor and 1.0, + // reaching its maximum when borrowed value passed + // complete_liquidation_threshold. We can put it into the picture: + // + // + // borrowed C := collateral + // value value + // --- | ------- | ----- | -------- | -------> + // liquidation complete + // threshold liquidation + // * C threshold * C + // + // Valid values: 0-1. string minimum_close_factor = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -28,6 +43,7 @@ message Params { ]; // Oracle Reward Factor determines the portion of interest accrued on // borrows that is sent to the oracle module to fund its reward pool. + // Valid values: 0-1. string oracle_reward_factor = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -44,6 +60,7 @@ message Params { // Direct Liquidation Fee is a reduction factor in liquidation incentive // experienced by liquidators who choose to receive base assets instead of // uTokens as liquidation rewards. + // Valid values: 0-1. string direct_liquidation_fee = 6 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -61,6 +78,7 @@ message Token { // Reserve Factor defines what portion of accrued interest goes to reserves // when this token is borrowed. + // Valid values: 0-1. string reserve_factor = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -70,6 +88,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. + // Valid values: 0-1. string collateral_weight = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -77,8 +96,10 @@ message Token { ]; // Liquidation Threshold defines what amount of the total value of the - // asset can contribute to a user's liquidation threshold (above which they - // become eligible for liquidation). + // asset as a collateral can contribute to a user's liquidation threshold + // (above which they become eligible for liquidation). + // See also: min_close_factor. + // Valid values: 0-1. string liquidation_threshold = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -87,6 +108,7 @@ message Token { // Base Borrow Rate defines the minimum interest rate for borrowing this // asset. + // Valid values: 0-inf string base_borrow_rate = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -95,6 +117,7 @@ message Token { // Kink Borrow Rate defines the interest rate for borrowing this // asset when supply utilization is equal to 'kink_utilization'. + // Valid values: 0-inf string kink_borrow_rate = 6 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -103,6 +126,7 @@ message Token { // Max Borrow Rate defines the interest rate for borrowing this // asset when supply utilization is at its maximum. + // Valid values: 0-inf string max_borrow_rate = 7 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -111,6 +135,7 @@ message Token { // Kink Utilization defines the supply utilization value where // the kink in the borrow interest rate function occurs. + // Valid values: 0-1. string kink_utilization = 8 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -119,6 +144,7 @@ message Token { // Liquidation Incentive determines the portion of bonus collateral of // a token type liquidators receive as a liquidation reward. + // Valid values: 0-1. string liquidation_incentive = 9 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, @@ -174,17 +200,19 @@ message Token { (gogoproto.moretags) = "yaml:\"max_supply_utilization\"" ]; - // Min Collateral Liquidity specifies the minimum collateral liquidity a token is - // allowed to reach as a direct result of users borrowing, collateralizing, or - // withdrawing assets. Liquidity can only drop below this value due to interest - // or liquidations. + // Min Collateral Liquidity specifies an allowed minimum allowed for the following function: + // collateral_liquidity(token) = available(token) / total_collateral(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 - ∞ string min_collateral_liquidity = 17 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"min_collateral_liquidity\"" ]; - // Max Supply is the maximum amount of tokens the protocol can hold. + // Max Supply is the maximum amount of tokens the protocol can hold measured in USD. // Adding more supply of the given token to the protocol will return an error. // Must be a non negative value. 0 means that there is no limit. // To mark a token as not valid for supply, `msg_supply` must be set to false. diff --git a/x/leverage/types/leverage.pb.go b/x/leverage/types/leverage.pb.go index c86200d248..7750f5cab0 100644 --- a/x/leverage/types/leverage.pb.go +++ b/x/leverage/types/leverage.pb.go @@ -28,14 +28,30 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Params struct { // Complete Liquidation Threshold determines how far over their borrow // limit a borrower must be in order for their positions to be liquidated - // fully in a single event. + // fully in a single event. See minimum_close_factor for more details. + // Valid values: 0-1. CompleteLiquidationThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=complete_liquidation_threshold,json=completeLiquidationThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"complete_liquidation_threshold" yaml:"complete_liquidation_threshold"` - // Minimum Close Factor determines the portion of a borrower's position - // that can be liquidated in a single event, when the borrower is just barely - // over their borrow limit. + // Close Factor determines the portion of a borrower's position that can be + // liquidated in a single event. Minimum Close Factor is Close Factor at + // liquidation_threshold. 0.1 means that that 10% of the borrower position can + // be liquidated when the borrowed value passes the/ liquidation_threshold. + // close_factor scales linearly between minimum_close_factor and 1.0, + // reaching its maximum when borrowed value passed + // complete_liquidation_threshold. We can put it into the picture: + // + // + // borrowed C := collateral + // value value + // --- | ------- | ----- | -------- | -------> + // liquidation complete + // threshold liquidation + // * C threshold * C + // + // Valid values: 0-1. MinimumCloseFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=minimum_close_factor,json=minimumCloseFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"minimum_close_factor" yaml:"minimum_close_factor"` // Oracle Reward Factor determines the portion of interest accrued on // borrows that is sent to the oracle module to fund its reward pool. + // Valid values: 0-1. OracleRewardFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=oracle_reward_factor,json=oracleRewardFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oracle_reward_factor" yaml:"oracle_reward_factor"` // Small Liquidation Size determines the USD value at which a borrow is // considered small enough to be liquidated in a single transaction, bypassing @@ -44,6 +60,7 @@ type Params struct { // Direct Liquidation Fee is a reduction factor in liquidation incentive // experienced by liquidators who choose to receive base assets instead of // uTokens as liquidation rewards. + // Valid values: 0-1. DirectLiquidationFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=direct_liquidation_fee,json=directLiquidationFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"direct_liquidation_fee" yaml:"direct_liquidation_fee"` } @@ -86,29 +103,38 @@ type Token struct { BaseDenom string `protobuf:"bytes,1,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty" yaml:"base_denom"` // Reserve Factor defines what portion of accrued interest goes to reserves // when this token is borrowed. + // Valid values: 0-1. ReserveFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=reserve_factor,json=reserveFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reserve_factor" yaml:"reserve_factor"` // 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. + // Valid values: 0-1. CollateralWeight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=collateral_weight,json=collateralWeight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"collateral_weight" yaml:"collateral_weight"` // Liquidation Threshold defines what amount of the total value of the - // asset can contribute to a user's liquidation threshold (above which they - // become eligible for liquidation). + // asset as a collateral can contribute to a user's liquidation threshold + // (above which they become eligible for liquidation). + // See also: min_close_factor. + // Valid values: 0-1. LiquidationThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=liquidation_threshold,json=liquidationThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liquidation_threshold" yaml:"liquidation_threshold"` // Base Borrow Rate defines the minimum interest rate for borrowing this // asset. + // Valid values: 0-inf BaseBorrowRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=base_borrow_rate,json=baseBorrowRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"base_borrow_rate" yaml:"base_borrow_rate"` // Kink Borrow Rate defines the interest rate for borrowing this // asset when supply utilization is equal to 'kink_utilization'. + // Valid values: 0-inf KinkBorrowRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=kink_borrow_rate,json=kinkBorrowRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"kink_borrow_rate" yaml:"kink_borrow_rate"` // Max Borrow Rate defines the interest rate for borrowing this // asset when supply utilization is at its maximum. + // Valid values: 0-inf MaxBorrowRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=max_borrow_rate,json=maxBorrowRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_borrow_rate" yaml:"max_borrow_rate"` // Kink Utilization defines the supply utilization value where // the kink in the borrow interest rate function occurs. + // Valid values: 0-1. KinkUtilization github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=kink_utilization,json=kinkUtilization,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"kink_utilization" yaml:"kink_utilization"` // Liquidation Incentive determines the portion of bonus collateral of // a token type liquidators receive as a liquidation reward. + // Valid values: 0-1. LiquidationIncentive github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=liquidation_incentive,json=liquidationIncentive,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liquidation_incentive" yaml:"liquidation_incentive"` // Symbol Denom is the human readable denomination of this token. SymbolDenom string `protobuf:"bytes,10,opt,name=symbol_denom,json=symbolDenom,proto3" json:"symbol_denom,omitempty" yaml:"symbol_denom"` @@ -143,12 +169,14 @@ type Token struct { // the supply utilization is above `max_supply_utilization`. // Valid values: 0-1. MaxSupplyUtilization github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,16,opt,name=max_supply_utilization,json=maxSupplyUtilization,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_supply_utilization" yaml:"max_supply_utilization"` - // Min Collateral Liquidity specifies the minimum collateral liquidity a token is - // allowed to reach as a direct result of users borrowing, collateralizing, or - // withdrawing assets. Liquidity can only drop below this value due to interest - // or liquidations. + // Min Collateral Liquidity specifies an allowed minimum allowed for the following function: + // collateral_liquidity(token) = available(token) / total_collateral(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 - ∞ MinCollateralLiquidity github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,17,opt,name=min_collateral_liquidity,json=minCollateralLiquidity,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_collateral_liquidity" yaml:"min_collateral_liquidity"` - // Max Supply is the maximum amount of tokens the protocol can hold. + // Max Supply is the maximum amount of tokens the protocol can hold measured in USD. // Adding more supply of the given token to the protocol will return an error. // Must be a non negative value. 0 means that there is no limit. // To mark a token as not valid for supply, `msg_supply` must be set to false. From 4e495589f6ae2ed36d811689469881b25f2483f4 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Tue, 13 Sep 2022 12:56:15 +0200 Subject: [PATCH 02/11] Update proto/umee/leverage/v1/leverage.proto Co-authored-by: toteki <63419657+toteki@users.noreply.github.com> --- proto/umee/leverage/v1/leverage.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index 09f7e78a1e..ace076b782 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -22,7 +22,7 @@ message Params { // Close Factor determines the portion of a borrower's position that can be // liquidated in a single event. Minimum Close Factor is Close Factor at // liquidation_threshold. 0.1 means that that 10% of the borrower position can - // be liquidated when the borrowed value passes the/ liquidation_threshold. + // be liquidated when the borrowed value passes the liquidation_threshold. // close_factor scales linearly between minimum_close_factor and 1.0, // reaching its maximum when borrowed value passed // complete_liquidation_threshold. We can put it into the picture: From 5c2515bdf62b32848871e5a64ed59cd355e65f5b Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Tue, 13 Sep 2022 12:59:08 +0200 Subject: [PATCH 03/11] Update proto/umee/leverage/v1/leverage.proto Co-authored-by: toteki <63419657+toteki@users.noreply.github.com> --- proto/umee/leverage/v1/leverage.proto | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index ace076b782..fc9edb768d 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -12,7 +12,9 @@ message Params { option (gogoproto.goproto_stringer) = false; // Complete Liquidation Threshold determines how far over their borrow // limit a borrower must be in order for their positions to be liquidated - // fully in a single event. See minimum_close_factor for more details. + // fully in a single event. It represents how far between liquidation_threshold and + // collateral_value their borrowed value has progressed, with 0.5 being directly + // between the two. // Valid values: 0-1. string complete_liquidation_threshold = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", From d54710cdad880e752b30106b09845b80029606ba Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 16 Sep 2022 11:28:31 +0200 Subject: [PATCH 04/11] proto-all --- Makefile | 1 - swagger/swagger.yaml | 284 ++++++++++++++++++++++++-------- x/leverage/types/leverage.pb.go | 6 +- 3 files changed, 218 insertions(+), 73 deletions(-) diff --git a/Makefile b/Makefile index 9ba64b14ba..db95d7303a 100644 --- a/Makefile +++ b/Makefile @@ -188,7 +188,6 @@ test-sim-benchmark-invariants ## Protobuf ## ############################################################################### -#DOCKER_BUF := docker run -v $(shell pwd):/workspace --workdir /workspace bufbuild/buf:1.0.0-rc11 DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf:1.7.0 containerProtoVer=v0.7 diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index 236b587e17..d0f677421b 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -495,17 +495,46 @@ paths: limit a borrower must be in order for their positions to be liquidated - fully in a single event. + fully in a single event. It represents how far between + liquidation_threshold and + + collateral_value their borrowed value has progressed, with + 0.5 being directly + + between the two. + + Valid values: 0-1. minimum_close_factor: type: string - description: >- - Minimum Close Factor determines the portion of a - borrower's position + description: |- + borrowed C := collateral + value value + --- | ------- | ----- | -------- | -------> + liquidation complete + threshold liquidation + * C threshold * C + + Valid values: 0-1. + title: >- + Close Factor determines the portion of a borrower's + position that can be + + liquidated in a single event. Minimum Close Factor is + Close Factor at + + liquidation_threshold. 0.1 means that that 10% of the + borrower position can - that can be liquidated in a single event, when the - borrower is just barely + be liquidated when the borrowed value passes the + liquidation_threshold. - over their borrow limit. + close_factor scales linearly between minimum_close_factor + and 1.0, + + reaching its maximum when borrowed value passed + + complete_liquidation_threshold. We can put it into the + picture: oracle_reward_factor: type: string description: >- @@ -514,6 +543,8 @@ paths: borrows that is sent to the oracle module to fund its reward pool. + + Valid values: 0-1. small_liquidation_size: type: string description: >- @@ -534,6 +565,8 @@ paths: assets instead of uTokens as liquidation rewards. + + Valid values: 0-1. description: Params defines the parameters for the leverage module. description: >- QueryParamsResponse defines the response structure for the Params @@ -591,6 +624,8 @@ paths: goes to reserves when this token is borrowed. + + Valid values: 0-1. collateral_weight: type: string description: >- @@ -602,38 +637,50 @@ paths: zero, using this asset as collateral against borrowing will be disabled. + + Valid values: 0-1. liquidation_threshold: type: string description: >- Liquidation Threshold defines what amount of the total value of the - asset can contribute to a user's liquidation threshold - (above which they + asset as a collateral can contribute to a user's + liquidation threshold + + (above which they become eligible for liquidation). + + See also: min_close_factor. - become eligible for liquidation). + Valid values: 0-1. base_borrow_rate: type: string - description: >- + title: >- Base Borrow Rate defines the minimum interest rate for borrowing this asset. + + Valid values: 0-inf kink_borrow_rate: type: string - description: >- + title: >- Kink Borrow Rate defines the interest rate for borrowing this asset when supply utilization is equal to 'kink_utilization'. + + Valid values: 0-inf max_borrow_rate: type: string - description: >- + title: >- Max Borrow Rate defines the interest rate for borrowing this asset when supply utilization is at its maximum. + + Valid values: 0-inf kink_utilization: type: string description: >- @@ -641,6 +688,8 @@ paths: where the kink in the borrow interest rate function occurs. + + Valid values: 0-1. liquidation_incentive: type: string description: >- @@ -649,6 +698,8 @@ paths: a token type liquidators receive as a liquidation reward. + + Valid values: 0-1. symbol_denom: type: string description: >- @@ -738,22 +789,25 @@ paths: Valid values: 0-1. min_collateral_liquidity: type: string - description: >- - Min Collateral Liquidity specifies the minimum - collateral liquidity a token is - - allowed to reach as a direct result of users borrowing, - collateralizing, or + title: >- + Min Collateral Liquidity specifies an allowed minimum + allowed for the following function: + collateral_liquidity(token) = available(token) / total_collateral(token) + Borrowing, collateralizing, or withdrawing assets is not + allowed when the - withdrawing assets. Liquidity can only drop below this - value due to interest + result of such action invalidates + min_collateral_liquidity. + Liquidity can only drop below this value due to interest or liquidations. + + Valid values: 0 - ∞ max_supply: type: string description: >- Max Supply is the maximum amount of tokens the protocol - can hold. + can hold measured in USD. Adding more supply of the given token to the protocol will return an error. @@ -1435,24 +1489,54 @@ definitions: properties: complete_liquidation_threshold: type: string - description: |- + description: >- Complete Liquidation Threshold determines how far over their borrow + limit a borrower must be in order for their positions to be liquidated - fully in a single event. + + fully in a single event. It represents how far between + liquidation_threshold and + + collateral_value their borrowed value has progressed, with 0.5 being + directly + + between the two. + + Valid values: 0-1. minimum_close_factor: type: string - description: >- - Minimum Close Factor determines the portion of a borrower's position + description: |- + borrowed C := collateral + value value + --- | ------- | ----- | -------- | -------> + liquidation complete + threshold liquidation + * C threshold * C + + Valid values: 0-1. + title: >- + Close Factor determines the portion of a borrower's position that can + be + + liquidated in a single event. Minimum Close Factor is Close Factor at + + liquidation_threshold. 0.1 means that that 10% of the borrower + position can + + be liquidated when the borrowed value passes the + liquidation_threshold. - that can be liquidated in a single event, when the borrower is just - barely + close_factor scales linearly between minimum_close_factor and 1.0, - over their borrow limit. + reaching its maximum when borrowed value passed + + complete_liquidation_threshold. We can put it into the picture: oracle_reward_factor: type: string description: |- Oracle Reward Factor determines the portion of interest accrued on borrows that is sent to the oracle module to fund its reward pool. + Valid values: 0-1. small_liquidation_size: type: string description: >- @@ -1471,6 +1555,8 @@ definitions: of uTokens as liquidation rewards. + + Valid values: 0-1. description: Params defines the parameters for the leverage module. umee.leverage.v1.QueryAccountBalancesResponse: type: object @@ -1757,22 +1843,50 @@ definitions: limit a borrower must be in order for their positions to be liquidated - fully in a single event. + fully in a single event. It represents how far between + liquidation_threshold and + + collateral_value their borrowed value has progressed, with 0.5 + being directly + + between the two. + + Valid values: 0-1. minimum_close_factor: type: string - description: >- - Minimum Close Factor determines the portion of a borrower's - position + description: |- + borrowed C := collateral + value value + --- | ------- | ----- | -------- | -------> + liquidation complete + threshold liquidation + * C threshold * C + + Valid values: 0-1. + title: >- + Close Factor determines the portion of a borrower's position that + can be + + liquidated in a single event. Minimum Close Factor is Close Factor + at + + liquidation_threshold. 0.1 means that that 10% of the borrower + position can + + be liquidated when the borrowed value passes the + liquidation_threshold. - that can be liquidated in a single event, when the borrower is - just barely + close_factor scales linearly between minimum_close_factor and 1.0, - over their borrow limit. + reaching its maximum when borrowed value passed + + complete_liquidation_threshold. We can put it into the picture: oracle_reward_factor: type: string description: |- Oracle Reward Factor determines the portion of interest accrued on borrows that is sent to the oracle module to fund its reward pool. + Valid values: 0-1. small_liquidation_size: type: string description: >- @@ -1793,6 +1907,8 @@ definitions: instead of uTokens as liquidation rewards. + + Valid values: 0-1. description: Params defines the parameters for the leverage module. description: |- QueryParamsResponse defines the response structure for the Params gRPC @@ -1815,6 +1931,8 @@ definitions: reserves when this token is borrowed. + + Valid values: 0-1. collateral_weight: type: string description: >- @@ -1826,38 +1944,49 @@ definitions: zero, using this asset as collateral against borrowing will be disabled. + + Valid values: 0-1. liquidation_threshold: type: string description: >- Liquidation Threshold defines what amount of the total value of the - asset can contribute to a user's liquidation threshold (above - which they + asset as a collateral can contribute to a user's liquidation + threshold - become eligible for liquidation). + (above which they become eligible for liquidation). + + See also: min_close_factor. + + Valid values: 0-1. base_borrow_rate: type: string - description: >- + title: >- Base Borrow Rate defines the minimum interest rate for borrowing this asset. + + Valid values: 0-inf kink_borrow_rate: type: string - description: |- + title: |- Kink Borrow Rate defines the interest rate for borrowing this asset when supply utilization is equal to 'kink_utilization'. + Valid values: 0-inf max_borrow_rate: type: string - description: |- + title: |- Max Borrow Rate defines the interest rate for borrowing this asset when supply utilization is at its maximum. + Valid values: 0-inf kink_utilization: type: string description: |- Kink Utilization defines the supply utilization value where the kink in the borrow interest rate function occurs. + Valid values: 0-1. liquidation_incentive: type: string description: >- @@ -1865,6 +1994,8 @@ definitions: of a token type liquidators receive as a liquidation reward. + + Valid values: 0-1. symbol_denom: type: string description: Symbol Denom is the human readable denomination of this token. @@ -1949,22 +2080,24 @@ definitions: Valid values: 0-1. min_collateral_liquidity: type: string - description: >- - Min Collateral Liquidity specifies the minimum collateral - liquidity a token is + title: >- + Min Collateral Liquidity specifies an allowed minimum allowed + for the following function: + collateral_liquidity(token) = available(token) / total_collateral(token) + Borrowing, collateralizing, or withdrawing assets is not allowed + when the - allowed to reach as a direct result of users borrowing, - collateralizing, or + result of such action invalidates min_collateral_liquidity. - withdrawing assets. Liquidity can only drop below this value due - to interest + Liquidity can only drop below this value due to interest or + liquidations. - or liquidations. + Valid values: 0 - ∞ max_supply: type: string description: >- - Max Supply is the maximum amount of tokens the protocol can - hold. + Max Supply is the maximum amount of tokens the protocol can hold + measured in USD. Adding more supply of the given token to the protocol will return an error. @@ -1994,6 +2127,8 @@ definitions: reserves when this token is borrowed. + + Valid values: 0-1. collateral_weight: type: string description: >- @@ -2003,40 +2138,46 @@ definitions: zero, using this asset as collateral against borrowing will be disabled. + + Valid values: 0-1. liquidation_threshold: type: string - description: >- + description: |- Liquidation Threshold defines what amount of the total value of the - - asset can contribute to a user's liquidation threshold (above which - they - - become eligible for liquidation). + asset as a collateral can contribute to a user's liquidation threshold + (above which they become eligible for liquidation). + See also: min_close_factor. + Valid values: 0-1. base_borrow_rate: type: string - description: |- + title: |- Base Borrow Rate defines the minimum interest rate for borrowing this asset. + Valid values: 0-inf kink_borrow_rate: type: string - description: |- + title: |- Kink Borrow Rate defines the interest rate for borrowing this asset when supply utilization is equal to 'kink_utilization'. + Valid values: 0-inf max_borrow_rate: type: string - description: |- + title: |- Max Borrow Rate defines the interest rate for borrowing this asset when supply utilization is at its maximum. + Valid values: 0-inf kink_utilization: type: string description: |- Kink Utilization defines the supply utilization value where the kink in the borrow interest rate function occurs. + Valid values: 0-1. liquidation_incentive: type: string description: |- Liquidation Incentive determines the portion of bonus collateral of a token type liquidators receive as a liquidation reward. + Valid values: 0-1. symbol_denom: type: string description: Symbol Denom is the human readable denomination of this token. @@ -2120,21 +2261,24 @@ definitions: Valid values: 0-1. min_collateral_liquidity: type: string - description: >- - Min Collateral Liquidity specifies the minimum collateral liquidity a - token is + title: >- + Min Collateral Liquidity specifies an allowed minimum allowed for the + following function: + collateral_liquidity(token) = available(token) / total_collateral(token) + Borrowing, collateralizing, or withdrawing assets is not allowed when + the - allowed to reach as a direct result of users borrowing, - collateralizing, or + result of such action invalidates min_collateral_liquidity. - withdrawing assets. Liquidity can only drop below this value due to - interest + Liquidity can only drop below this value due to interest or + liquidations. - or liquidations. + Valid values: 0 - ∞ max_supply: type: string description: >- - Max Supply is the maximum amount of tokens the protocol can hold. + Max Supply is the maximum amount of tokens the protocol can hold + measured in USD. Adding more supply of the given token to the protocol will return an error. diff --git a/x/leverage/types/leverage.pb.go b/x/leverage/types/leverage.pb.go index 7750f5cab0..6edce8b184 100644 --- a/x/leverage/types/leverage.pb.go +++ b/x/leverage/types/leverage.pb.go @@ -28,13 +28,15 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Params struct { // Complete Liquidation Threshold determines how far over their borrow // limit a borrower must be in order for their positions to be liquidated - // fully in a single event. See minimum_close_factor for more details. + // fully in a single event. It represents how far between liquidation_threshold and + // collateral_value their borrowed value has progressed, with 0.5 being directly + // between the two. // Valid values: 0-1. CompleteLiquidationThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=complete_liquidation_threshold,json=completeLiquidationThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"complete_liquidation_threshold" yaml:"complete_liquidation_threshold"` // Close Factor determines the portion of a borrower's position that can be // liquidated in a single event. Minimum Close Factor is Close Factor at // liquidation_threshold. 0.1 means that that 10% of the borrower position can - // be liquidated when the borrowed value passes the/ liquidation_threshold. + // be liquidated when the borrowed value passes the liquidation_threshold. // close_factor scales linearly between minimum_close_factor and 1.0, // reaching its maximum when borrowed value passed // complete_liquidation_threshold. We can put it into the picture: From 9d9cf82f0b59e811a3482c5f8f8326783a97790c Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Fri, 16 Sep 2022 11:35:50 +0200 Subject: [PATCH 05/11] update comment --- proto/umee/leverage/v1/leverage.proto | 4 ++-- swagger/swagger.yaml | 12 ++++++------ x/leverage/types/leverage.pb.go | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index fc9edb768d..a77533dd02 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -34,8 +34,8 @@ message Params { // value value // --- | ------- | ----- | -------- | -------> // liquidation complete - // threshold liquidation - // * C threshold * C + // threshold *C liquidation + // threshold * C // // Valid values: 0-1. string minimum_close_factor = 3 [ diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index d0f677421b..9d0c70cab8 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -511,8 +511,8 @@ paths: value value --- | ------- | ----- | -------- | -------> liquidation complete - threshold liquidation - * C threshold * C + threshold *C liquidation + threshold * C Valid values: 0-1. title: >- @@ -1510,8 +1510,8 @@ definitions: value value --- | ------- | ----- | -------- | -------> liquidation complete - threshold liquidation - * C threshold * C + threshold *C liquidation + threshold * C Valid values: 0-1. title: >- @@ -1859,8 +1859,8 @@ definitions: value value --- | ------- | ----- | -------- | -------> liquidation complete - threshold liquidation - * C threshold * C + threshold *C liquidation + threshold * C Valid values: 0-1. title: >- diff --git a/x/leverage/types/leverage.pb.go b/x/leverage/types/leverage.pb.go index 6edce8b184..45b84b3d43 100644 --- a/x/leverage/types/leverage.pb.go +++ b/x/leverage/types/leverage.pb.go @@ -46,8 +46,8 @@ type Params struct { // value value // --- | ------- | ----- | -------- | -------> // liquidation complete - // threshold liquidation - // * C threshold * C + // threshold *C liquidation + // threshold * C // // Valid values: 0-1. MinimumCloseFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=minimum_close_factor,json=minimumCloseFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"minimum_close_factor" yaml:"minimum_close_factor"` From 09517e62c0e8ab4d813f816da3fcfcfb718bfe5e Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Sun, 18 Sep 2022 00:29:00 +0200 Subject: [PATCH 06/11] update docs --- proto/umee/leverage/v1/leverage.proto | 17 +++---- swagger/swagger.yaml | 70 ++++++++++++--------------- x/leverage/types/leverage.pb.go | 17 +++---- 3 files changed, 46 insertions(+), 58 deletions(-) diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index a77533dd02..59f60eab9d 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -10,11 +10,9 @@ option (gogoproto.goproto_getters_all) = false; // Params defines the parameters for the leverage module. message Params { option (gogoproto.goproto_stringer) = false; - // Complete Liquidation Threshold determines how far over their borrow - // limit a borrower must be in order for their positions to be liquidated - // fully in a single event. It represents how far between liquidation_threshold and - // collateral_value their borrowed value has progressed, with 0.5 being directly - // between the two. + // Complete Liquidation Threshold determines how far between liquidation_threshold + // and collateral_value their borrowed value has progressed to allow full liquidation, + // with 0.5 being directly between the two. // Valid values: 0-1. string complete_liquidation_threshold = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -29,13 +27,14 @@ message Params { // reaching its maximum when borrowed value passed // complete_liquidation_threshold. We can put it into the picture: // - // // borrowed C := collateral // value value // --- | ------- | ----- | -------- | -------> - // liquidation complete - // threshold *C liquidation - // threshold * C + // L CL + // + // liquidation = liquidation_threshold * C + // CL = L + (C-CL) * complete_liquidation_threshold + // it is a USD value from where the complete liquidation is allowed. // // Valid values: 0-1. string minimum_close_factor = 3 [ diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index 9d0c70cab8..f79358fdb8 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -489,19 +489,13 @@ paths: complete_liquidation_threshold: type: string description: >- - Complete Liquidation Threshold determines how far over - their borrow + Complete Liquidation Threshold determines how far between + liquidation_threshold - limit a borrower must be in order for their positions to - be liquidated + and collateral_value their borrowed value has progressed + to allow full liquidation, - fully in a single event. It represents how far between - liquidation_threshold and - - collateral_value their borrowed value has progressed, with - 0.5 being directly - - between the two. + with 0.5 being directly between the two. Valid values: 0-1. minimum_close_factor: @@ -510,9 +504,11 @@ paths: borrowed C := collateral value value --- | ------- | ----- | -------- | -------> - liquidation complete - threshold *C liquidation - threshold * C + L CL + + liquidation = liquidation_threshold * C + CL = L + (C-CL) * complete_liquidation_threshold + it is a USD value from where the complete liquidation is allowed. Valid values: 0-1. title: >- @@ -1490,17 +1486,13 @@ definitions: complete_liquidation_threshold: type: string description: >- - Complete Liquidation Threshold determines how far over their borrow - - limit a borrower must be in order for their positions to be liquidated - - fully in a single event. It represents how far between - liquidation_threshold and + Complete Liquidation Threshold determines how far between + liquidation_threshold - collateral_value their borrowed value has progressed, with 0.5 being - directly + and collateral_value their borrowed value has progressed to allow full + liquidation, - between the two. + with 0.5 being directly between the two. Valid values: 0-1. minimum_close_factor: @@ -1509,9 +1501,11 @@ definitions: borrowed C := collateral value value --- | ------- | ----- | -------- | -------> - liquidation complete - threshold *C liquidation - threshold * C + L CL + + liquidation = liquidation_threshold * C + CL = L + (C-CL) * complete_liquidation_threshold + it is a USD value from where the complete liquidation is allowed. Valid values: 0-1. title: >- @@ -1837,19 +1831,13 @@ definitions: complete_liquidation_threshold: type: string description: >- - Complete Liquidation Threshold determines how far over their - borrow - - limit a borrower must be in order for their positions to be - liquidated + Complete Liquidation Threshold determines how far between + liquidation_threshold - fully in a single event. It represents how far between - liquidation_threshold and + and collateral_value their borrowed value has progressed to allow + full liquidation, - collateral_value their borrowed value has progressed, with 0.5 - being directly - - between the two. + with 0.5 being directly between the two. Valid values: 0-1. minimum_close_factor: @@ -1858,9 +1846,11 @@ definitions: borrowed C := collateral value value --- | ------- | ----- | -------- | -------> - liquidation complete - threshold *C liquidation - threshold * C + L CL + + liquidation = liquidation_threshold * C + CL = L + (C-CL) * complete_liquidation_threshold + it is a USD value from where the complete liquidation is allowed. Valid values: 0-1. title: >- diff --git a/x/leverage/types/leverage.pb.go b/x/leverage/types/leverage.pb.go index 45b84b3d43..3da3300984 100644 --- a/x/leverage/types/leverage.pb.go +++ b/x/leverage/types/leverage.pb.go @@ -26,11 +26,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the leverage module. type Params struct { - // Complete Liquidation Threshold determines how far over their borrow - // limit a borrower must be in order for their positions to be liquidated - // fully in a single event. It represents how far between liquidation_threshold and - // collateral_value their borrowed value has progressed, with 0.5 being directly - // between the two. + // Complete Liquidation Threshold determines how far between liquidation_threshold + // and collateral_value their borrowed value has progressed to allow full liquidation, + // with 0.5 being directly between the two. // Valid values: 0-1. CompleteLiquidationThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=complete_liquidation_threshold,json=completeLiquidationThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"complete_liquidation_threshold" yaml:"complete_liquidation_threshold"` // Close Factor determines the portion of a borrower's position that can be @@ -41,13 +39,14 @@ type Params struct { // reaching its maximum when borrowed value passed // complete_liquidation_threshold. We can put it into the picture: // - // // borrowed C := collateral // value value // --- | ------- | ----- | -------- | -------> - // liquidation complete - // threshold *C liquidation - // threshold * C + // L CL + // + // liquidation = liquidation_threshold * C + // CL = L + (C-CL) * complete_liquidation_threshold + // it is a USD value from where the complete liquidation is allowed. // // Valid values: 0-1. MinimumCloseFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=minimum_close_factor,json=minimumCloseFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"minimum_close_factor" yaml:"minimum_close_factor"` From 3b692b3c0b3b191549a766cbff4db183672ff11e Mon Sep 17 00:00:00 2001 From: toteki <63419657+toteki@users.noreply.github.com> Date: Sat, 17 Sep 2022 16:26:29 -0700 Subject: [PATCH 07/11] proto comment change --- proto/umee/leverage/v1/leverage.proto | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index 59f60eab9d..7f106f4577 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -10,9 +10,10 @@ option (gogoproto.goproto_getters_all) = false; // Params defines the parameters for the leverage module. message Params { option (gogoproto.goproto_stringer) = false; - // Complete Liquidation Threshold determines how far between liquidation_threshold - // and collateral_value their borrowed value has progressed to allow full liquidation, - // with 0.5 being directly between the two. + // Complete Liquidation Threshold determines how far between + // liquidation_threshold (LT) and collateral_value (CV) a borrower's + // borrowed value must have progressed in order to allow a full liquidation. + // 0.3 indicates 30% of the way from LT to CV. // Valid values: 0-1. string complete_liquidation_threshold = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -24,7 +25,7 @@ message Params { // liquidation_threshold. 0.1 means that that 10% of the borrower position can // be liquidated when the borrowed value passes the liquidation_threshold. // close_factor scales linearly between minimum_close_factor and 1.0, - // reaching its maximum when borrowed value passed + // reaching its maximum when borrowed value passes // complete_liquidation_threshold. We can put it into the picture: // // borrowed C := collateral @@ -34,7 +35,7 @@ message Params { // // liquidation = liquidation_threshold * C // CL = L + (C-CL) * complete_liquidation_threshold - // it is a USD value from where the complete liquidation is allowed. + // is the borrowed value above which close factor will be 1. // // Valid values: 0-1. string minimum_close_factor = 3 [ From 667ef22acfbf28a79455f3b79f0209a3f665f226 Mon Sep 17 00:00:00 2001 From: toteki <63419657+toteki@users.noreply.github.com> Date: Sat, 17 Sep 2022 16:53:36 -0700 Subject: [PATCH 08/11] make proto-all --- swagger/swagger.yaml | 40 ++++++++++++++++++--------------- x/leverage/types/leverage.pb.go | 11 ++++----- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index f79358fdb8..f6bd99fbe7 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -490,12 +490,14 @@ paths: type: string description: >- Complete Liquidation Threshold determines how far between - liquidation_threshold - and collateral_value their borrowed value has progressed - to allow full liquidation, + liquidation_threshold (LT) and collateral_value (CV) a + borrower's - with 0.5 being directly between the two. + borrowed value must have progressed in order to allow a + full liquidation. + + 0.3 indicates 30% of the way from LT to CV. Valid values: 0-1. minimum_close_factor: @@ -508,7 +510,7 @@ paths: liquidation = liquidation_threshold * C CL = L + (C-CL) * complete_liquidation_threshold - it is a USD value from where the complete liquidation is allowed. + is the borrowed value above which close factor will be 1. Valid values: 0-1. title: >- @@ -527,7 +529,7 @@ paths: close_factor scales linearly between minimum_close_factor and 1.0, - reaching its maximum when borrowed value passed + reaching its maximum when borrowed value passes complete_liquidation_threshold. We can put it into the picture: @@ -1487,12 +1489,13 @@ definitions: type: string description: >- Complete Liquidation Threshold determines how far between - liquidation_threshold - and collateral_value their borrowed value has progressed to allow full - liquidation, + liquidation_threshold (LT) and collateral_value (CV) a borrower's + + borrowed value must have progressed in order to allow a full + liquidation. - with 0.5 being directly between the two. + 0.3 indicates 30% of the way from LT to CV. Valid values: 0-1. minimum_close_factor: @@ -1505,7 +1508,7 @@ definitions: liquidation = liquidation_threshold * C CL = L + (C-CL) * complete_liquidation_threshold - it is a USD value from where the complete liquidation is allowed. + is the borrowed value above which close factor will be 1. Valid values: 0-1. title: >- @@ -1522,7 +1525,7 @@ definitions: close_factor scales linearly between minimum_close_factor and 1.0, - reaching its maximum when borrowed value passed + reaching its maximum when borrowed value passes complete_liquidation_threshold. We can put it into the picture: oracle_reward_factor: @@ -1832,12 +1835,13 @@ definitions: type: string description: >- Complete Liquidation Threshold determines how far between - liquidation_threshold - and collateral_value their borrowed value has progressed to allow - full liquidation, + liquidation_threshold (LT) and collateral_value (CV) a borrower's + + borrowed value must have progressed in order to allow a full + liquidation. - with 0.5 being directly between the two. + 0.3 indicates 30% of the way from LT to CV. Valid values: 0-1. minimum_close_factor: @@ -1850,7 +1854,7 @@ definitions: liquidation = liquidation_threshold * C CL = L + (C-CL) * complete_liquidation_threshold - it is a USD value from where the complete liquidation is allowed. + is the borrowed value above which close factor will be 1. Valid values: 0-1. title: >- @@ -1868,7 +1872,7 @@ definitions: close_factor scales linearly between minimum_close_factor and 1.0, - reaching its maximum when borrowed value passed + reaching its maximum when borrowed value passes complete_liquidation_threshold. We can put it into the picture: oracle_reward_factor: diff --git a/x/leverage/types/leverage.pb.go b/x/leverage/types/leverage.pb.go index 3da3300984..cfe27f099c 100644 --- a/x/leverage/types/leverage.pb.go +++ b/x/leverage/types/leverage.pb.go @@ -26,9 +26,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the leverage module. type Params struct { - // Complete Liquidation Threshold determines how far between liquidation_threshold - // and collateral_value their borrowed value has progressed to allow full liquidation, - // with 0.5 being directly between the two. + // Complete Liquidation Threshold determines how far between + // liquidation_threshold (LT) and collateral_value (CV) a borrower's + // borrowed value must have progressed in order to allow a full liquidation. + // 0.3 indicates 30% of the way from LT to CV. // Valid values: 0-1. CompleteLiquidationThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=complete_liquidation_threshold,json=completeLiquidationThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"complete_liquidation_threshold" yaml:"complete_liquidation_threshold"` // Close Factor determines the portion of a borrower's position that can be @@ -36,7 +37,7 @@ type Params struct { // liquidation_threshold. 0.1 means that that 10% of the borrower position can // be liquidated when the borrowed value passes the liquidation_threshold. // close_factor scales linearly between minimum_close_factor and 1.0, - // reaching its maximum when borrowed value passed + // reaching its maximum when borrowed value passes // complete_liquidation_threshold. We can put it into the picture: // // borrowed C := collateral @@ -46,7 +47,7 @@ type Params struct { // // liquidation = liquidation_threshold * C // CL = L + (C-CL) * complete_liquidation_threshold - // it is a USD value from where the complete liquidation is allowed. + // is the borrowed value above which close factor will be 1. // // Valid values: 0-1. MinimumCloseFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=minimum_close_factor,json=minimumCloseFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"minimum_close_factor" yaml:"minimum_close_factor"` From 7c706b7b6f506a13103800a8e0f317e8dff14969 Mon Sep 17 00:00:00 2001 From: toteki <63419657+toteki@users.noreply.github.com> Date: Sat, 17 Sep 2022 16:55:23 -0700 Subject: [PATCH 09/11] Update proto/umee/leverage/v1/leverage.proto --- proto/umee/leverage/v1/leverage.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index 7f106f4577..1745a8562c 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -207,7 +207,7 @@ 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 - ∞ + // Valid values: 0 - 1 string min_collateral_liquidity = 17 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, From dd099fe832eecf1795d78b2957f5e5d76834b804 Mon Sep 17 00:00:00 2001 From: toteki <63419657+toteki@users.noreply.github.com> Date: Sat, 17 Sep 2022 16:55:33 -0700 Subject: [PATCH 10/11] Update proto/umee/leverage/v1/leverage.proto --- proto/umee/leverage/v1/leverage.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index 1745a8562c..e69e634140 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -214,7 +214,7 @@ message Token { (gogoproto.moretags) = "yaml:\"min_collateral_liquidity\"" ]; - // Max Supply is the maximum amount of tokens the protocol can hold measured in USD. + // Max Supply is the maximum amount of tokens the protocol can hold. // Adding more supply of the given token to the protocol will return an error. // Must be a non negative value. 0 means that there is no limit. // To mark a token as not valid for supply, `msg_supply` must be set to false. From 3abffb99ee71071ad3894e960cda42ad6b93dc1c Mon Sep 17 00:00:00 2001 From: toteki <63419657+toteki@users.noreply.github.com> Date: Sat, 17 Sep 2022 16:58:55 -0700 Subject: [PATCH 11/11] make proto-all --- swagger/swagger.yaml | 15 +++++++-------- x/leverage/types/leverage.pb.go | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index f6bd99fbe7..1c5d296ad4 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -800,12 +800,12 @@ paths: Liquidity can only drop below this value due to interest or liquidations. - Valid values: 0 - ∞ + Valid values: 0 - 1 max_supply: type: string description: >- Max Supply is the maximum amount of tokens the protocol - can hold measured in USD. + can hold. Adding more supply of the given token to the protocol will return an error. @@ -2086,12 +2086,12 @@ definitions: Liquidity can only drop below this value due to interest or liquidations. - Valid values: 0 - ∞ + Valid values: 0 - 1 max_supply: type: string description: >- - Max Supply is the maximum amount of tokens the protocol can hold - measured in USD. + Max Supply is the maximum amount of tokens the protocol can + hold. Adding more supply of the given token to the protocol will return an error. @@ -2267,12 +2267,11 @@ definitions: Liquidity can only drop below this value due to interest or liquidations. - Valid values: 0 - ∞ + Valid values: 0 - 1 max_supply: type: string description: >- - Max Supply is the maximum amount of tokens the protocol can hold - measured in USD. + Max Supply is the maximum amount of tokens the protocol can hold. Adding more supply of the given token to the protocol will return an error. diff --git a/x/leverage/types/leverage.pb.go b/x/leverage/types/leverage.pb.go index cfe27f099c..d433520300 100644 --- a/x/leverage/types/leverage.pb.go +++ b/x/leverage/types/leverage.pb.go @@ -176,9 +176,9 @@ type Token struct { // 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 - ∞ + // Valid values: 0 - 1 MinCollateralLiquidity github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,17,opt,name=min_collateral_liquidity,json=minCollateralLiquidity,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_collateral_liquidity" yaml:"min_collateral_liquidity"` - // Max Supply is the maximum amount of tokens the protocol can hold measured in USD. + // Max Supply is the maximum amount of tokens the protocol can hold. // Adding more supply of the given token to the protocol will return an error. // Must be a non negative value. 0 means that there is no limit. // To mark a token as not valid for supply, `msg_supply` must be set to false.