Skip to content

Commit

Permalink
Add Earn deposits value_in_staked_tokens query parameter (#1325)
Browse files Browse the repository at this point in the history
* Add earn deposits query param to return individual vaults value as ukava

* Add value_in_staked_tokens param handler to specific vault query

* Use separate ukava coins when querying deposits in ukava

Avoid usd of sdk.Coins.Add() as those will aggregate ukava amounts
  • Loading branch information
drklee3 committed Oct 4, 2022
1 parent 3d7c175 commit ad6f539
Show file tree
Hide file tree
Showing 10 changed files with 613 additions and 94 deletions.
269 changes: 269 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7077,6 +7077,12 @@ paths:
in: query
required: false
type: string
- name: value_in_staked_tokens
description: respond with vault value in ukava for bkava vaults.
in: query
required: false
type: boolean
format: boolean
- name: pagination.key
description: |-
key is a value returned in PageResponse.next_key to begin
Expand Down Expand Up @@ -10785,6 +10791,66 @@ paths:

representing the yearly APR of KAVA tokens that will be
minted during that period
infrastructure_params:
type: object
properties:
infrastructure_periods:
type: array
items:
type: object
properties:
start:
type: string
format: date-time
title: example "2020-03-01T15:20:00Z"
end:
type: string
format: date-time
title: example "2020-06-01T15:20:00Z"
inflation:
type: string
format: byte
title: example "1.000000003022265980" - 10% inflation
title: >-
Period stores the specified start and end dates, and
the inflation, expressed as a decimal

representing the yearly APR of KAVA tokens that will
be minted during that period
core_rewards:
type: array
items:
type: object
properties:
address:
type: string
format: byte
weight:
type: string
partner_rewards:
type: array
items:
type: object
properties:
address:
type: string
format: byte
rewards_per_second:
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
Coin defines a token with a denomination and an
amount.


NOTE: The amount field is an Int which
implements the custom method

signatures required by gogoproto.
title: Params governance parameters for kavadist module
description: >-
QueryParamsResponse defines the response type for querying
Expand Down Expand Up @@ -55834,6 +55900,73 @@ definitions:
time_period:
type: string
title: RateLimit parameters for rate-limiting the supply of an issued asset
kava.kavadist.v1beta1.CoreReward:
type: object
properties:
address:
type: string
format: byte
weight:
type: string
kava.kavadist.v1beta1.InfrastructureParams:
type: object
properties:
infrastructure_periods:
type: array
items:
type: object
properties:
start:
type: string
format: date-time
title: example "2020-03-01T15:20:00Z"
end:
type: string
format: date-time
title: example "2020-06-01T15:20:00Z"
inflation:
type: string
format: byte
title: example "1.000000003022265980" - 10% inflation
title: >-
Period stores the specified start and end dates, and the inflation,
expressed as a decimal

representing the yearly APR of KAVA tokens that will be minted
during that period
core_rewards:
type: array
items:
type: object
properties:
address:
type: string
format: byte
weight:
type: string
partner_rewards:
type: array
items:
type: object
properties:
address:
type: string
format: byte
rewards_per_second:
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
Coin defines a token with a denomination and an amount.


NOTE: The amount field is an Int which implements the custom
method

signatures required by gogoproto.
kava.kavadist.v1beta1.Params:
type: object
properties:
Expand Down Expand Up @@ -55863,7 +55996,84 @@ definitions:

representing the yearly APR of KAVA tokens that will be minted
during that period
infrastructure_params:
type: object
properties:
infrastructure_periods:
type: array
items:
type: object
properties:
start:
type: string
format: date-time
title: example "2020-03-01T15:20:00Z"
end:
type: string
format: date-time
title: example "2020-06-01T15:20:00Z"
inflation:
type: string
format: byte
title: example "1.000000003022265980" - 10% inflation
title: >-
Period stores the specified start and end dates, and the
inflation, expressed as a decimal

representing the yearly APR of KAVA tokens that will be minted
during that period
core_rewards:
type: array
items:
type: object
properties:
address:
type: string
format: byte
weight:
type: string
partner_rewards:
type: array
items:
type: object
properties:
address:
type: string
format: byte
rewards_per_second:
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
Coin defines a token with a denomination and an amount.


NOTE: The amount field is an Int which implements the custom
method

signatures required by gogoproto.
title: Params governance parameters for kavadist module
kava.kavadist.v1beta1.PartnerReward:
type: object
properties:
address:
type: string
format: byte
rewards_per_second:
type: object
properties:
denom:
type: string
amount:
type: string
description: |-
Coin defines a token with a denomination and an amount.

NOTE: The amount field is an Int which implements the custom method
signatures required by gogoproto.
kava.kavadist.v1beta1.Period:
type: object
properties:
Expand Down Expand Up @@ -55937,6 +56147,65 @@ definitions:

representing the yearly APR of KAVA tokens that will be minted
during that period
infrastructure_params:
type: object
properties:
infrastructure_periods:
type: array
items:
type: object
properties:
start:
type: string
format: date-time
title: example "2020-03-01T15:20:00Z"
end:
type: string
format: date-time
title: example "2020-06-01T15:20:00Z"
inflation:
type: string
format: byte
title: example "1.000000003022265980" - 10% inflation
title: >-
Period stores the specified start and end dates, and the
inflation, expressed as a decimal

representing the yearly APR of KAVA tokens that will be
minted during that period
core_rewards:
type: array
items:
type: object
properties:
address:
type: string
format: byte
weight:
type: string
partner_rewards:
type: array
items:
type: object
properties:
address:
type: string
format: byte
rewards_per_second:
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
Coin defines a token with a denomination and an amount.


NOTE: The amount field is an Int which implements the
custom method

signatures required by gogoproto.
title: Params governance parameters for kavadist module
description: >-
QueryParamsResponse defines the response type for querying x/kavadist
Expand Down
1 change: 1 addition & 0 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3089,6 +3089,7 @@ QueryDepositsRequest is the request type for the Query/Deposits RPC method.
| ----- | ---- | ----- | ----------- |
| `depositor` | [string](#string) | | depositor optionally filters deposits by depositor |
| `denom` | [string](#string) | | denom optionally filters deposits by vault denom |
| `value_in_staked_tokens` | [bool](#bool) | | respond with vault value in ukava for bkava vaults |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. |


Expand Down
5 changes: 4 additions & 1 deletion proto/kava/earn/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ message QueryDepositsRequest {
// denom optionally filters deposits by vault denom
string denom = 2;

// respond with vault value in ukava for bkava vaults
bool value_in_staked_tokens = 3;

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 3;
cosmos.base.query.v1beta1.PageRequest pagination = 4;
}

// QueryDepositsResponse is the response type for the Query/Deposits RPC method.
Expand Down
24 changes: 12 additions & 12 deletions proto/kava/kavadist/v1beta1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ option (gogoproto.goproto_getters_all) = false;

// Params governance parameters for kavadist module
message Params {
bool active = 1 [(gogoproto.moretags) = "yaml:\"active\""];
repeated Period periods = 3 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"periods\""];
bool active = 1 [(gogoproto.moretags) = "yaml:\"active\""];
repeated Period periods = 3 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"periods\""];
InfrastructureParams infrastructure_params = 4 [(gogoproto.nullable) = false];
}

message InfrastructureParams {
repeated Period infrastructure_periods = 1 [(gogoproto.castrepeated) = "Periods", (gogoproto.nullable) = false];
repeated CoreReward core_rewards = 2 [(gogoproto.castrepeated) = "CoreRewards", (gogoproto.nullable) = false];
repeated PartnerReward partner_rewards = 3 [(gogoproto.castrepeated) = "PartnerRewards", (gogoproto.nullable) = false];
option (gogoproto.goproto_stringer) = true;
repeated Period infrastructure_periods = 1 [(gogoproto.castrepeated) = "Periods", (gogoproto.nullable) = false];
repeated CoreReward core_rewards = 2 [(gogoproto.castrepeated) = "CoreRewards", (gogoproto.nullable) = false];
repeated PartnerReward partner_rewards = 3
[(gogoproto.castrepeated) = "PartnerRewards", (gogoproto.nullable) = false];
option (gogoproto.goproto_stringer) = true;
}

message CoreReward {
bytes address = 1 [
bytes address = 1 [
(cosmos_proto.scalar) = "cosmos.AddressBytes",
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"
];
Expand All @@ -35,16 +36,16 @@ message CoreReward {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
option (gogoproto.goproto_stringer) = true;
option (gogoproto.goproto_stringer) = true;
}

message PartnerReward {
bytes address = 1 [
bytes address = 1 [
(cosmos_proto.scalar) = "cosmos.AddressBytes",
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"
];
cosmos.base.v1beta1.Coin rewards_per_second = 2[(gogoproto.nullable) = false];
option (gogoproto.goproto_stringer) = true;
cosmos.base.v1beta1.Coin rewards_per_second = 2 [(gogoproto.nullable) = false];
option (gogoproto.goproto_stringer) = true;
}

// Period stores the specified start and end dates, and the inflation, expressed as a decimal
Expand All @@ -67,4 +68,3 @@ message Period {
(gogoproto.moretags) = "yaml:\"inflation\""
];
}

Loading

0 comments on commit ad6f539

Please sign in to comment.