add total supply queries for earn, savings, liquid (#1384)

* add total supply endpoint to x/liquid

* add test of x/liquid total supply query

* refactor x/savings test

* add total supply endpoint for x/savings (w/ test)

* add total supply endpoint for x/earn

* handle converting bkava to underlying staked amount

* aggregate bkava underlying values in x/earn

* aggregate underlying value of bkava in x/savings
This commit is contained in:
Robert Pirtle 2022-11-08 12:43:26 -05:00 committed by GitHub
parent 2abb2ce606
commit fcfcd36740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 2456 additions and 138 deletions

View File

@ -7199,6 +7199,67 @@ paths:
format: byte format: byte
tags: tags:
- Earn - Earn
/kava/earn/v1beta1/total_supply:
get:
summary: >-
TotalSupply returns the total sum of all coins currently locked into the
earn module.
operationId: EarnTotalSupply
responses:
'200':
description: A successful response.
schema:
type: object
properties:
height:
type: string
format: int64
title: Height is the block height at which these totals apply
result:
type: array
items:
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: Result is a list of coins supplied to earn
description: >-
TotalSupplyResponse defines the response type for the
Query/TotalSupply method.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Earn
/kava/earn/v1beta1/vaults: /kava/earn/v1beta1/vaults:
get: get:
summary: Vaults queries all vaults summary: Vaults queries all vaults
@ -10900,6 +10961,67 @@ paths:
type: string type: string
tags: tags:
- Liquid - Liquid
/kava/liquid/v1beta1/total_supply:
get:
summary: >-
TotalSupply returns the total sum of all coins currently locked into the
liquid module.
operationId: LiquidTotalSupply
responses:
'200':
description: A successful response.
schema:
type: object
properties:
height:
type: string
format: int64
title: Height is the block height at which these totals apply
result:
type: array
items:
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: Result is a list of coins supplied to liquid
description: >-
TotalSupplyResponse defines the response type for the
Query/TotalSupply method.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Liquid
/kava/pricefeed/v1beta1/markets: /kava/pricefeed/v1beta1/markets:
get: get:
summary: Markets queries all markets summary: Markets queries all markets
@ -11811,6 +11933,67 @@ paths:
format: byte format: byte
tags: tags:
- Savings - Savings
/kava/savings/v1beta1/total_supply:
get:
summary: >-
TotalSupply returns the total sum of all coins currently locked into the
savings module.
operationId: SavingsTotalSupply
responses:
'200':
description: A successful response.
schema:
type: object
properties:
height:
type: string
format: int64
title: Height is the block height at which these totals apply
result:
type: array
items:
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: Result is a list of coins supplied to savings
description: >-
TotalSupplyResponse defines the response type for the
Query/TotalSupply method.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Savings
/node_info: /node_info:
get: get:
description: Information about the connected node description: Information about the connected node
@ -55271,6 +55454,31 @@ definitions:
description: >- description: >-
QueryParamsResponse defines the response type for querying x/earn QueryParamsResponse defines the response type for querying x/earn
parameters. parameters.
kava.earn.v1beta1.QueryTotalSupplyResponse:
type: object
properties:
height:
type: string
format: int64
title: Height is the block height at which these totals apply
result:
type: array
items:
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: Result is a list of coins supplied to earn
description: >-
TotalSupplyResponse defines the response type for the Query/TotalSupply
method.
kava.earn.v1beta1.QueryVaultResponse: kava.earn.v1beta1.QueryVaultResponse:
type: object type: object
properties: properties:
@ -56832,6 +57040,31 @@ definitions:
description: >- description: >-
DelegatedBalanceResponse defines the response type for the DelegatedBalanceResponse defines the response type for the
Query/DelegatedBalance method. Query/DelegatedBalance method.
kava.liquid.v1beta1.QueryTotalSupplyResponse:
type: object
properties:
height:
type: string
format: int64
title: Height is the block height at which these totals apply
result:
type: array
items:
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: Result is a list of coins supplied to liquid
description: >-
TotalSupplyResponse defines the response type for the Query/TotalSupply
method.
kava.pricefeed.v1beta1.CurrentPriceResponse: kava.pricefeed.v1beta1.CurrentPriceResponse:
type: object type: object
properties: properties:
@ -57362,6 +57595,31 @@ definitions:
description: |- description: |-
QueryParamsResponse defines the response type for querying x/savings QueryParamsResponse defines the response type for querying x/savings
parameters. parameters.
kava.savings.v1beta1.QueryTotalSupplyResponse:
type: object
properties:
height:
type: string
format: int64
title: Height is the block height at which these totals apply
result:
type: array
items:
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: Result is a list of coins supplied to savings
description: >-
TotalSupplyResponse defines the response type for the Query/TotalSupply
method.
CheckTxResult: CheckTxResult:
type: object type: object
properties: properties:

View File

@ -205,6 +205,8 @@
- [QueryDepositsResponse](#kava.earn.v1beta1.QueryDepositsResponse) - [QueryDepositsResponse](#kava.earn.v1beta1.QueryDepositsResponse)
- [QueryParamsRequest](#kava.earn.v1beta1.QueryParamsRequest) - [QueryParamsRequest](#kava.earn.v1beta1.QueryParamsRequest)
- [QueryParamsResponse](#kava.earn.v1beta1.QueryParamsResponse) - [QueryParamsResponse](#kava.earn.v1beta1.QueryParamsResponse)
- [QueryTotalSupplyRequest](#kava.earn.v1beta1.QueryTotalSupplyRequest)
- [QueryTotalSupplyResponse](#kava.earn.v1beta1.QueryTotalSupplyResponse)
- [QueryVaultRequest](#kava.earn.v1beta1.QueryVaultRequest) - [QueryVaultRequest](#kava.earn.v1beta1.QueryVaultRequest)
- [QueryVaultResponse](#kava.earn.v1beta1.QueryVaultResponse) - [QueryVaultResponse](#kava.earn.v1beta1.QueryVaultResponse)
- [QueryVaultsRequest](#kava.earn.v1beta1.QueryVaultsRequest) - [QueryVaultsRequest](#kava.earn.v1beta1.QueryVaultsRequest)
@ -405,6 +407,8 @@
- [kava/liquid/v1beta1/query.proto](#kava/liquid/v1beta1/query.proto) - [kava/liquid/v1beta1/query.proto](#kava/liquid/v1beta1/query.proto)
- [QueryDelegatedBalanceRequest](#kava.liquid.v1beta1.QueryDelegatedBalanceRequest) - [QueryDelegatedBalanceRequest](#kava.liquid.v1beta1.QueryDelegatedBalanceRequest)
- [QueryDelegatedBalanceResponse](#kava.liquid.v1beta1.QueryDelegatedBalanceResponse) - [QueryDelegatedBalanceResponse](#kava.liquid.v1beta1.QueryDelegatedBalanceResponse)
- [QueryTotalSupplyRequest](#kava.liquid.v1beta1.QueryTotalSupplyRequest)
- [QueryTotalSupplyResponse](#kava.liquid.v1beta1.QueryTotalSupplyResponse)
- [Query](#kava.liquid.v1beta1.Query) - [Query](#kava.liquid.v1beta1.Query)
@ -474,6 +478,8 @@
- [QueryDepositsResponse](#kava.savings.v1beta1.QueryDepositsResponse) - [QueryDepositsResponse](#kava.savings.v1beta1.QueryDepositsResponse)
- [QueryParamsRequest](#kava.savings.v1beta1.QueryParamsRequest) - [QueryParamsRequest](#kava.savings.v1beta1.QueryParamsRequest)
- [QueryParamsResponse](#kava.savings.v1beta1.QueryParamsResponse) - [QueryParamsResponse](#kava.savings.v1beta1.QueryParamsResponse)
- [QueryTotalSupplyRequest](#kava.savings.v1beta1.QueryTotalSupplyRequest)
- [QueryTotalSupplyResponse](#kava.savings.v1beta1.QueryTotalSupplyResponse)
- [Query](#kava.savings.v1beta1.Query) - [Query](#kava.savings.v1beta1.Query)
@ -3149,6 +3155,32 @@ QueryParamsResponse defines the response type for querying x/earn parameters.
<a name="kava.earn.v1beta1.QueryTotalSupplyRequest"></a>
### QueryTotalSupplyRequest
QueryTotalSupplyRequest defines the request type for Query/TotalSupply method.
<a name="kava.earn.v1beta1.QueryTotalSupplyResponse"></a>
### QueryTotalSupplyResponse
TotalSupplyResponse defines the response type for the Query/TotalSupply method.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `height` | [int64](#int64) | | Height is the block height at which these totals apply |
| `result` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Result is a list of coins supplied to earn |
<a name="kava.earn.v1beta1.QueryVaultRequest"></a> <a name="kava.earn.v1beta1.QueryVaultRequest"></a>
### QueryVaultRequest ### QueryVaultRequest
@ -3241,6 +3273,7 @@ Query defines the gRPC querier service for earn module
| `Vaults` | [QueryVaultsRequest](#kava.earn.v1beta1.QueryVaultsRequest) | [QueryVaultsResponse](#kava.earn.v1beta1.QueryVaultsResponse) | Vaults queries all vaults | GET|/kava/earn/v1beta1/vaults| | `Vaults` | [QueryVaultsRequest](#kava.earn.v1beta1.QueryVaultsRequest) | [QueryVaultsResponse](#kava.earn.v1beta1.QueryVaultsResponse) | Vaults queries all vaults | GET|/kava/earn/v1beta1/vaults|
| `Vault` | [QueryVaultRequest](#kava.earn.v1beta1.QueryVaultRequest) | [QueryVaultResponse](#kava.earn.v1beta1.QueryVaultResponse) | Vault queries a single vault based on the vault denom | GET|/kava/earn/v1beta1/vaults/{denom}| | `Vault` | [QueryVaultRequest](#kava.earn.v1beta1.QueryVaultRequest) | [QueryVaultResponse](#kava.earn.v1beta1.QueryVaultResponse) | Vault queries a single vault based on the vault denom | GET|/kava/earn/v1beta1/vaults/{denom}|
| `Deposits` | [QueryDepositsRequest](#kava.earn.v1beta1.QueryDepositsRequest) | [QueryDepositsResponse](#kava.earn.v1beta1.QueryDepositsResponse) | Deposits queries deposit details based on depositor address and vault | GET|/kava/earn/v1beta1/deposits| | `Deposits` | [QueryDepositsRequest](#kava.earn.v1beta1.QueryDepositsRequest) | [QueryDepositsResponse](#kava.earn.v1beta1.QueryDepositsResponse) | Deposits queries deposit details based on depositor address and vault | GET|/kava/earn/v1beta1/deposits|
| `TotalSupply` | [QueryTotalSupplyRequest](#kava.earn.v1beta1.QueryTotalSupplyRequest) | [QueryTotalSupplyResponse](#kava.earn.v1beta1.QueryTotalSupplyResponse) | TotalSupply returns the total sum of all coins currently locked into the earn module. | GET|/kava/earn/v1beta1/total_supply|
<!-- end services --> <!-- end services -->
@ -5723,6 +5756,32 @@ DelegatedBalanceResponse defines the response type for the Query/DelegatedBalanc
<a name="kava.liquid.v1beta1.QueryTotalSupplyRequest"></a>
### QueryTotalSupplyRequest
QueryTotalSupplyRequest defines the request type for Query/TotalSupply method.
<a name="kava.liquid.v1beta1.QueryTotalSupplyResponse"></a>
### QueryTotalSupplyResponse
TotalSupplyResponse defines the response type for the Query/TotalSupply method.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `height` | [int64](#int64) | | Height is the block height at which these totals apply |
| `result` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Result is a list of coins supplied to liquid |
<!-- end messages --> <!-- end messages -->
<!-- end enums --> <!-- end enums -->
@ -5738,6 +5797,7 @@ Query defines the gRPC querier service for liquid module
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- | | ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `DelegatedBalance` | [QueryDelegatedBalanceRequest](#kava.liquid.v1beta1.QueryDelegatedBalanceRequest) | [QueryDelegatedBalanceResponse](#kava.liquid.v1beta1.QueryDelegatedBalanceResponse) | DelegatedBalance returns an account's vesting and vested coins currently delegated to validators. It ignores coins in unbonding delegations. | GET|/kava/liquid/v1beta1/delegated_balance/{delegator}| | `DelegatedBalance` | [QueryDelegatedBalanceRequest](#kava.liquid.v1beta1.QueryDelegatedBalanceRequest) | [QueryDelegatedBalanceResponse](#kava.liquid.v1beta1.QueryDelegatedBalanceResponse) | DelegatedBalance returns an account's vesting and vested coins currently delegated to validators. It ignores coins in unbonding delegations. | GET|/kava/liquid/v1beta1/delegated_balance/{delegator}|
| `TotalSupply` | [QueryTotalSupplyRequest](#kava.liquid.v1beta1.QueryTotalSupplyRequest) | [QueryTotalSupplyResponse](#kava.liquid.v1beta1.QueryTotalSupplyResponse) | TotalSupply returns the total sum of all coins currently locked into the liquid module. | GET|/kava/liquid/v1beta1/total_supply|
<!-- end services --> <!-- end services -->
@ -6544,6 +6604,32 @@ parameters.
<a name="kava.savings.v1beta1.QueryTotalSupplyRequest"></a>
### QueryTotalSupplyRequest
QueryTotalSupplyRequest defines the request type for Query/TotalSupply method.
<a name="kava.savings.v1beta1.QueryTotalSupplyResponse"></a>
### QueryTotalSupplyResponse
TotalSupplyResponse defines the response type for the Query/TotalSupply method.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `height` | [int64](#int64) | | Height is the block height at which these totals apply |
| `result` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Result is a list of coins supplied to savings |
<!-- end messages --> <!-- end messages -->
<!-- end enums --> <!-- end enums -->
@ -6560,6 +6646,7 @@ Query defines the gRPC querier service for savings module
| ----------- | ------------ | ------------- | ------------| ------- | -------- | | ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `Params` | [QueryParamsRequest](#kava.savings.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#kava.savings.v1beta1.QueryParamsResponse) | Params queries all parameters of the savings module. | GET|/kava/savings/v1beta1/params| | `Params` | [QueryParamsRequest](#kava.savings.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#kava.savings.v1beta1.QueryParamsResponse) | Params queries all parameters of the savings module. | GET|/kava/savings/v1beta1/params|
| `Deposits` | [QueryDepositsRequest](#kava.savings.v1beta1.QueryDepositsRequest) | [QueryDepositsResponse](#kava.savings.v1beta1.QueryDepositsResponse) | Deposits queries savings deposits. | GET|/kava/savings/v1beta1/deposits| | `Deposits` | [QueryDepositsRequest](#kava.savings.v1beta1.QueryDepositsRequest) | [QueryDepositsResponse](#kava.savings.v1beta1.QueryDepositsResponse) | Deposits queries savings deposits. | GET|/kava/savings/v1beta1/deposits|
| `TotalSupply` | [QueryTotalSupplyRequest](#kava.savings.v1beta1.QueryTotalSupplyRequest) | [QueryTotalSupplyResponse](#kava.savings.v1beta1.QueryTotalSupplyResponse) | TotalSupply returns the total sum of all coins currently locked into the savings module. | GET|/kava/savings/v1beta1/total_supply|
<!-- end services --> <!-- end services -->

2
go.sum
View File

@ -195,8 +195,6 @@ github.com/cosmos/cosmos-sdk/ics23/go v0.8.0/go.mod h1:2a4dBq88TUoqoWAU5eu0lGvpF
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cosmos/iavl v0.19.3 h1:cESO0OwTTxQm5rmyESKW+zESheDUYI7CcZDWWDwnuxg=
github.com/cosmos/iavl v0.19.3/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
github.com/cosmos/iavl v0.19.4 h1:t82sN+Y0WeqxDLJRSpNd8YFX5URIrT+p8n6oJbJ2Dok= github.com/cosmos/iavl v0.19.4 h1:t82sN+Y0WeqxDLJRSpNd8YFX5URIrT+p8n6oJbJ2Dok=
github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
github.com/cosmos/ibc-go/v3 v3.3.1 h1:i8o3iPSPN8fr7AjCPQnHEKz/VfeMrxc8mjvgAw6txWk= github.com/cosmos/ibc-go/v3 v3.3.1 h1:i8o3iPSPN8fr7AjCPQnHEKz/VfeMrxc8mjvgAw6txWk=

View File

@ -34,6 +34,11 @@ service Query {
rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) { rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) {
option (google.api.http).get = "/kava/earn/v1beta1/deposits"; option (google.api.http).get = "/kava/earn/v1beta1/deposits";
} }
// TotalSupply returns the total sum of all coins currently locked into the earn module.
rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) {
option (google.api.http).get = "/kava/earn/v1beta1/total_supply";
}
} }
// QueryParamsRequest defines the request type for querying x/earn parameters. // QueryParamsRequest defines the request type for querying x/earn parameters.
@ -134,3 +139,15 @@ message DepositResponse {
repeated cosmos.base.v1beta1.Coin value = 3 repeated cosmos.base.v1beta1.Coin value = 3
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false];
} }
// QueryTotalSupplyRequest defines the request type for Query/TotalSupply method.
message QueryTotalSupplyRequest {}
// TotalSupplyResponse defines the response type for the Query/TotalSupply method.
message QueryTotalSupplyResponse {
// Height is the block height at which these totals apply
int64 height = 1;
// Result is a list of coins supplied to earn
repeated cosmos.base.v1beta1.Coin result = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}

View File

@ -16,6 +16,11 @@ service Query {
rpc DelegatedBalance(QueryDelegatedBalanceRequest) returns (QueryDelegatedBalanceResponse) { rpc DelegatedBalance(QueryDelegatedBalanceRequest) returns (QueryDelegatedBalanceResponse) {
option (google.api.http).get = "/kava/liquid/v1beta1/delegated_balance/{delegator}"; option (google.api.http).get = "/kava/liquid/v1beta1/delegated_balance/{delegator}";
} }
// TotalSupply returns the total sum of all coins currently locked into the liquid module.
rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) {
option (google.api.http).get = "/kava/liquid/v1beta1/total_supply";
}
} }
// QueryDelegatedBalanceRequest defines the request type for Query/DelegatedBalance method. // QueryDelegatedBalanceRequest defines the request type for Query/DelegatedBalance method.
@ -31,3 +36,15 @@ message QueryDelegatedBalanceResponse {
// vesting is the amount of all delegated coins that are still vesting (ie locked) // vesting is the amount of all delegated coins that are still vesting (ie locked)
cosmos.base.v1beta1.Coin vesting = 2 [(gogoproto.nullable) = false]; cosmos.base.v1beta1.Coin vesting = 2 [(gogoproto.nullable) = false];
} }
// QueryTotalSupplyRequest defines the request type for Query/TotalSupply method.
message QueryTotalSupplyRequest {}
// TotalSupplyResponse defines the response type for the Query/TotalSupply method.
message QueryTotalSupplyResponse {
// Height is the block height at which these totals apply
int64 height = 1;
// Result is a list of coins supplied to liquid
repeated cosmos.base.v1beta1.Coin result = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}

View File

@ -4,6 +4,7 @@ package kava.savings.v1beta1;
import "kava/savings/v1beta1/store.proto"; import "kava/savings/v1beta1/store.proto";
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
import "google/api/annotations.proto"; import "google/api/annotations.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto"; import "cosmos_proto/cosmos.proto";
import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos/base/query/v1beta1/pagination.proto";
@ -20,6 +21,11 @@ service Query {
rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) { rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) {
option (google.api.http).get = "/kava/savings/v1beta1/deposits"; option (google.api.http).get = "/kava/savings/v1beta1/deposits";
} }
// TotalSupply returns the total sum of all coins currently locked into the savings module.
rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) {
option (google.api.http).get = "/kava/savings/v1beta1/total_supply";
}
} }
// QueryParamsRequest defines the request type for querying x/savings // QueryParamsRequest defines the request type for querying x/savings
@ -50,3 +56,15 @@ message QueryDepositsResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 2; cosmos.base.query.v1beta1.PageResponse pagination = 2;
} }
// QueryTotalSupplyRequest defines the request type for Query/TotalSupply method.
message QueryTotalSupplyRequest {}
// TotalSupplyResponse defines the response type for the Query/TotalSupply method.
message QueryTotalSupplyResponse {
// Height is the block height at which these totals apply
int64 height = 1;
// Result is a list of coins supplied to savings
repeated cosmos.base.v1beta1.Coin result = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}

View File

@ -35,6 +35,7 @@ func GetQueryCmd() *cobra.Command {
queryVaultsCmd(), queryVaultsCmd(),
queryVaultCmd(), queryVaultCmd(),
queryDepositsCmd(), queryDepositsCmd(),
queryTotalSupplyCmd(),
} }
for _, cmd := range cmds { for _, cmd := range cmds {
@ -181,3 +182,27 @@ func queryDepositsCmd() *cobra.Command {
return cmd return cmd
} }
func queryTotalSupplyCmd() *cobra.Command {
return &cobra.Command{
Use: "total-supply",
Short: "get total supply across all savings strategy vaults",
Long: "Get the sum of all denoms locking into vaults that allow the savings strategy.",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.TotalSupply(context.Background(), &types.QueryTotalSupplyRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
}

View File

@ -156,7 +156,7 @@ func (s queryServer) Vault(
} }
// Handle bkava separately to get total of **all** bkava vaults // Handle bkava separately to get total of **all** bkava vaults
if req.Denom == "bkava" { if req.Denom == bkavaDenom {
return s.getAggregateBkavaVault(sdkCtx, allowedVault) return s.getAggregateBkavaVault(sdkCtx, allowedVault)
} }
@ -198,7 +198,7 @@ func (s queryServer) getAggregateBkavaVault(
var iterErr error var iterErr error
s.keeper.IterateVaultRecords(ctx, func(record types.VaultRecord) (stop bool) { s.keeper.IterateVaultRecords(ctx, func(record types.VaultRecord) (stop bool) {
// Skip non bkava vaults // Skip non bkava vaults
if !strings.HasPrefix(record.TotalShares.Denom, "bkava") { if !strings.HasPrefix(record.TotalShares.Denom, bkavaPrefix) {
return false return false
} }
@ -224,7 +224,7 @@ func (s queryServer) getAggregateBkavaVault(
return &types.QueryVaultResponse{ return &types.QueryVaultResponse{
Vault: types.VaultResponse{ Vault: types.VaultResponse{
Denom: "bkava", Denom: bkavaDenom,
Strategies: allowedVault.Strategies, Strategies: allowedVault.Strategies,
IsPrivateVault: allowedVault.IsPrivateVault, IsPrivateVault: allowedVault.IsPrivateVault,
AllowedDepositors: addressSliceToStringSlice(allowedVault.AllowedDepositors), AllowedDepositors: addressSliceToStringSlice(allowedVault.AllowedDepositors),
@ -251,7 +251,7 @@ func (s queryServer) Deposits(
sdkCtx := sdk.UnwrapSDKContext(ctx) sdkCtx := sdk.UnwrapSDKContext(ctx)
// bkava aggregate total // bkava aggregate total
if req.Denom == "bkava" { if req.Denom == bkavaDenom {
return s.getOneAccountBkavaVaultDeposit(sdkCtx, req) return s.getOneAccountBkavaVaultDeposit(sdkCtx, req)
} }
@ -264,6 +264,78 @@ func (s queryServer) Deposits(
return s.getOneAccountAllDeposits(sdkCtx, req) return s.getOneAccountAllDeposits(sdkCtx, req)
} }
// TotalSupply implements the gRPC service handler for querying x/earn total supply (TVL)
func (s queryServer) TotalSupply(
ctx context.Context,
req *types.QueryTotalSupplyRequest,
) (*types.QueryTotalSupplyResponse, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)
totalSupply := sdk.NewCoins()
liquidStakedDerivatives := sdk.NewCoins()
// allowed vaults param contains info on allowed strategies, but bkava is aggregated
allowedVaults := s.keeper.GetAllowedVaults(sdkCtx)
allowedVaultByDenom := make(map[string]types.AllowedVault)
for _, av := range allowedVaults {
allowedVaultByDenom[av.Denom] = av
}
var vaultRecordErr error
// iterate actual records to properly enumerate all denoms
s.keeper.IterateVaultRecords(sdkCtx, func(vault types.VaultRecord) (stop bool) {
isLiquidStakingDenom := false
// find allowed vault to get parameters. handle translating bkava denoms to allowed vault denom
allowedVaultDenom := vault.TotalShares.Denom
if strings.HasPrefix(vault.TotalShares.Denom, bkavaPrefix) {
isLiquidStakingDenom = true
allowedVaultDenom = bkavaDenom
}
allowedVault, found := allowedVaultByDenom[allowedVaultDenom]
if !found {
vaultRecordErr = fmt.Errorf("vault record not found for vault record denom %s", vault.TotalShares.Denom)
return true
}
// only consider savings strategy vaults when determining supply
if !allowedVault.IsStrategyAllowed(types.STRATEGY_TYPE_SAVINGS) {
return false
}
// vault has savings strategy! determine total value of vault and add to sum
vaultSupply, err := s.keeper.GetVaultTotalValue(sdkCtx, vault.TotalShares.Denom)
if err != nil {
vaultRecordErr = err
return true
}
// liquid staked tokens must be converted to their underlying value
// aggregate them here and then we can convert to underlying values all at once at the end
if isLiquidStakingDenom {
liquidStakedDerivatives = liquidStakedDerivatives.Add(vaultSupply)
} else {
totalSupply = totalSupply.Add(vaultSupply)
}
return false
})
// determine underlying value of bkava denoms
if len(liquidStakedDerivatives) > 0 {
underlyingValue, err := s.keeper.liquidKeeper.GetStakedTokensForDerivatives(
sdkCtx,
liquidStakedDerivatives,
)
if err != nil {
return nil, err
}
totalSupply = totalSupply.Add(sdk.NewCoin(bkavaDenom, underlyingValue.Amount))
}
return &types.QueryTotalSupplyResponse{
Height: sdkCtx.BlockHeight(),
Result: totalSupply,
}, vaultRecordErr
}
// getOneAccountOneVaultDeposit returns deposits for a specific vault and a specific // getOneAccountOneVaultDeposit returns deposits for a specific vault and a specific
// account // account
func (s queryServer) getOneAccountOneVaultDeposit( func (s queryServer) getOneAccountOneVaultDeposit(

View File

@ -689,6 +689,146 @@ func (suite *grpcQueryTestSuite) TestVault_bKava_Aggregate() {
) )
} }
func (suite *grpcQueryTestSuite) TestTotalSupply() {
deposit := func(addr sdk.AccAddress, denom string, amount int64) {
err := suite.Keeper.Deposit(
suite.Ctx,
addr,
sdk.NewInt64Coin(denom, amount),
types.STRATEGY_TYPE_SAVINGS,
)
suite.Require().NoError(err)
}
testCases := []struct {
name string
setup func()
expectedSupply sdk.Coins
}{
{
name: "no vaults mean no supply",
setup: func() {},
expectedSupply: nil,
},
{
name: "no savings vaults mean no supply",
setup: func() {
suite.CreateVault("usdx", types.StrategyTypes{types.STRATEGY_TYPE_HARD}, false, nil)
suite.CreateVault("busd", types.StrategyTypes{types.STRATEGY_TYPE_HARD}, false, nil)
},
expectedSupply: nil,
},
{
name: "empty savings vaults mean no supply",
setup: func() {
suite.CreateVault("usdx", types.StrategyTypes{types.STRATEGY_TYPE_SAVINGS}, false, nil)
suite.CreateVault("busd", types.StrategyTypes{types.STRATEGY_TYPE_SAVINGS}, false, nil)
},
expectedSupply: nil,
},
{
name: "calculates supply of savings vaults",
setup: func() {
vault1Denom := "usdx"
vault2Denom := "busd"
suite.CreateVault(vault1Denom, types.StrategyTypes{types.STRATEGY_TYPE_SAVINGS}, false, nil)
suite.CreateVault(vault2Denom, types.StrategyTypes{types.STRATEGY_TYPE_SAVINGS}, false, nil)
acc1 := suite.CreateAccount(sdk.NewCoins(
sdk.NewInt64Coin(vault1Denom, 1e6),
sdk.NewInt64Coin(vault2Denom, 1e6),
), 0)
deposit(acc1.GetAddress(), vault1Denom, 1e5)
deposit(acc1.GetAddress(), vault2Denom, 1e5)
acc2 := suite.CreateAccount(sdk.NewCoins(
sdk.NewInt64Coin(vault1Denom, 1e6),
sdk.NewInt64Coin(vault2Denom, 1e6),
), 0)
deposit(acc2.GetAddress(), vault1Denom, 2e5)
deposit(acc2.GetAddress(), vault2Denom, 2e5)
},
expectedSupply: sdk.NewCoins(
sdk.NewInt64Coin("usdx", 3e5),
sdk.NewInt64Coin("busd", 3e5),
),
},
{
name: "calculates supply of savings vaults, even when private",
setup: func() {
vault1Denom := "ukava"
vault2Denom := "busd"
acc1 := suite.CreateAccount(sdk.NewCoins(
sdk.NewInt64Coin(vault1Denom, 1e6),
sdk.NewInt64Coin(vault2Denom, 1e6),
), 0)
acc2 := suite.CreateAccount(sdk.NewCoins(
sdk.NewInt64Coin(vault1Denom, 1e6),
sdk.NewInt64Coin(vault2Denom, 1e6),
), 0)
suite.CreateVault(
vault1Denom,
types.StrategyTypes{types.STRATEGY_TYPE_SAVINGS},
true, // private!
[]sdk.AccAddress{acc1.GetAddress()}, // only acc1 can deposit.
)
suite.CreateVault("busd",
types.StrategyTypes{types.STRATEGY_TYPE_SAVINGS},
false,
nil,
)
deposit(acc1.GetAddress(), vault1Denom, 1e5)
deposit(acc1.GetAddress(), vault2Denom, 1e5)
deposit(acc2.GetAddress(), vault2Denom, 2e5)
},
expectedSupply: sdk.NewCoins(
sdk.NewInt64Coin("ukava", 1e5),
sdk.NewInt64Coin("busd", 3e5),
),
},
{
name: "aggregates supply of bkava vaults accounting for slashing",
setup: func() {
address1, derivatives1, _ := suite.createAccountWithDerivatives(testutil.TestBkavaDenoms[0], sdk.NewInt(1e9))
address2, derivatives2, _ := suite.createAccountWithDerivatives(testutil.TestBkavaDenoms[1], sdk.NewInt(1e9))
// bond validators
staking.EndBlocker(suite.Ctx, suite.App.GetStakingKeeper())
// slash val2 - its shares are now 80% as valuable!
err := suite.slashValidator(sdk.ValAddress(address2), sdk.MustNewDecFromStr("0.2"))
suite.Require().NoError(err)
// create "bkava" vault. it holds all bkava denoms
suite.CreateVault("bkava", types.StrategyTypes{types.STRATEGY_TYPE_SAVINGS}, false, []sdk.AccAddress{})
// deposit bkava
deposit(address1, testutil.TestBkavaDenoms[0], derivatives1.Amount.Int64())
deposit(address2, testutil.TestBkavaDenoms[1], derivatives2.Amount.Int64())
},
expectedSupply: sdk.NewCoins(
sdk.NewCoin(
"bkava",
sdk.NewIntFromUint64(1e9). // derivative 1
Add(sdk.NewInt(1e9).MulRaw(80).QuoRaw(100))), // derivative 2: original value * 80%
),
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
tc.setup()
res, err := suite.queryClient.TotalSupply(
sdk.WrapSDKContext(suite.Ctx),
&types.QueryTotalSupplyRequest{},
)
suite.Require().NoError(err)
suite.Require().Equal(tc.expectedSupply, res.Result)
})
}
}
// createUnbondedValidator creates an unbonded validator with the given amount of self-delegation. // createUnbondedValidator creates an unbonded validator with the given amount of self-delegation.
func (suite *grpcQueryTestSuite) createUnbondedValidator(address sdk.ValAddress, selfDelegation sdk.Coin, minSelfDelegation sdk.Int) error { func (suite *grpcQueryTestSuite) createUnbondedValidator(address sdk.ValAddress, selfDelegation sdk.Coin, minSelfDelegation sdk.Int) error {
msg, err := stakingtypes.NewMsgCreateValidator( msg, err := stakingtypes.NewMsgCreateValidator(

View File

@ -155,6 +155,8 @@ func (suite *Suite) SetupTest() {
savingstypes.NewParams( savingstypes.NewParams(
[]string{ []string{
"ukava", "ukava",
"busd",
"usdx",
TestBkavaDenoms[0], TestBkavaDenoms[0],
TestBkavaDenoms[1], TestBkavaDenoms[1],
TestBkavaDenoms[2], TestBkavaDenoms[2],

View File

@ -448,6 +448,84 @@ func (m *DepositResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_DepositResponse proto.InternalMessageInfo var xxx_messageInfo_DepositResponse proto.InternalMessageInfo
// QueryTotalSupplyRequest defines the request type for Query/TotalSupply method.
type QueryTotalSupplyRequest struct {
}
func (m *QueryTotalSupplyRequest) Reset() { *m = QueryTotalSupplyRequest{} }
func (m *QueryTotalSupplyRequest) String() string { return proto.CompactTextString(m) }
func (*QueryTotalSupplyRequest) ProtoMessage() {}
func (*QueryTotalSupplyRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_63f8dee2f3192a6b, []int{10}
}
func (m *QueryTotalSupplyRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryTotalSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryTotalSupplyRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryTotalSupplyRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryTotalSupplyRequest.Merge(m, src)
}
func (m *QueryTotalSupplyRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryTotalSupplyRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryTotalSupplyRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo
// TotalSupplyResponse defines the response type for the Query/TotalSupply method.
type QueryTotalSupplyResponse struct {
// Height is the block height at which these totals apply
Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
// Result is a list of coins supplied to earn
Result github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=result,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"result"`
}
func (m *QueryTotalSupplyResponse) Reset() { *m = QueryTotalSupplyResponse{} }
func (m *QueryTotalSupplyResponse) String() string { return proto.CompactTextString(m) }
func (*QueryTotalSupplyResponse) ProtoMessage() {}
func (*QueryTotalSupplyResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_63f8dee2f3192a6b, []int{11}
}
func (m *QueryTotalSupplyResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryTotalSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryTotalSupplyResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryTotalSupplyResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryTotalSupplyResponse.Merge(m, src)
}
func (m *QueryTotalSupplyResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryTotalSupplyResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryTotalSupplyResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryTotalSupplyResponse proto.InternalMessageInfo
func init() { func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "kava.earn.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsRequest)(nil), "kava.earn.v1beta1.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "kava.earn.v1beta1.QueryParamsResponse") proto.RegisterType((*QueryParamsResponse)(nil), "kava.earn.v1beta1.QueryParamsResponse")
@ -459,68 +537,75 @@ func init() {
proto.RegisterType((*QueryDepositsRequest)(nil), "kava.earn.v1beta1.QueryDepositsRequest") proto.RegisterType((*QueryDepositsRequest)(nil), "kava.earn.v1beta1.QueryDepositsRequest")
proto.RegisterType((*QueryDepositsResponse)(nil), "kava.earn.v1beta1.QueryDepositsResponse") proto.RegisterType((*QueryDepositsResponse)(nil), "kava.earn.v1beta1.QueryDepositsResponse")
proto.RegisterType((*DepositResponse)(nil), "kava.earn.v1beta1.DepositResponse") proto.RegisterType((*DepositResponse)(nil), "kava.earn.v1beta1.DepositResponse")
proto.RegisterType((*QueryTotalSupplyRequest)(nil), "kava.earn.v1beta1.QueryTotalSupplyRequest")
proto.RegisterType((*QueryTotalSupplyResponse)(nil), "kava.earn.v1beta1.QueryTotalSupplyResponse")
} }
func init() { proto.RegisterFile("kava/earn/v1beta1/query.proto", fileDescriptor_63f8dee2f3192a6b) } func init() { proto.RegisterFile("kava/earn/v1beta1/query.proto", fileDescriptor_63f8dee2f3192a6b) }
var fileDescriptor_63f8dee2f3192a6b = []byte{ var fileDescriptor_63f8dee2f3192a6b = []byte{
// 883 bytes of a gzipped FileDescriptorProto // 969 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4b, 0x6f, 0xeb, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
0x14, 0x8e, 0xf3, 0x52, 0x3b, 0xe1, 0x5e, 0xc8, 0x34, 0xa0, 0x24, 0x97, 0x3a, 0xa9, 0x2f, 0xb7, 0x14, 0xf7, 0xda, 0xb1, 0x95, 0x3c, 0xd3, 0x42, 0x26, 0xa6, 0xd8, 0x2e, 0x59, 0x3b, 0x5b, 0x9a,
0xd7, 0x45, 0x8a, 0x4d, 0x53, 0x09, 0x36, 0x15, 0x12, 0xa1, 0xa2, 0x2a, 0x0b, 0x54, 0x9c, 0xd2, 0xb8, 0x45, 0xd9, 0xa5, 0xa9, 0x04, 0x97, 0x0a, 0x09, 0x13, 0x51, 0x85, 0x03, 0x2a, 0x9b, 0xd0,
0x05, 0x12, 0xb2, 0x26, 0xcd, 0xc8, 0xb5, 0x92, 0x78, 0x52, 0xcf, 0x24, 0x50, 0x10, 0x42, 0xaa, 0x03, 0x12, 0xb2, 0xc6, 0xf1, 0x68, 0xb3, 0x8a, 0xb3, 0xb3, 0xdd, 0x19, 0x1b, 0x02, 0x42, 0x48,
0xc4, 0x1e, 0x89, 0xff, 0xc0, 0xa2, 0xeb, 0xfe, 0x88, 0x2e, 0xab, 0xb2, 0x41, 0x2c, 0x5a, 0xda, 0xfd, 0x02, 0x20, 0x71, 0xe8, 0x37, 0xe0, 0xd0, 0x73, 0x3f, 0x44, 0x8e, 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67, 0xfe, 0x38, 0xb5, 0x33, 0x5f, 0x8f, 0xae, 0x0d, 0x05, 0xb4, 0xde, 0xa5, 0x6d, 0x61, 0x20,
0xbf, 0x33, 0xa0, 0xba, 0xda, 0xdb, 0x05, 0xfd, 0x33, 0xe7, 0xee, 0x7f, 0x01, 0x00, 0x00, 0xff,
0xff, 0x8a, 0x93, 0xec, 0x8f, 0x16, 0x0a, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -543,6 +628,8 @@ type QueryClient interface {
Vault(ctx context.Context, in *QueryVaultRequest, opts ...grpc.CallOption) (*QueryVaultResponse, error) Vault(ctx context.Context, in *QueryVaultRequest, opts ...grpc.CallOption) (*QueryVaultResponse, error)
// Deposits queries deposit details based on depositor address and vault // Deposits queries deposit details based on depositor address and vault
Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error)
// TotalSupply returns the total sum of all coins currently locked into the earn module.
TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error)
} }
type queryClient struct { type queryClient struct {
@ -589,6 +676,15 @@ func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, op
return out, nil return out, nil
} }
func (c *queryClient) TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) {
out := new(QueryTotalSupplyResponse)
err := c.cc.Invoke(ctx, "/kava.earn.v1beta1.Query/TotalSupply", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service. // QueryServer is the server API for Query service.
type QueryServer interface { type QueryServer interface {
// Params queries all parameters of the earn module. // Params queries all parameters of the earn module.
@ -599,6 +695,8 @@ type QueryServer interface {
Vault(context.Context, *QueryVaultRequest) (*QueryVaultResponse, error) Vault(context.Context, *QueryVaultRequest) (*QueryVaultResponse, error)
// Deposits queries deposit details based on depositor address and vault // Deposits queries deposit details based on depositor address and vault
Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error)
// TotalSupply returns the total sum of all coins currently locked into the earn module.
TotalSupply(context.Context, *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error)
} }
// UnimplementedQueryServer can be embedded to have forward compatible implementations. // UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -617,6 +715,9 @@ func (*UnimplementedQueryServer) Vault(ctx context.Context, req *QueryVaultReque
func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) { func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented") return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented")
} }
func (*UnimplementedQueryServer) TotalSupply(ctx context.Context, req *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method TotalSupply not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) { func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv) s.RegisterService(&_Query_serviceDesc, srv)
@ -694,6 +795,24 @@ func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryTotalSupplyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).TotalSupply(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/kava.earn.v1beta1.Query/TotalSupply",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).TotalSupply(ctx, req.(*QueryTotalSupplyRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{ var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "kava.earn.v1beta1.Query", ServiceName: "kava.earn.v1beta1.Query",
HandlerType: (*QueryServer)(nil), HandlerType: (*QueryServer)(nil),
@ -714,6 +833,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "Deposits", MethodName: "Deposits",
Handler: _Query_Deposits_Handler, Handler: _Query_Deposits_Handler,
}, },
{
MethodName: "TotalSupply",
Handler: _Query_TotalSupply_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "kava/earn/v1beta1/query.proto", Metadata: "kava/earn/v1beta1/query.proto",
@ -1148,6 +1271,71 @@ func (m *DepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *QueryTotalSupplyRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryTotalSupplyRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryTotalSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryTotalSupplyResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryTotalSupplyResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryTotalSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Result) > 0 {
for iNdEx := len(m.Result) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Result[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if m.Height != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v) offset -= sovQuery(v)
base := offset base := offset
@ -1330,6 +1518,33 @@ func (m *DepositResponse) Size() (n int) {
return n return n
} }
func (m *QueryTotalSupplyRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryTotalSupplyResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Height != 0 {
n += 1 + sovQuery(uint64(m.Height))
}
if len(m.Result) > 0 {
for _, e := range m.Result {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func sovQuery(x uint64) (n int) { func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -2477,6 +2692,159 @@ func (m *DepositResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *QueryTotalSupplyRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryTotalSupplyRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryTotalSupplyRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryTotalSupplyResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryTotalSupplyResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryTotalSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.Height = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Result = append(m.Result, types.Coin{})
if err := m.Result[len(m.Result)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) { func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

View File

@ -159,6 +159,24 @@ func local_request_Query_Deposits_0(ctx context.Context, marshaler runtime.Marsh
} }
func request_Query_TotalSupply_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryTotalSupplyRequest
var metadata runtime.ServerMetadata
msg, err := client.TotalSupply(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_TotalSupply_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryTotalSupplyRequest
var metadata runtime.ServerMetadata
msg, err := server.TotalSupply(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly. // UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -257,6 +275,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}) })
mux.Handle("GET", pattern_Query_TotalSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_TotalSupply_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_TotalSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -378,6 +419,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}) })
mux.Handle("GET", pattern_Query_TotalSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_TotalSupply_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_TotalSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -389,6 +450,8 @@ var (
pattern_Query_Vault_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"kava", "earn", "v1beta1", "vaults", "denom"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Vault_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"kava", "earn", "v1beta1", "vaults", "denom"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Deposits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "earn", "v1beta1", "deposits"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Deposits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "earn", "v1beta1", "deposits"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_TotalSupply_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "earn", "v1beta1", "total_supply"}, "", runtime.AssumeColonVerbOpt(false)))
) )
var ( var (
@ -399,4 +462,6 @@ var (
forward_Query_Vault_0 = runtime.ForwardResponseMessage forward_Query_Vault_0 = runtime.ForwardResponseMessage
forward_Query_Deposits_0 = runtime.ForwardResponseMessage forward_Query_Deposits_0 = runtime.ForwardResponseMessage
forward_Query_TotalSupply_0 = runtime.ForwardResponseMessage
) )

View File

@ -50,6 +50,23 @@ func (s queryServer) DelegatedBalance(
return &res, nil return &res, nil
} }
func (s queryServer) TotalSupply(
goCtx context.Context,
req *types.QueryTotalSupplyRequest,
) (*types.QueryTotalSupplyResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
totalValue, err := s.keeper.GetTotalDerivativeValue(ctx)
if err != nil {
return nil, err
}
return &types.QueryTotalSupplyResponse{
Height: ctx.BlockHeight(),
Result: []sdk.Coin{totalValue},
}, nil
}
func (s queryServer) getDelegatedBalance(ctx sdk.Context, delegator sdk.AccAddress) sdk.Int { func (s queryServer) getDelegatedBalance(ctx sdk.Context, delegator sdk.AccAddress) sdk.Int {
balance := sdk.ZeroDec() balance := sdk.ZeroDec()

View File

@ -166,3 +166,126 @@ func (suite *grpcQueryTestSuite) TestQueryDelegatedBalance() {
}) })
} }
} }
func (suite *grpcQueryTestSuite) TestQueryTotalSupply() {
testCases := []struct {
name string
setup func()
expectedTotal sdk.Int
expectedErr error
}{
{
name: "no liquid kava means no tvl",
setup: func() {},
expectedTotal: sdk.ZeroInt(),
expectedErr: nil,
},
{
name: "returns TVL from one bkava denom",
setup: func() {
initBalance := suite.NewBondCoin(i(1e9))
valAcc := suite.CreateAccount(sdk.NewCoins(initBalance), 0)
delAcc := suite.CreateAccount(sdk.NewCoins(initBalance), 1)
suite.CreateNewUnbondedValidator(valAcc.GetAddress().Bytes(), initBalance.Amount)
suite.CreateDelegation(valAcc.GetAddress().Bytes(), delAcc.GetAddress(), initBalance.Amount)
staking.EndBlocker(suite.Ctx, suite.StakingKeeper) // bond the validator
_, err := suite.Keeper.MintDerivative(
suite.Ctx,
delAcc.GetAddress(),
valAcc.GetAddress().Bytes(),
initBalance,
)
suite.Require().NoError(err)
},
expectedTotal: i(1e9),
expectedErr: nil,
},
{
name: "returns TVL from multiple bkava denoms",
setup: func() {
initBalance := suite.NewBondCoin(i(1e9))
val1Acc := suite.CreateAccount(sdk.NewCoins(initBalance), 0)
val2Acc := suite.CreateAccount(sdk.NewCoins(initBalance), 1)
delAcc := suite.CreateAccount(sdk.NewCoins(initBalance.Add(initBalance)), 2)
suite.CreateNewUnbondedValidator(val1Acc.GetAddress().Bytes(), initBalance.Amount)
suite.CreateDelegation(val1Acc.GetAddress().Bytes(), delAcc.GetAddress(), initBalance.Amount)
suite.CreateNewUnbondedValidator(val2Acc.GetAddress().Bytes(), initBalance.Amount)
suite.CreateDelegation(val2Acc.GetAddress().Bytes(), delAcc.GetAddress(), initBalance.Amount)
staking.EndBlocker(suite.Ctx, suite.StakingKeeper) // bond the validator
_, err := suite.Keeper.MintDerivative(suite.Ctx, delAcc.GetAddress(), val1Acc.GetAddress().Bytes(), initBalance)
suite.Require().NoError(err)
_, err = suite.Keeper.MintDerivative(suite.Ctx, delAcc.GetAddress(), val2Acc.GetAddress().Bytes(), initBalance)
suite.Require().NoError(err)
},
expectedTotal: i(2e9),
expectedErr: nil,
},
{
name: "returns TVL from multiple delegators",
setup: func() {
initBalance := suite.NewBondCoin(i(1e9))
valAcc := suite.CreateAccount(sdk.NewCoins(initBalance), 0)
del1Acc := suite.CreateAccount(sdk.NewCoins(initBalance), 1)
del2Acc := suite.CreateAccount(sdk.NewCoins(initBalance), 2)
suite.CreateNewUnbondedValidator(valAcc.GetAddress().Bytes(), initBalance.Amount)
suite.CreateDelegation(valAcc.GetAddress().Bytes(), del1Acc.GetAddress(), initBalance.Amount)
suite.CreateDelegation(valAcc.GetAddress().Bytes(), del2Acc.GetAddress(), initBalance.Amount)
staking.EndBlocker(suite.Ctx, suite.StakingKeeper) // bond the validator
_, err := suite.Keeper.MintDerivative(suite.Ctx, del1Acc.GetAddress(), valAcc.GetAddress().Bytes(), initBalance)
suite.Require().NoError(err)
_, err = suite.Keeper.MintDerivative(suite.Ctx, del2Acc.GetAddress(), valAcc.GetAddress().Bytes(), initBalance)
suite.Require().NoError(err)
},
expectedTotal: i(2e9),
expectedErr: nil,
},
{
name: "handles calculating tvl after slashing",
setup: func() {
initBalance := suite.NewBondCoin(i(1e9))
val1Acc := suite.CreateAccount(sdk.NewCoins(initBalance), 0)
val2Acc := suite.CreateAccount(sdk.NewCoins(initBalance), 1)
delAcc := suite.CreateAccount(sdk.NewCoins(initBalance.Add(initBalance)), 2)
suite.CreateNewUnbondedValidator(val1Acc.GetAddress().Bytes(), initBalance.Amount)
suite.CreateDelegation(val1Acc.GetAddress().Bytes(), delAcc.GetAddress(), initBalance.Amount)
suite.CreateNewUnbondedValidator(val2Acc.GetAddress().Bytes(), initBalance.Amount)
suite.CreateDelegation(val2Acc.GetAddress().Bytes(), delAcc.GetAddress(), initBalance.Amount)
staking.EndBlocker(suite.Ctx, suite.StakingKeeper) // bond the validator
_, err := suite.Keeper.MintDerivative(suite.Ctx, delAcc.GetAddress(), val1Acc.GetAddress().Bytes(), initBalance)
suite.Require().NoError(err)
_, err = suite.Keeper.MintDerivative(suite.Ctx, delAcc.GetAddress(), val2Acc.GetAddress().Bytes(), initBalance)
suite.Require().NoError(err)
suite.SlashValidator(val2Acc.GetAddress().Bytes(), d("0.1"))
},
// delegation + (delegation * 90%)
expectedTotal: i(1e9).Add(i(1e9).MulRaw(90).QuoRaw(100)),
expectedErr: nil,
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
tc.setup()
res, err := suite.queryClient.TotalSupply(
context.Background(),
&types.QueryTotalSupplyRequest{},
)
suite.ErrorIs(err, tc.expectedErr)
if err == nil {
suite.Equal(tc.expectedTotal, res.Result[0].Amount)
}
})
}
}

View File

@ -7,6 +7,7 @@ import (
context "context" context "context"
fmt "fmt" fmt "fmt"
_ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-proto"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc" grpc1 "github.com/gogo/protobuf/grpc"
@ -111,40 +112,127 @@ func (m *QueryDelegatedBalanceResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryDelegatedBalanceResponse proto.InternalMessageInfo var xxx_messageInfo_QueryDelegatedBalanceResponse proto.InternalMessageInfo
// QueryTotalSupplyRequest defines the request type for Query/TotalSupply method.
type QueryTotalSupplyRequest struct {
}
func (m *QueryTotalSupplyRequest) Reset() { *m = QueryTotalSupplyRequest{} }
func (m *QueryTotalSupplyRequest) String() string { return proto.CompactTextString(m) }
func (*QueryTotalSupplyRequest) ProtoMessage() {}
func (*QueryTotalSupplyRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_0d745428489be444, []int{2}
}
func (m *QueryTotalSupplyRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryTotalSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryTotalSupplyRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryTotalSupplyRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryTotalSupplyRequest.Merge(m, src)
}
func (m *QueryTotalSupplyRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryTotalSupplyRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryTotalSupplyRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo
// TotalSupplyResponse defines the response type for the Query/TotalSupply method.
type QueryTotalSupplyResponse struct {
// Height is the block height at which these totals apply
Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
// Result is a list of coins supplied to liquid
Result github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=result,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"result"`
}
func (m *QueryTotalSupplyResponse) Reset() { *m = QueryTotalSupplyResponse{} }
func (m *QueryTotalSupplyResponse) String() string { return proto.CompactTextString(m) }
func (*QueryTotalSupplyResponse) ProtoMessage() {}
func (*QueryTotalSupplyResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_0d745428489be444, []int{3}
}
func (m *QueryTotalSupplyResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryTotalSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryTotalSupplyResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryTotalSupplyResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryTotalSupplyResponse.Merge(m, src)
}
func (m *QueryTotalSupplyResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryTotalSupplyResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryTotalSupplyResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryTotalSupplyResponse proto.InternalMessageInfo
func init() { func init() {
proto.RegisterType((*QueryDelegatedBalanceRequest)(nil), "kava.liquid.v1beta1.QueryDelegatedBalanceRequest") proto.RegisterType((*QueryDelegatedBalanceRequest)(nil), "kava.liquid.v1beta1.QueryDelegatedBalanceRequest")
proto.RegisterType((*QueryDelegatedBalanceResponse)(nil), "kava.liquid.v1beta1.QueryDelegatedBalanceResponse") proto.RegisterType((*QueryDelegatedBalanceResponse)(nil), "kava.liquid.v1beta1.QueryDelegatedBalanceResponse")
proto.RegisterType((*QueryTotalSupplyRequest)(nil), "kava.liquid.v1beta1.QueryTotalSupplyRequest")
proto.RegisterType((*QueryTotalSupplyResponse)(nil), "kava.liquid.v1beta1.QueryTotalSupplyResponse")
} }
func init() { proto.RegisterFile("kava/liquid/v1beta1/query.proto", fileDescriptor_0d745428489be444) } func init() { proto.RegisterFile("kava/liquid/v1beta1/query.proto", fileDescriptor_0d745428489be444) }
var fileDescriptor_0d745428489be444 = []byte{ var fileDescriptor_0d745428489be444 = []byte{
// 389 bytes of a gzipped FileDescriptorProto // 498 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x3d, 0x6f, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff,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0x62, 0x47, 0x10, 0x3e, 0x78,
0x51, 0xa5, 0x02, 0x00, 0x00, 0xf3, 0xe5, 0xf7, 0x7e, 0xe3, 0x0e, 0xea, 0xe1, 0x65, 0xcf, 0x3a, 0x5b, 0xc8, 0x06, 0x89, 0xd5,
0xe1, 0x57, 0x87, 0x6f, 0xe1, 0x35, 0x7a, 0x07, 0xe0, 0xda, 0x91, 0xb1, 0xa2, 0x9b, 0x27, 0x9f,
0x7f, 0xbc, 0x99, 0x56, 0xe7, 0x8c, 0x6c, 0x17, 0xf4, 0x86, 0x09, 0x7a, 0x1d, 0x5d, 0x5b, 0x1a,
0x54, 0xd7, 0x8a, 0x81, 0x32, 0x92, 0xfe, 0x93, 0xe9, 0xaf, 0xc0, 0x9b, 0xce, 0x02, 0x70, 0x30,
0x0b, 0xc0, 0xcf, 0x59, 0x00, 0xde, 0xce, 0x03, 0xef, 0x60, 0x1e, 0x78, 0xdf, 0xe6, 0x81, 0xf7,
0xe2, 0x68, 0x53, 0xb5, 0x55, 0x27, 0x27, 0x89, 0xb2, 0xa6, 0x2f, 0x17, 0xb6, 0xa6, 0xaf, 0xa4,
0x69, 0xfe, 0xa5, 0xdb, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x15, 0x79, 0xc0, 0xf2, 0x03,
0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -162,6 +250,8 @@ type QueryClient interface {
// DelegatedBalance returns an account's vesting and vested coins currently delegated to validators. // DelegatedBalance returns an account's vesting and vested coins currently delegated to validators.
// It ignores coins in unbonding delegations. // It ignores coins in unbonding delegations.
DelegatedBalance(ctx context.Context, in *QueryDelegatedBalanceRequest, opts ...grpc.CallOption) (*QueryDelegatedBalanceResponse, error) DelegatedBalance(ctx context.Context, in *QueryDelegatedBalanceRequest, opts ...grpc.CallOption) (*QueryDelegatedBalanceResponse, error)
// TotalSupply returns the total sum of all coins currently locked into the liquid module.
TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error)
} }
type queryClient struct { type queryClient struct {
@ -181,11 +271,22 @@ func (c *queryClient) DelegatedBalance(ctx context.Context, in *QueryDelegatedBa
return out, nil return out, nil
} }
func (c *queryClient) TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) {
out := new(QueryTotalSupplyResponse)
err := c.cc.Invoke(ctx, "/kava.liquid.v1beta1.Query/TotalSupply", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service. // QueryServer is the server API for Query service.
type QueryServer interface { type QueryServer interface {
// DelegatedBalance returns an account's vesting and vested coins currently delegated to validators. // DelegatedBalance returns an account's vesting and vested coins currently delegated to validators.
// It ignores coins in unbonding delegations. // It ignores coins in unbonding delegations.
DelegatedBalance(context.Context, *QueryDelegatedBalanceRequest) (*QueryDelegatedBalanceResponse, error) DelegatedBalance(context.Context, *QueryDelegatedBalanceRequest) (*QueryDelegatedBalanceResponse, error)
// TotalSupply returns the total sum of all coins currently locked into the liquid module.
TotalSupply(context.Context, *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error)
} }
// UnimplementedQueryServer can be embedded to have forward compatible implementations. // UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -195,6 +296,9 @@ type UnimplementedQueryServer struct {
func (*UnimplementedQueryServer) DelegatedBalance(ctx context.Context, req *QueryDelegatedBalanceRequest) (*QueryDelegatedBalanceResponse, error) { func (*UnimplementedQueryServer) DelegatedBalance(ctx context.Context, req *QueryDelegatedBalanceRequest) (*QueryDelegatedBalanceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DelegatedBalance not implemented") return nil, status.Errorf(codes.Unimplemented, "method DelegatedBalance not implemented")
} }
func (*UnimplementedQueryServer) TotalSupply(ctx context.Context, req *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method TotalSupply not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) { func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv) s.RegisterService(&_Query_serviceDesc, srv)
@ -218,6 +322,24 @@ func _Query_DelegatedBalance_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryTotalSupplyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).TotalSupply(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/kava.liquid.v1beta1.Query/TotalSupply",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).TotalSupply(ctx, req.(*QueryTotalSupplyRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{ var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "kava.liquid.v1beta1.Query", ServiceName: "kava.liquid.v1beta1.Query",
HandlerType: (*QueryServer)(nil), HandlerType: (*QueryServer)(nil),
@ -226,6 +348,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "DelegatedBalance", MethodName: "DelegatedBalance",
Handler: _Query_DelegatedBalance_Handler, Handler: _Query_DelegatedBalance_Handler,
}, },
{
MethodName: "TotalSupply",
Handler: _Query_TotalSupply_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "kava/liquid/v1beta1/query.proto", Metadata: "kava/liquid/v1beta1/query.proto",
@ -304,6 +430,71 @@ func (m *QueryDelegatedBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int,
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *QueryTotalSupplyRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryTotalSupplyRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryTotalSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryTotalSupplyResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryTotalSupplyResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryTotalSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Result) > 0 {
for iNdEx := len(m.Result) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Result[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if m.Height != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v) offset -= sovQuery(v)
base := offset base := offset
@ -341,6 +532,33 @@ func (m *QueryDelegatedBalanceResponse) Size() (n int) {
return n return n
} }
func (m *QueryTotalSupplyRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryTotalSupplyResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Height != 0 {
n += 1 + sovQuery(uint64(m.Height))
}
if len(m.Result) > 0 {
for _, e := range m.Result {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func sovQuery(x uint64) (n int) { func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -545,6 +763,159 @@ func (m *QueryDelegatedBalanceResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *QueryTotalSupplyRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryTotalSupplyRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryTotalSupplyRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryTotalSupplyResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryTotalSupplyResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryTotalSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.Height = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Result = append(m.Result, types.Coin{})
if err := m.Result[len(m.Result)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) { func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

View File

@ -87,6 +87,24 @@ func local_request_Query_DelegatedBalance_0(ctx context.Context, marshaler runti
} }
func request_Query_TotalSupply_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryTotalSupplyRequest
var metadata runtime.ServerMetadata
msg, err := client.TotalSupply(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_TotalSupply_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryTotalSupplyRequest
var metadata runtime.ServerMetadata
msg, err := server.TotalSupply(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly. // UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -116,6 +134,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}) })
mux.Handle("GET", pattern_Query_TotalSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_TotalSupply_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_TotalSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -177,13 +218,37 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}) })
mux.Handle("GET", pattern_Query_TotalSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_TotalSupply_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_TotalSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
var ( var (
pattern_Query_DelegatedBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"kava", "liquid", "v1beta1", "delegated_balance", "delegator"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_DelegatedBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"kava", "liquid", "v1beta1", "delegated_balance", "delegator"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_TotalSupply_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "liquid", "v1beta1", "total_supply"}, "", runtime.AssumeColonVerbOpt(false)))
) )
var ( var (
forward_Query_DelegatedBalance_0 = runtime.ForwardResponseMessage forward_Query_DelegatedBalance_0 = runtime.ForwardResponseMessage
forward_Query_TotalSupply_0 = runtime.ForwardResponseMessage
) )

View File

@ -33,6 +33,7 @@ func GetQueryCmd() *cobra.Command {
cmds := []*cobra.Command{ cmds := []*cobra.Command{
GetCmdQueryParams(), GetCmdQueryParams(),
queryDepositsCmd(), queryDepositsCmd(),
GetCmdTotalSupply(),
} }
for _, cmd := range cmds { for _, cmd := range cmds {
@ -130,3 +131,28 @@ func queryDepositsCmd() *cobra.Command {
return cmd return cmd
} }
// GetCmdTotalSupply returns the command that queries total supply locked into savings module
func GetCmdTotalSupply() *cobra.Command {
return &cobra.Command{
Use: "total-supply",
Short: "get total supply locked into savings module",
Long: "Get the sum of all denoms locked into the savings module.",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.TotalSupply(context.Background(), &types.QueryTotalSupplyRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
}

View File

@ -2,6 +2,7 @@ package keeper
import ( import (
"context" "context"
"strings"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
@ -103,3 +104,38 @@ func (s queryServer) Deposits(ctx context.Context, req *types.QueryDepositsReque
Pagination: nil, Pagination: nil,
}, nil }, nil
} }
func (s queryServer) TotalSupply(ctx context.Context, req *types.QueryTotalSupplyRequest) (*types.QueryTotalSupplyResponse, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)
totalSupply := sdk.NewCoins()
liquidStakedDerivatives := sdk.NewCoins()
s.keeper.IterateDeposits(sdkCtx, func(deposit types.Deposit) (stop bool) {
for _, c := range deposit.Amount {
// separate out bkava denoms
if strings.HasPrefix(c.Denom, bkavaPrefix) {
liquidStakedDerivatives = liquidStakedDerivatives.Add(c)
} else {
totalSupply = totalSupply.Add(c)
}
}
return false
})
// determine underlying value of bkava denoms
if len(liquidStakedDerivatives) > 0 {
underlyingValue, err := s.keeper.liquidKeeper.GetStakedTokensForDerivatives(
sdkCtx,
liquidStakedDerivatives,
)
if err != nil {
return nil, err
}
totalSupply = totalSupply.Add(sdk.NewCoin(bkavaDenom, underlyingValue.Amount))
}
return &types.QueryTotalSupplyResponse{
Height: sdkCtx.BlockHeight(),
Result: totalSupply,
}, nil
}

View File

@ -6,14 +6,26 @@ import (
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
tmprototypes "github.com/tendermint/tendermint/proto/tendermint/types" tmprototypes "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/kava-labs/kava/app" "github.com/kava-labs/kava/app"
liquidtypes "github.com/kava-labs/kava/x/liquid/types"
"github.com/kava-labs/kava/x/savings/keeper" "github.com/kava-labs/kava/x/savings/keeper"
"github.com/kava-labs/kava/x/savings/types" "github.com/kava-labs/kava/x/savings/types"
) )
var dep = types.NewDeposit
const (
bkava1 = "bkava-kavavaloper15gqc744d05xacn4n6w2furuads9fu4pqn6zxlu"
bkava2 = "bkava-kavavaloper15qdefkmwswysgg4qxgqpqr35k3m49pkx8yhpte"
)
type grpcQueryTestSuite struct { type grpcQueryTestSuite struct {
suite.Suite suite.Suite
@ -46,7 +58,7 @@ func (suite *grpcQueryTestSuite) SetupTest() {
suite.Require().NoError(err) suite.Require().NoError(err)
savingsGenesis := types.GenesisState{ savingsGenesis := types.GenesisState{
Params: types.NewParams([]string{"bnb", "busd"}), Params: types.NewParams([]string{"bnb", "busd", bkava1, bkava2}),
} }
savingsGenState := app.GenesisState{types.ModuleName: suite.tApp.AppCodec().MustMarshalJSON(&savingsGenesis)} savingsGenState := app.GenesisState{types.ModuleName: suite.tApp.AppCodec().MustMarshalJSON(&savingsGenesis)}
@ -69,7 +81,7 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryParams() {
var expected types.GenesisState var expected types.GenesisState
savingsGenesis := types.GenesisState{ savingsGenesis := types.GenesisState{
Params: types.NewParams([]string{"bnb", "busd"}), Params: types.NewParams([]string{"bnb", "busd", bkava1, bkava2}),
} }
savingsGenState := app.GenesisState{types.ModuleName: suite.tApp.AppCodec().MustMarshalJSON(&savingsGenesis)} savingsGenState := app.GenesisState{types.ModuleName: suite.tApp.AppCodec().MustMarshalJSON(&savingsGenesis)}
suite.tApp.AppCodec().MustUnmarshalJSON(savingsGenState[types.ModuleName], &expected) suite.tApp.AppCodec().MustUnmarshalJSON(savingsGenState[types.ModuleName], &expected)
@ -78,7 +90,12 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryParams() {
} }
func (suite *grpcQueryTestSuite) TestGrpcQueryDeposits() { func (suite *grpcQueryTestSuite) TestGrpcQueryDeposits() {
suite.addDeposits() suite.addDeposits([]types.Deposit{
dep(suite.addrs[0], cs(c("bnb", 100000000))),
dep(suite.addrs[1], cs(c("bnb", 20000000))),
dep(suite.addrs[0], cs(c("busd", 20000000))),
dep(suite.addrs[0], cs(c("busd", 8000000))),
})
tests := []struct { tests := []struct {
giveName string giveName string
@ -161,37 +178,176 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryDeposits() {
} }
} }
func (suite *grpcQueryTestSuite) addDeposits() { func (suite *grpcQueryTestSuite) TestGrpcQueryTotalSupply() {
deposits := []struct { testCases := []struct {
Address sdk.AccAddress name string
Coins sdk.Coins deposits types.Deposits
expectedSupply sdk.Coins
}{ }{
{ {
suite.addrs[0], name: "returns zeros when there's no supply",
cs(c("bnb", 100000000)), deposits: []types.Deposit{},
expectedSupply: sdk.NewCoins(),
}, },
{ {
suite.addrs[1], name: "returns supply of one denom deposited from multiple accounts",
cs(c("bnb", 20000000)), deposits: []types.Deposit{
dep(suite.addrs[0], sdk.NewCoins(c("busd", 1e6))),
dep(suite.addrs[1], sdk.NewCoins(c("busd", 1e6))),
},
expectedSupply: sdk.NewCoins(c("busd", 2e6)),
}, },
{ {
suite.addrs[0], name: "returns supply of multiple denoms deposited from single account",
cs(c("busd", 20000000)), deposits: []types.Deposit{
dep(suite.addrs[0], sdk.NewCoins(c("busd", 1e6), c("bnb", 1e6))),
},
expectedSupply: sdk.NewCoins(c("busd", 1e6), c("bnb", 1e6)),
}, },
{ {
suite.addrs[0], name: "returns supply of multiple denoms deposited from multiple accounts",
cs(c("busd", 8000000)), deposits: []types.Deposit{
dep(suite.addrs[0], sdk.NewCoins(c("busd", 1e6), c("bnb", 1e6))),
dep(suite.addrs[1], sdk.NewCoins(c("busd", 1e6), c("bnb", 1e6))),
},
expectedSupply: sdk.NewCoins(c("busd", 2e6), c("bnb", 2e6)),
}, },
} }
for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
// setup deposits
suite.addDeposits(tc.deposits)
res, err := suite.queryServer.TotalSupply(
sdk.WrapSDKContext(suite.ctx),
&types.QueryTotalSupplyRequest{},
)
suite.Require().NoError(err)
suite.Require().Equal(tc.expectedSupply, res.Result)
})
}
suite.Run("aggregates bkava denoms, accounting for slashing", func() {
suite.SetupTest()
address1, derivatives1, _ := suite.createAccountWithDerivatives(bkava1, sdk.NewInt(1e9))
address2, derivatives2, _ := suite.createAccountWithDerivatives(bkava2, sdk.NewInt(1e9))
// bond validators
staking.EndBlocker(suite.ctx, suite.tApp.GetStakingKeeper())
// slash val2 - its shares are now 80% as valuable!
err := suite.slashValidator(sdk.ValAddress(address2), sdk.MustNewDecFromStr("0.2"))
suite.Require().NoError(err)
suite.addDeposits(
types.Deposits{
dep(address1, cs(derivatives1)),
dep(address2, cs(derivatives2)),
},
)
expectedSupply := sdk.NewCoins(
sdk.NewCoin(
"bkava",
sdk.NewIntFromUint64(1e9). // derivative 1
Add(sdk.NewInt(1e9).MulRaw(80).QuoRaw(100))), // derivative 2: original value * 80%
)
res, err := suite.queryServer.TotalSupply(
sdk.WrapSDKContext(suite.ctx),
&types.QueryTotalSupplyRequest{},
)
suite.Require().NoError(err)
suite.Require().Equal(expectedSupply, res.Result)
})
}
func (suite *grpcQueryTestSuite) addDeposits(deposits types.Deposits) {
for _, dep := range deposits { for _, dep := range deposits {
suite.NotPanics(func() { suite.NotPanics(func() {
err := suite.keeper.Deposit(suite.ctx, dep.Address, dep.Coins) err := suite.keeper.Deposit(suite.ctx, dep.Depositor, dep.Amount)
suite.Require().NoError(err) suite.Require().NoError(err)
}) })
} }
} }
// createUnbondedValidator creates an unbonded validator with the given amount of self-delegation.
func (suite *grpcQueryTestSuite) createUnbondedValidator(address sdk.ValAddress, selfDelegation sdk.Coin, minSelfDelegation sdk.Int) error {
msg, err := stakingtypes.NewMsgCreateValidator(
address,
ed25519.GenPrivKey().PubKey(),
selfDelegation,
stakingtypes.Description{},
stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
minSelfDelegation,
)
if err != nil {
return err
}
msgServer := stakingkeeper.NewMsgServerImpl(suite.tApp.GetStakingKeeper())
_, err = msgServer.CreateValidator(sdk.WrapSDKContext(suite.ctx), msg)
return err
}
// createAccountWithDerivatives creates an account with the given amount and denom of derivative token.
// Internally, it creates a validator account and mints derivatives from the validator's self delegation.
func (suite *grpcQueryTestSuite) createAccountWithDerivatives(denom string, amount sdk.Int) (sdk.AccAddress, sdk.Coin, sdk.Coins) {
bondDenom := suite.tApp.GetStakingKeeper().BondDenom(suite.ctx)
valAddress, err := liquidtypes.ParseLiquidStakingTokenDenom(denom)
suite.Require().NoError(err)
address := sdk.AccAddress(valAddress)
remainingSelfDelegation := sdk.NewInt(1e6)
selfDelegation := sdk.NewCoin(
bondDenom,
amount.Add(remainingSelfDelegation),
)
// create & fund account
// ak := suite.tApp.GetAccountKeeper()
// acc := ak.NewAccountWithAddress(suite.ctx, address)
// ak.SetAccount(suite.ctx, acc)
err = suite.tApp.FundAccount(suite.ctx, address, sdk.NewCoins(selfDelegation))
suite.Require().NoError(err)
err = suite.createUnbondedValidator(valAddress, selfDelegation, remainingSelfDelegation)
suite.Require().NoError(err)
toConvert := sdk.NewCoin(bondDenom, amount)
derivatives, err := suite.tApp.GetLiquidKeeper().MintDerivative(suite.ctx,
address,
valAddress,
toConvert,
)
suite.Require().NoError(err)
fullBalance := suite.tApp.GetBankKeeper().GetAllBalances(suite.ctx, address)
return address, derivatives, fullBalance
}
// slashValidator slashes the validator with the given address by the given percentage.
func (suite *grpcQueryTestSuite) slashValidator(address sdk.ValAddress, slashFraction sdk.Dec) error {
stakingKeeper := suite.tApp.GetStakingKeeper()
validator, found := stakingKeeper.GetValidator(suite.ctx, address)
suite.Require().True(found)
consAddr, err := validator.GetConsAddr()
suite.Require().NoError(err)
// Assume infraction was at current height. Note unbonding delegations and redelegations are only slashed if created after
// the infraction height so none will be slashed.
infractionHeight := suite.ctx.BlockHeight()
power := stakingKeeper.TokensToConsensusPower(suite.ctx, validator.GetTokens())
stakingKeeper.Slash(suite.ctx, consAddr, infractionHeight, power, slashFraction)
return nil
}
func TestGrpcQueryTestSuite(t *testing.T) { func TestGrpcQueryTestSuite(t *testing.T) {
suite.Run(t, new(grpcQueryTestSuite)) suite.Run(t, new(grpcQueryTestSuite))
} }

View File

@ -7,6 +7,11 @@ import (
"github.com/kava-labs/kava/x/savings/types" "github.com/kava-labs/kava/x/savings/types"
) )
const (
bkavaDenom = "bkava"
bkavaPrefix = bkavaDenom + "-"
)
// GetParams returns the params from the store // GetParams returns the params from the store
func (k Keeper) GetParams(ctx sdk.Context) types.Params { func (k Keeper) GetParams(ctx sdk.Context) types.Params {
var p types.Params var p types.Params

View File

@ -33,5 +33,6 @@ type SavingsHooks interface {
} }
type LiquidKeeper interface { type LiquidKeeper interface {
GetStakedTokensForDerivatives(ctx sdk.Context, derivatives sdk.Coins) (sdk.Coin, error)
IsDerivativeDenom(ctx sdk.Context, denom string) bool IsDerivativeDenom(ctx sdk.Context, denom string) bool
} }

View File

@ -7,6 +7,8 @@ import (
context "context" context "context"
fmt "fmt" fmt "fmt"
_ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-proto"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types"
query "github.com/cosmos/cosmos-sdk/types/query" query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/gogo/protobuf/gogoproto" _ "github.com/gogo/protobuf/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc" grpc1 "github.com/gogo/protobuf/grpc"
@ -224,49 +226,150 @@ func (m *QueryDepositsResponse) GetPagination() *query.PageResponse {
return nil return nil
} }
// QueryTotalSupplyRequest defines the request type for Query/TotalSupply method.
type QueryTotalSupplyRequest struct {
}
func (m *QueryTotalSupplyRequest) Reset() { *m = QueryTotalSupplyRequest{} }
func (m *QueryTotalSupplyRequest) String() string { return proto.CompactTextString(m) }
func (*QueryTotalSupplyRequest) ProtoMessage() {}
func (*QueryTotalSupplyRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_f78c91efc5db144f, []int{4}
}
func (m *QueryTotalSupplyRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryTotalSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryTotalSupplyRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryTotalSupplyRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryTotalSupplyRequest.Merge(m, src)
}
func (m *QueryTotalSupplyRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryTotalSupplyRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryTotalSupplyRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo
// TotalSupplyResponse defines the response type for the Query/TotalSupply method.
type QueryTotalSupplyResponse struct {
// Height is the block height at which these totals apply
Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
// Result is a list of coins supplied to savings
Result github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=result,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"result"`
}
func (m *QueryTotalSupplyResponse) Reset() { *m = QueryTotalSupplyResponse{} }
func (m *QueryTotalSupplyResponse) String() string { return proto.CompactTextString(m) }
func (*QueryTotalSupplyResponse) ProtoMessage() {}
func (*QueryTotalSupplyResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_f78c91efc5db144f, []int{5}
}
func (m *QueryTotalSupplyResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryTotalSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryTotalSupplyResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *QueryTotalSupplyResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryTotalSupplyResponse.Merge(m, src)
}
func (m *QueryTotalSupplyResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryTotalSupplyResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryTotalSupplyResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryTotalSupplyResponse proto.InternalMessageInfo
func (m *QueryTotalSupplyResponse) GetHeight() int64 {
if m != nil {
return m.Height
}
return 0
}
func (m *QueryTotalSupplyResponse) GetResult() github_com_cosmos_cosmos_sdk_types.Coins {
if m != nil {
return m.Result
}
return nil
}
func init() { func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "kava.savings.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsRequest)(nil), "kava.savings.v1beta1.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "kava.savings.v1beta1.QueryParamsResponse") proto.RegisterType((*QueryParamsResponse)(nil), "kava.savings.v1beta1.QueryParamsResponse")
proto.RegisterType((*QueryDepositsRequest)(nil), "kava.savings.v1beta1.QueryDepositsRequest") proto.RegisterType((*QueryDepositsRequest)(nil), "kava.savings.v1beta1.QueryDepositsRequest")
proto.RegisterType((*QueryDepositsResponse)(nil), "kava.savings.v1beta1.QueryDepositsResponse") proto.RegisterType((*QueryDepositsResponse)(nil), "kava.savings.v1beta1.QueryDepositsResponse")
proto.RegisterType((*QueryTotalSupplyRequest)(nil), "kava.savings.v1beta1.QueryTotalSupplyRequest")
proto.RegisterType((*QueryTotalSupplyResponse)(nil), "kava.savings.v1beta1.QueryTotalSupplyResponse")
} }
func init() { proto.RegisterFile("kava/savings/v1beta1/query.proto", fileDescriptor_f78c91efc5db144f) } func init() { proto.RegisterFile("kava/savings/v1beta1/query.proto", fileDescriptor_f78c91efc5db144f) }
var fileDescriptor_f78c91efc5db144f = []byte{ var fileDescriptor_f78c91efc5db144f = []byte{
// 499 bytes of a gzipped FileDescriptorProto // 619 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x3f, 0x6f, 0x13, 0x31, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4f, 0x6f, 0x12, 0x41,
0x18, 0xc6, 0xcf, 0x69, 0x13, 0x15, 0x77, 0x41, 0xe6, 0x90, 0x8e, 0x28, 0x5c, 0xa2, 0x13, 0x2a, 0x18, 0xc6, 0x19, 0x28, 0xa4, 0x0e, 0x17, 0x33, 0xae, 0xba, 0x10, 0x5c, 0xc8, 0xa6, 0xa9, 0x14,
0x69, 0x51, 0x7d, 0x6a, 0xd8, 0xba, 0x11, 0x10, 0x0c, 0x2c, 0x70, 0x0c, 0x48, 0x2c, 0xc8, 0xd7, 0xc3, 0xae, 0xc5, 0x5b, 0x6f, 0x52, 0xa3, 0x07, 0x2f, 0xba, 0x35, 0x31, 0xf1, 0xd2, 0x0c, 0x30,
0x58, 0xe6, 0x44, 0x63, 0x5f, 0xef, 0x75, 0x02, 0x5d, 0x61, 0x41, 0x62, 0x41, 0x62, 0x64, 0x61, 0x59, 0x36, 0x85, 0x99, 0xed, 0xce, 0x80, 0x72, 0xd5, 0x8b, 0x89, 0x17, 0x13, 0x0f, 0x7a, 0xf4,
0x60, 0x42, 0x62, 0xe3, 0x43, 0x74, 0xac, 0x60, 0x61, 0x02, 0x94, 0xf0, 0x41, 0xd0, 0xd9, 0xee, 0xe0, 0xc9, 0xc4, 0x9b, 0xf1, 0x33, 0xf4, 0xd8, 0xe8, 0xc5, 0x93, 0x1a, 0xf0, 0x83, 0x98, 0x9d,
0xf5, 0x0f, 0x27, 0x9a, 0xed, 0xfc, 0xfa, 0x79, 0x1e, 0xff, 0xde, 0xd7, 0x3e, 0xdc, 0x7b, 0xce, 0x19, 0xb6, 0x50, 0x36, 0x95, 0x53, 0x77, 0xe6, 0x7d, 0x9f, 0x67, 0x7e, 0xef, 0x9f, 0x02, 0x6b,
0xa6, 0x2c, 0x06, 0x36, 0xcd, 0xa4, 0x80, 0x78, 0xba, 0x95, 0x72, 0xcd, 0xb6, 0xe2, 0xbd, 0x09, 0x47, 0x78, 0x8c, 0x5d, 0x8e, 0xc7, 0x01, 0xf5, 0xb9, 0x3b, 0xde, 0xed, 0x10, 0x81, 0x77, 0xdd,
0x2f, 0xf6, 0x69, 0x5e, 0x28, 0xad, 0x88, 0x5f, 0x2a, 0xa8, 0x53, 0x50, 0xa7, 0x68, 0xd7, 0xfb, 0xe3, 0x11, 0x89, 0x26, 0x4e, 0x18, 0x31, 0xc1, 0x90, 0x11, 0x67, 0x38, 0x3a, 0xc3, 0xd1, 0x19,
0x40, 0xab, 0x82, 0x5b, 0x5f, 0xdb, 0x17, 0x4a, 0x28, 0xf3, 0x19, 0x97, 0x5f, 0xae, 0xda, 0x11, 0xe5, 0x74, 0x1d, 0x17, 0x2c, 0x22, 0x4a, 0x57, 0x36, 0x7c, 0xe6, 0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xd9, 0x96, 0x2c, 0x35, 0x64, 0xa5, 0xb3,
0x24, 0xbb, 0xf1, 0x01, 0xc0, 0xe2, 0xc2, 0xc8, 0x50, 0xf3, 0x82, 0x47, 0x56, 0xc7, 0x5e, 0x76,
0xd6, 0x4d, 0xd7, 0x58, 0x0d, 0x89, 0xb5, 0x85, 0xec, 0x74, 0x2c, 0x11, 0x4b, 0x0e, 0xb9, 0xd4,
0xb4, 0xf7, 0x4f, 0xa6, 0x16, 0x38, 0x9d, 0x5a, 0xe0, 0xcf, 0xd4, 0x02, 0x6f, 0x67, 0x56, 0xe6,
0x74, 0x66, 0x65, 0x7e, 0xce, 0xac, 0xcc, 0xb3, 0x9d, 0x85, 0x25, 0x88, 0x7d, 0x9a, 0x03, 0xdc,
0xe1, 0xca, 0xf1, 0x45, 0xe2, 0x29, 0x77, 0xa1, 0x53, 0x90, 0xbf, 0x3f, 0x77, 0xfe, 0x05, 0x00,
0x00, 0xff, 0xff, 0xd4, 0xfc, 0xa1, 0x7b, 0x76, 0x05, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -285,6 +388,8 @@ type QueryClient interface {
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// Deposits queries savings deposits. // Deposits queries savings deposits.
Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error)
// TotalSupply returns the total sum of all coins currently locked into the savings module.
TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error)
} }
type queryClient struct { type queryClient struct {
@ -313,12 +418,23 @@ func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, op
return out, nil return out, nil
} }
func (c *queryClient) TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) {
out := new(QueryTotalSupplyResponse)
err := c.cc.Invoke(ctx, "/kava.savings.v1beta1.Query/TotalSupply", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service. // QueryServer is the server API for Query service.
type QueryServer interface { type QueryServer interface {
// Params queries all parameters of the savings module. // Params queries all parameters of the savings module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// Deposits queries savings deposits. // Deposits queries savings deposits.
Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error)
// TotalSupply returns the total sum of all coins currently locked into the savings module.
TotalSupply(context.Context, *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error)
} }
// UnimplementedQueryServer can be embedded to have forward compatible implementations. // UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -331,6 +447,9 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq
func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) { func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented") return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented")
} }
func (*UnimplementedQueryServer) TotalSupply(ctx context.Context, req *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method TotalSupply not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) { func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv) s.RegisterService(&_Query_serviceDesc, srv)
@ -372,6 +491,24 @@ func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryTotalSupplyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).TotalSupply(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/kava.savings.v1beta1.Query/TotalSupply",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).TotalSupply(ctx, req.(*QueryTotalSupplyRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{ var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "kava.savings.v1beta1.Query", ServiceName: "kava.savings.v1beta1.Query",
HandlerType: (*QueryServer)(nil), HandlerType: (*QueryServer)(nil),
@ -384,6 +521,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "Deposits", MethodName: "Deposits",
Handler: _Query_Deposits_Handler, Handler: _Query_Deposits_Handler,
}, },
{
MethodName: "TotalSupply",
Handler: _Query_TotalSupply_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "kava/savings/v1beta1/query.proto", Metadata: "kava/savings/v1beta1/query.proto",
@ -543,6 +684,71 @@ func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *QueryTotalSupplyRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryTotalSupplyRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryTotalSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *QueryTotalSupplyResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *QueryTotalSupplyResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryTotalSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Result) > 0 {
for iNdEx := len(m.Result) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Result[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if m.Height != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v) offset -= sovQuery(v)
base := offset base := offset
@ -614,6 +820,33 @@ func (m *QueryDepositsResponse) Size() (n int) {
return n return n
} }
func (m *QueryTotalSupplyRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *QueryTotalSupplyResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Height != 0 {
n += 1 + sovQuery(uint64(m.Height))
}
if len(m.Result) > 0 {
for _, e := range m.Result {
l = e.Size()
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func sovQuery(x uint64) (n int) { func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -1023,6 +1256,159 @@ func (m *QueryDepositsResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *QueryTotalSupplyRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryTotalSupplyRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryTotalSupplyRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryTotalSupplyResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: QueryTotalSupplyResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryTotalSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.Height = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Height |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Result = append(m.Result, types.Coin{})
if err := m.Result[len(m.Result)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) { func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

View File

@ -87,6 +87,24 @@ func local_request_Query_Deposits_0(ctx context.Context, marshaler runtime.Marsh
} }
func request_Query_TotalSupply_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryTotalSupplyRequest
var metadata runtime.ServerMetadata
msg, err := client.TotalSupply(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_TotalSupply_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryTotalSupplyRequest
var metadata runtime.ServerMetadata
msg, err := server.TotalSupply(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly. // UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -139,6 +157,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}) })
mux.Handle("GET", pattern_Query_TotalSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_TotalSupply_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_TotalSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -220,6 +261,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}) })
mux.Handle("GET", pattern_Query_TotalSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_TotalSupply_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_TotalSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -227,10 +288,14 @@ var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "savings", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "savings", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Deposits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "savings", "v1beta1", "deposits"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Deposits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "savings", "v1beta1", "deposits"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_TotalSupply_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "savings", "v1beta1", "total_supply"}, "", runtime.AssumeColonVerbOpt(false)))
) )
var ( var (
forward_Query_Params_0 = runtime.ForwardResponseMessage forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_Deposits_0 = runtime.ForwardResponseMessage forward_Query_Deposits_0 = runtime.ForwardResponseMessage
forward_Query_TotalSupply_0 = runtime.ForwardResponseMessage
) )