From 82e2f26e149735ed7047796cbe9ac60a6ba4a53d Mon Sep 17 00:00:00 2001 From: Derrick Lee Date: Thu, 28 Jul 2022 09:50:59 -0700 Subject: [PATCH] Add Earn grpc query service and cli query commands (#1279) * Add query methods * Add TotalDeposited rpc query * All accounts and all denoms query wip * Add query deposits * Remove IsDenomSupported strategy method This is not necessary and is already set in params allowed vaults * Add Vaults, TotalDeposited queries * Deposits query tests and fixes * proto lints * Add earn swagger docs * Add cli query cmds * Update init-new-chain.sh with usdx strategy and funds * Add denom url query path for vaults * Return a list of coins for each depositor instead of multiple deposit entries --- client/docs/config.json | 28 +- client/docs/swagger-ui/swagger.yaml | 590 ++++++++ contrib/devnet/init-new-chain.sh | 6 +- docs/core/proto-docs.md | 151 +- proto/kava/earn/v1beta1/genesis.proto | 4 +- proto/kava/earn/v1beta1/params.proto | 1 + proto/kava/earn/v1beta1/query.proto | 113 +- proto/kava/earn/v1beta1/strategy.proto | 12 +- proto/kava/earn/v1beta1/tx.proto | 2 +- proto/kava/earn/v1beta1/vault.proto | 6 +- x/earn/client/cli/query.go | 129 ++ x/earn/keeper/deposit.go | 11 - x/earn/keeper/grpc_query.go | 286 +++- x/earn/keeper/grpc_query_test.go | 341 +++++ x/earn/keeper/strategy.go | 4 - x/earn/keeper/strategy_hard_test.go | 26 - x/earn/keeper/vault.go | 31 + x/earn/testutil/suite.go | 41 +- x/earn/types/errors.go | 13 +- x/earn/types/genesis.pb.go | 34 +- x/earn/types/params.pb.go | 1 + x/earn/types/query.go | 30 + x/earn/types/query.pb.go | 1936 +++++++++++++++++++++++- x/earn/types/query.pb.gw.go | 276 ++++ x/earn/types/strategy.pb.go | 44 +- x/earn/types/tx.pb.go | 40 +- x/earn/types/vault.go | 2 +- x/earn/types/vault.pb.go | 56 +- 28 files changed, 4024 insertions(+), 190 deletions(-) diff --git a/client/docs/config.json b/client/docs/config.json index a26e125f..a199ac5b 100644 --- a/client/docs/config.json +++ b/client/docs/config.json @@ -10,9 +10,7 @@ "url": "https://github.com/Kava-Labs/kava" }, "host": "api.data.kava.io", - "schemes": [ - "https" - ], + "schemes": ["https"], "apis": [ { "url": "./tmp-swagger-gen/kava/auction/v1beta1/query.swagger.json", @@ -82,6 +80,23 @@ ] } }, + { + "url": "./tmp-swagger-gen/kava/earn/v1beta1/query.swagger.json", + "tags": { + "rename": { + "Query": "Earn" + } + }, + "operationIds": { + "rename": [ + { + "type": "regex", + "from": "(.*)", + "to": "Earn$1" + } + ] + } + }, { "url": "./tmp-swagger-gen/kava/hard/v1beta1/query.swagger.json", "tags": { @@ -196,10 +211,7 @@ } }, "paths": { - "exclude": [ - "^/cosmos/authz/.*", - "^/cosmos/feegrant/.*" - ] + "exclude": ["^/cosmos/authz/.*", "^/cosmos/feegrant/.*"] } }, { @@ -229,4 +241,4 @@ } } ] -} \ No newline at end of file +} diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index e33286f4..78fce0c7 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -6960,6 +6960,357 @@ paths: type: string tags: - Committee + /kava/earn/v1beta1/deposits: + get: + summary: Deposits queries deposit details based on owner address and vault + operationId: EarnDeposits + responses: + '200': + description: A successful response. + schema: + type: object + properties: + deposits: + type: array + items: + type: object + properties: + depositor: + type: string + description: depositor represents the owner of the deposit. + denom: + type: string + description: denom represents the vault denom the deposit is for. + account_supplied: + type: string + description: >- + AccountSupplied represents the amount of denom supplied + to the vault. + account_value: + type: string + description: >- + AccountValue represents the coin value of the + depositor's share of the vault. + description: >- + DepositResponse defines a single deposit query response + type. + title: >- + deposits returns the deposits matching the requested + parameters + pagination: + description: pagination defines the pagination in the response. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + QueryDepositsResponse is the response type for the Query/Deposits + RPC 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 + parameters: + - name: owner + description: owner optionally filters deposits by owner. + in: query + required: false + type: string + - name: denom + description: denom optionally filters deposits by vault denom. + in: query + required: false + type: string + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + format: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + format: boolean + tags: + - Earn + /kava/earn/v1beta1/params: + get: + summary: Params queries all parameters of the earn module. + operationId: EarnParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + title: params represents the earn module parameters + type: object + properties: + allowed_vaults: + type: array + items: + type: object + properties: + denom: + type: string + description: >- + Denom is the only supported denomination of the + vault for deposits and withdrawals. + vault_strategy: + description: VaultStrategy is the strategy used for this vault. + type: string + enum: + - STRATEGY_TYPE_UNSPECIFIED + - STRATEGY_TYPE_HARD + - STRATEGY_TYPE_SAVINGS + default: STRATEGY_TYPE_UNSPECIFIED + description: >- + AllowedVault is a vault that is allowed to be created. + These can be + + modified via parameter governance. + description: Params defines the parameters of the earn module. + description: >- + QueryParamsResponse defines the response type for querying x/earn + parameters. + 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/total-deposited/{denom}: + get: + summary: TotalDeposited queries total deposited amount for each vault. + operationId: EarnTotalDeposited + responses: + '200': + description: A successful response. + schema: + type: object + properties: + supplied_coins: + 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. + description: >- + QueryTotalDepositedResponse is the response type for the + Query/TotalDeposited RPC 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 + parameters: + - name: denom + description: >- + denom represents the vault denom to query total deposited amount + for. + in: path + required: true + type: string + tags: + - Earn + /kava/earn/v1beta1/vaults: + get: + summary: Vaults queries vaults based on vault denom + operationId: EarnVaults + responses: + '200': + description: A successful response. + schema: + type: object + properties: + vaults: + type: array + items: + type: object + properties: + denom: + type: string + title: denom represents the denom of the vault + vault_strategy: + description: VaultStrategy is the strategy used for this vault. + type: string + enum: + - STRATEGY_TYPE_UNSPECIFIED + - STRATEGY_TYPE_HARD + - STRATEGY_TYPE_SAVINGS + default: STRATEGY_TYPE_UNSPECIFIED + total_supplied: + type: string + description: >- + TotalSupplied is the total amount of denom coins + supplied to the vault. + total_value: + type: string + description: >- + TotalValue is the total value of denom coins supplied to + the vault if the + + vault were to be liquidated. + description: VaultResponse is the response type for a vault. + title: vaults represents the earn module vaults + description: >- + QueryVaultsResponse is the response type for the Query/Vaults RPC + 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 + parameters: + - name: denom + description: vault filters vault by denom. + in: query + required: false + type: string + tags: + - Earn /kava/hard/v1beta1/accounts: get: summary: Accounts queries module accounts. @@ -53848,6 +54199,245 @@ definitions: - VOTE_TYPE_YES: VOTE_TYPE_YES defines a yes vote option. - VOTE_TYPE_NO: VOTE_TYPE_NO defines a no vote option. - VOTE_TYPE_ABSTAIN: VOTE_TYPE_ABSTAIN defines an abstain vote option. + kava.earn.v1beta1.AllowedVault: + type: object + properties: + denom: + type: string + description: >- + Denom is the only supported denomination of the vault for deposits and + withdrawals. + vault_strategy: + description: VaultStrategy is the strategy used for this vault. + type: string + enum: + - STRATEGY_TYPE_UNSPECIFIED + - STRATEGY_TYPE_HARD + - STRATEGY_TYPE_SAVINGS + default: STRATEGY_TYPE_UNSPECIFIED + description: |- + AllowedVault is a vault that is allowed to be created. These can be + modified via parameter governance. + kava.earn.v1beta1.DepositResponse: + type: object + properties: + depositor: + type: string + description: depositor represents the owner of the deposit. + denom: + type: string + description: denom represents the vault denom the deposit is for. + account_supplied: + type: string + description: AccountSupplied represents the amount of denom supplied to the vault. + account_value: + type: string + description: >- + AccountValue represents the coin value of the depositor's share of the + vault. + description: DepositResponse defines a single deposit query response type. + kava.earn.v1beta1.Params: + type: object + properties: + allowed_vaults: + type: array + items: + type: object + properties: + denom: + type: string + description: >- + Denom is the only supported denomination of the vault for + deposits and withdrawals. + vault_strategy: + description: VaultStrategy is the strategy used for this vault. + type: string + enum: + - STRATEGY_TYPE_UNSPECIFIED + - STRATEGY_TYPE_HARD + - STRATEGY_TYPE_SAVINGS + default: STRATEGY_TYPE_UNSPECIFIED + description: |- + AllowedVault is a vault that is allowed to be created. These can be + modified via parameter governance. + description: Params defines the parameters of the earn module. + kava.earn.v1beta1.QueryDepositsResponse: + type: object + properties: + deposits: + type: array + items: + type: object + properties: + depositor: + type: string + description: depositor represents the owner of the deposit. + denom: + type: string + description: denom represents the vault denom the deposit is for. + account_supplied: + type: string + description: >- + AccountSupplied represents the amount of denom supplied to the + vault. + account_value: + type: string + description: >- + AccountValue represents the coin value of the depositor's share + of the vault. + description: DepositResponse defines a single deposit query response type. + title: deposits returns the deposits matching the requested parameters + pagination: + description: pagination defines the pagination in the response. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + QueryDepositsResponse is the response type for the Query/Deposits RPC + method. + kava.earn.v1beta1.QueryParamsResponse: + type: object + properties: + params: + title: params represents the earn module parameters + type: object + properties: + allowed_vaults: + type: array + items: + type: object + properties: + denom: + type: string + description: >- + Denom is the only supported denomination of the vault for + deposits and withdrawals. + vault_strategy: + description: VaultStrategy is the strategy used for this vault. + type: string + enum: + - STRATEGY_TYPE_UNSPECIFIED + - STRATEGY_TYPE_HARD + - STRATEGY_TYPE_SAVINGS + default: STRATEGY_TYPE_UNSPECIFIED + description: >- + AllowedVault is a vault that is allowed to be created. These can + be + + modified via parameter governance. + description: Params defines the parameters of the earn module. + description: >- + QueryParamsResponse defines the response type for querying x/earn + parameters. + kava.earn.v1beta1.QueryTotalDepositedResponse: + type: object + properties: + supplied_coins: + 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. + description: >- + QueryTotalDepositedResponse is the response type for the + Query/TotalDeposited RPC method. + kava.earn.v1beta1.QueryVaultsResponse: + type: object + properties: + vaults: + type: array + items: + type: object + properties: + denom: + type: string + title: denom represents the denom of the vault + vault_strategy: + description: VaultStrategy is the strategy used for this vault. + type: string + enum: + - STRATEGY_TYPE_UNSPECIFIED + - STRATEGY_TYPE_HARD + - STRATEGY_TYPE_SAVINGS + default: STRATEGY_TYPE_UNSPECIFIED + total_supplied: + type: string + description: >- + TotalSupplied is the total amount of denom coins supplied to the + vault. + total_value: + type: string + description: >- + TotalValue is the total value of denom coins supplied to the + vault if the + + vault were to be liquidated. + description: VaultResponse is the response type for a vault. + title: vaults represents the earn module vaults + description: QueryVaultsResponse is the response type for the Query/Vaults RPC method. + kava.earn.v1beta1.StrategyType: + type: string + enum: + - STRATEGY_TYPE_UNSPECIFIED + - STRATEGY_TYPE_HARD + - STRATEGY_TYPE_SAVINGS + default: STRATEGY_TYPE_UNSPECIFIED + description: |- + StrategyType is the type of strategy that a vault uses to optimize yields. + + - STRATEGY_TYPE_UNSPECIFIED: STRATEGY_TYPE_UNSPECIFIED represents an unspecified or invalid strategy type. + - STRATEGY_TYPE_HARD: STRATEGY_TYPE_HARD represents the strategy that deposits assets in the Hard + module. + - STRATEGY_TYPE_SAVINGS: STRATEGY_TYPE_SAVINGS represents the strategy that deposits assets in the + Savings module. + kava.earn.v1beta1.VaultResponse: + type: object + properties: + denom: + type: string + title: denom represents the denom of the vault + vault_strategy: + description: VaultStrategy is the strategy used for this vault. + type: string + enum: + - STRATEGY_TYPE_UNSPECIFIED + - STRATEGY_TYPE_HARD + - STRATEGY_TYPE_SAVINGS + default: STRATEGY_TYPE_UNSPECIFIED + total_supplied: + type: string + description: >- + TotalSupplied is the total amount of denom coins supplied to the + vault. + total_value: + type: string + description: >- + TotalValue is the total value of denom coins supplied to the vault if + the + + vault were to be liquidated. + description: VaultResponse is the response type for a vault. kava.hard.v1beta1.BorrowInterestFactorResponse: type: object properties: diff --git a/contrib/devnet/init-new-chain.sh b/contrib/devnet/init-new-chain.sh index fbe643fe..695de72e 100755 --- a/contrib/devnet/init-new-chain.sh +++ b/contrib/devnet/init-new-chain.sh @@ -57,7 +57,7 @@ $BINARY add-genesis-account $evmFaucetKeyName 1000000000ukava userKeyName="user" printf "$userMnemonic\n" | $BINARY keys add $userKeyName --eth --recover -$BINARY add-genesis-account $userKeyName 1000000000ukava +$BINARY add-genesis-account $userKeyName 1000000000ukava,1000000000usdx relayerKeyName="relayer" printf "$relayerMnemonic\n" | $BINARY keys add $relayerKeyName --eth --recover @@ -118,6 +118,6 @@ jq '.app_state.bridge.params.enabled_conversion_pairs = [ # Add earn vault jq '.app_state.earn.params.allowed_vaults = [ { - denom: "ukava", - vault_strategy: 2, + denom: "usdx", + vault_strategy: 1, }]' $DATA/config/genesis.json | sponge $DATA/config/genesis.json diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index e6fba347..a6391430 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -193,8 +193,16 @@ - [GenesisState](#kava.earn.v1beta1.GenesisState) - [kava/earn/v1beta1/query.proto](#kava/earn/v1beta1/query.proto) + - [DepositResponse](#kava.earn.v1beta1.DepositResponse) + - [QueryDepositsRequest](#kava.earn.v1beta1.QueryDepositsRequest) + - [QueryDepositsResponse](#kava.earn.v1beta1.QueryDepositsResponse) - [QueryParamsRequest](#kava.earn.v1beta1.QueryParamsRequest) - [QueryParamsResponse](#kava.earn.v1beta1.QueryParamsResponse) + - [QueryTotalDepositedRequest](#kava.earn.v1beta1.QueryTotalDepositedRequest) + - [QueryTotalDepositedResponse](#kava.earn.v1beta1.QueryTotalDepositedResponse) + - [QueryVaultsRequest](#kava.earn.v1beta1.QueryVaultsRequest) + - [QueryVaultsResponse](#kava.earn.v1beta1.QueryVaultsResponse) + - [VaultResponse](#kava.earn.v1beta1.VaultResponse) - [Query](#kava.earn.v1beta1.Query) @@ -2747,13 +2755,13 @@ Msg defines the committee Msg service ### StrategyType - +StrategyType is the type of strategy that a vault uses to optimize yields. | Name | Number | Description | | ---- | ------ | ----------- | -| STRATEGY_TYPE_UNKNOWN | 0 | | -| STRATEGY_TYPE_HARD | 1 | | -| STRATEGY_TYPE_SAVINGS | 2 | | +| STRATEGY_TYPE_UNSPECIFIED | 0 | STRATEGY_TYPE_UNSPECIFIED represents an unspecified or invalid strategy type. | +| STRATEGY_TYPE_HARD | 1 | STRATEGY_TYPE_HARD represents the strategy that deposits assets in the Hard module. | +| STRATEGY_TYPE_SAVINGS | 2 | STRATEGY_TYPE_SAVINGS represents the strategy that deposits assets in the Savings module. | @@ -2781,7 +2789,7 @@ modified via parameter governance. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `denom` | [string](#string) | | Denom is the only supported denomination of the vault for deposits and withdrawals. | -| `vault_strategy` | [StrategyType](#kava.earn.v1beta1.StrategyType) | | VaultStrategy is the strategies to use for this vault. | +| `vault_strategy` | [StrategyType](#kava.earn.v1beta1.StrategyType) | | VaultStrategy is the strategy used for this vault. | @@ -2840,7 +2848,7 @@ VaultShareRecord defines the vault shares owned by a depositor. ### Params - +Params defines the parameters of the earn module. | Field | Type | Label | Description | @@ -2901,6 +2909,56 @@ GenesisState defines the earn module's genesis state. + + +### DepositResponse +DepositResponse defines a deposit query response type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `depositor` | [string](#string) | | depositor represents the owner of the deposit. | +| `amount_supplied` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Amount represents the amount supplied to vaults. | +| `value` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Value represents the total accumulated value of denom coins supplied to vaults. This may be greater than or equal to amount_supplied depending on the strategy. | + + + + + + + + +### QueryDepositsRequest +QueryDepositsRequest is the request type for the Query/Deposits RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `owner` | [string](#string) | | owner optionally filters deposits by owner | +| `denom` | [string](#string) | | denom optionally filters deposits by vault denom | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryDepositsResponse +QueryDepositsResponse is the response type for the Query/Deposits RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `deposits` | [DepositResponse](#kava.earn.v1beta1.DepositResponse) | repeated | deposits returns the deposits matching the requested parameters | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + ### QueryParamsRequest @@ -2925,6 +2983,84 @@ QueryParamsResponse defines the response type for querying x/earn parameters. + + + +### QueryTotalDepositedRequest +QueryTotalDepositedRequest is the request type for the Query/TotalDeposited RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `denom` | [string](#string) | | denom represents the vault denom to query total deposited amount for. | + + + + + + + + +### QueryTotalDepositedResponse +QueryTotalDepositedResponse is the response type for the Query/TotalDeposited RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `supplied_coins` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + + + + +### QueryVaultsRequest +QueryVaultsRequest is the request type for the Query/Vault RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `denom` | [string](#string) | | vault filters vault by denom | + + + + + + + + +### QueryVaultsResponse +QueryVaultsResponse is the response type for the Query/Vaults RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `vaults` | [VaultResponse](#kava.earn.v1beta1.VaultResponse) | repeated | vaults represents the earn module vaults | + + + + + + + + +### VaultResponse +VaultResponse is the response type for a vault. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `denom` | [string](#string) | | denom represents the denom of the vault | +| `vault_strategy` | [StrategyType](#kava.earn.v1beta1.StrategyType) | | VaultStrategy is the strategy used for this vault. | +| `total_supplied` | [string](#string) | | TotalSupplied is the total amount of denom coins supplied to the vault. | +| `total_value` | [string](#string) | | TotalValue is the total value of denom coins supplied to the vault if the vault were to be liquidated. | + + + + + @@ -2940,6 +3076,9 @@ Query defines the gRPC querier service for earn module | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | | `Params` | [QueryParamsRequest](#kava.earn.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#kava.earn.v1beta1.QueryParamsResponse) | Params queries all parameters of the earn module. | GET|/kava/earn/v1beta1/params| +| `Vaults` | [QueryVaultsRequest](#kava.earn.v1beta1.QueryVaultsRequest) | [QueryVaultsResponse](#kava.earn.v1beta1.QueryVaultsResponse) | Vaults queries vaults based on 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 owner address and vault | GET|/kava/earn/v1beta1/deposits| +| `TotalDeposited` | [QueryTotalDepositedRequest](#kava.earn.v1beta1.QueryTotalDepositedRequest) | [QueryTotalDepositedResponse](#kava.earn.v1beta1.QueryTotalDepositedResponse) | TotalDeposited queries total deposited amount for each vault. | GET|/kava/earn/v1beta1/total-deposited/{denom}| diff --git a/proto/kava/earn/v1beta1/genesis.proto b/proto/kava/earn/v1beta1/genesis.proto index 6bf239f2..cf78d368 100644 --- a/proto/kava/earn/v1beta1/genesis.proto +++ b/proto/kava/earn/v1beta1/genesis.proto @@ -3,9 +3,9 @@ package kava.earn.v1beta1; option go_package = "github.com/kava-labs/kava/x/earn/types"; -import "kava/earn/v1beta1/vault.proto"; -import "kava/earn/v1beta1/params.proto"; import "gogoproto/gogo.proto"; +import "kava/earn/v1beta1/params.proto"; +import "kava/earn/v1beta1/vault.proto"; // GenesisState defines the earn module's genesis state. message GenesisState { diff --git a/proto/kava/earn/v1beta1/params.proto b/proto/kava/earn/v1beta1/params.proto index 3481aea2..60530d11 100644 --- a/proto/kava/earn/v1beta1/params.proto +++ b/proto/kava/earn/v1beta1/params.proto @@ -6,6 +6,7 @@ option go_package = "github.com/kava-labs/kava/x/earn/types"; import "gogoproto/gogo.proto"; import "kava/earn/v1beta1/vault.proto"; +// Params defines the parameters of the earn module. message Params { repeated AllowedVault allowed_vaults = 1 [(gogoproto.castrepeated) = "AllowedVaults", (gogoproto.nullable) = false]; } diff --git a/proto/kava/earn/v1beta1/query.proto b/proto/kava/earn/v1beta1/query.proto index a1a5cf8c..bfe5208c 100644 --- a/proto/kava/earn/v1beta1/query.proto +++ b/proto/kava/earn/v1beta1/query.proto @@ -1,12 +1,16 @@ syntax = "proto3"; package kava.earn.v1beta1; -option go_package = "github.com/kava-labs/kava/x/earn/types"; +option go_package = "github.com/kava-labs/kava/x/earn/types"; +option (gogoproto.goproto_getters_all) = false; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "cosmos_proto/cosmos.proto"; import "kava/earn/v1beta1/params.proto"; +import "kava/earn/v1beta1/strategy.proto"; // Query defines the gRPC querier service for earn module service Query { @@ -14,17 +18,114 @@ service Query { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/kava/earn/v1beta1/params"; } + + // Vaults queries vaults based on vault denom + rpc Vaults(QueryVaultsRequest) returns (QueryVaultsResponse) { + option (google.api.http).get = "/kava/earn/v1beta1/vaults/{denom}"; + } + + // Deposits queries deposit details based on owner address and vault + rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) { + option (google.api.http).get = "/kava/earn/v1beta1/deposits"; + } + + // TotalDeposited queries total deposited amount for each vault. + rpc TotalDeposited(QueryTotalDepositedRequest) returns (QueryTotalDepositedResponse) { + option (google.api.http).get = "/kava/earn/v1beta1/total-deposited/{denom}"; + } } // QueryParamsRequest defines the request type for querying x/earn parameters. -message QueryParamsRequest { - option (gogoproto.goproto_getters) = false; -} +message QueryParamsRequest {} // QueryParamsResponse defines the response type for querying x/earn parameters. message QueryParamsResponse { - option (gogoproto.goproto_getters) = false; // params represents the earn module parameters Params params = 1 [(gogoproto.nullable) = false]; } + +// QueryVaultsRequest is the request type for the Query/Vault RPC method. +message QueryVaultsRequest { + // vault filters vault by denom + string denom = 1; +} + +// QueryVaultsResponse is the response type for the Query/Vaults RPC method. +message QueryVaultsResponse { + // vaults represents the earn module vaults + repeated VaultResponse vaults = 1 [(gogoproto.nullable) = false]; +} + +// VaultResponse is the response type for a vault. +message VaultResponse { + // denom represents the denom of the vault + string denom = 1; + + // VaultStrategy is the strategy used for this vault. + StrategyType vault_strategy = 2; + + // TotalSupplied is the total amount of denom coins supplied to the vault. + string total_supplied = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + + // TotalValue is the total value of denom coins supplied to the vault if the + // vault were to be liquidated. + string total_value = 4 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// QueryDepositsRequest is the request type for the Query/Deposits RPC method. +message QueryDepositsRequest { + // owner optionally filters deposits by owner + string owner = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // denom optionally filters deposits by vault denom + string denom = 2; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 3; +} + +// QueryDepositsResponse is the response type for the Query/Deposits RPC method. +message QueryDepositsResponse { + // deposits returns the deposits matching the requested parameters + repeated DepositResponse deposits = 1 [(gogoproto.nullable) = false]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// DepositResponse defines a deposit query response type. +message DepositResponse { + // depositor represents the owner of the deposit. + string depositor = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // Amount represents the amount supplied to vaults. + repeated cosmos.base.v1beta1.Coin amount_supplied = 2 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; + + // Value represents the total accumulated value of denom coins supplied to + // vaults. This may be greater than or equal to amount_supplied depending on + // the strategy. + repeated cosmos.base.v1beta1.Coin value = 3 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; +} + +// QueryTotalDepositedRequest is the request type for the Query/TotalDeposited RPC method. +message QueryTotalDepositedRequest { + // denom represents the vault denom to query total deposited amount for. + string denom = 1; +} + +// QueryTotalDepositedResponse is the response type for the Query/TotalDeposited RPC method. +message QueryTotalDepositedResponse { + repeated cosmos.base.v1beta1.Coin supplied_coins = 1 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; +} diff --git a/proto/kava/earn/v1beta1/strategy.proto b/proto/kava/earn/v1beta1/strategy.proto index 7b3d6f24..6525e813 100644 --- a/proto/kava/earn/v1beta1/strategy.proto +++ b/proto/kava/earn/v1beta1/strategy.proto @@ -4,13 +4,17 @@ package kava.earn.v1beta1; option go_package = "github.com/kava-labs/kava/x/earn/types"; import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos_proto/cosmos.proto"; +// StrategyType is the type of strategy that a vault uses to optimize yields. enum StrategyType { option (gogoproto.goproto_enum_prefix) = false; - STRATEGY_TYPE_UNKNOWN = 0; - STRATEGY_TYPE_HARD = 1; + // STRATEGY_TYPE_UNSPECIFIED represents an unspecified or invalid strategy type. + STRATEGY_TYPE_UNSPECIFIED = 0; + // STRATEGY_TYPE_HARD represents the strategy that deposits assets in the Hard + // module. + STRATEGY_TYPE_HARD = 1; + // STRATEGY_TYPE_SAVINGS represents the strategy that deposits assets in the + // Savings module. STRATEGY_TYPE_SAVINGS = 2; } diff --git a/proto/kava/earn/v1beta1/tx.proto b/proto/kava/earn/v1beta1/tx.proto index 6c7de65e..69a4fca5 100644 --- a/proto/kava/earn/v1beta1/tx.proto +++ b/proto/kava/earn/v1beta1/tx.proto @@ -1,9 +1,9 @@ syntax = "proto3"; package kava.earn.v1beta1; -import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/kava-labs/kava/x/earn/types"; diff --git a/proto/kava/earn/v1beta1/vault.proto b/proto/kava/earn/v1beta1/vault.proto index 3467ad25..04627130 100644 --- a/proto/kava/earn/v1beta1/vault.proto +++ b/proto/kava/earn/v1beta1/vault.proto @@ -3,9 +3,9 @@ package kava.earn.v1beta1; option go_package = "github.com/kava-labs/kava/x/earn/types"; -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; import "kava/earn/v1beta1/strategy.proto"; // AllowedVault is a vault that is allowed to be created. These can be @@ -14,7 +14,7 @@ message AllowedVault { // Denom is the only supported denomination of the vault for deposits and withdrawals. string denom = 1; - // VaultStrategy is the strategies to use for this vault. + // VaultStrategy is the strategy used for this vault. StrategyType vault_strategy = 2; } diff --git a/x/earn/client/cli/query.go b/x/earn/client/cli/query.go index c1e7097b..9a1601ab 100644 --- a/x/earn/client/cli/query.go +++ b/x/earn/client/cli/query.go @@ -2,15 +2,23 @@ package cli import ( "context" + "fmt" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/version" "github.com/kava-labs/kava/x/earn/types" ) +// flags for cli queries +const ( + flagDenom = "denom" + flagOwner = "owner" +) + // GetQueryCmd returns the cli query commands for the earn module func GetQueryCmd() *cobra.Command { earnQueryCommand := &cobra.Command{ @@ -23,6 +31,9 @@ func GetQueryCmd() *cobra.Command { cmds := []*cobra.Command{ queryParamsCmd(), + queryVaultsCmd(), + queryDepositsCmd(), + queryTotalDepositedCmd(), } for _, cmd := range cmds { @@ -58,3 +69,121 @@ func queryParamsCmd() *cobra.Command { }, } } + +func queryVaultsCmd() *cobra.Command { + return &cobra.Command{ + Use: "vaults", + Short: "get the earn vaults", + Long: "Get the earn module vaults.", + Args: cobra.MaximumNArgs(1), + Example: fmt.Sprintf(`%[1]s q %[2]s vaults +%[1]s q %[2]s vaults +%[1]s q %[2]s vaults usdx`, version.AppName, types.ModuleName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + vaultDenom := "" + if len(args) > 1 { + vaultDenom = args[0] + } + + req := types.NewQueryVaultsRequest(vaultDenom) + res, err := queryClient.Vaults(context.Background(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } +} + +func queryDepositsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "deposits", + Short: "get earn vault deposits", + Long: "Get earn vault deposits for all or specific accounts and vaults.", + Args: cobra.NoArgs, + Example: fmt.Sprintf(`%[1]s q %[2]s deposits +%[1]s q %[2]s deposits --owner kava1l0xsq2z7gqd7yly0g40y5836g0appumark77ny --denom usdx +%[1]s q %[2]s deposits --denom usdx`, version.AppName, types.ModuleName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + ownerBech, err := cmd.Flags().GetString(flagOwner) + if err != nil { + return err + } + denom, err := cmd.Flags().GetString(flagDenom) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + req := types.NewQueryDepositsRequest( + ownerBech, + denom, + pageReq, + ) + res, err := queryClient.Deposits(context.Background(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, "deposits") + + cmd.Flags().String(flagOwner, "", "(optional) filter for deposits by owner address") + cmd.Flags().String(flagDenom, "", "(optional) filter for deposits by vault denom") + + return cmd +} + +func queryTotalDepositedCmd() *cobra.Command { + return &cobra.Command{ + Use: "total-deposited", + Short: "get the current total deposited amount", + Long: "Get the current total deposited amount in the earn module vaults.", + Args: cobra.MaximumNArgs(1), + Example: fmt.Sprintf(`%[1]s q %[2]s total-deposited +%[1]s q %[2]s total-deposited usdx`, version.AppName, types.ModuleName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + vaultDenom := "" + if len(args) > 1 { + vaultDenom = args[0] + } + + req := types.NewQueryTotalDepositedRequest(vaultDenom) + res, err := queryClient.TotalDeposited(context.Background(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } +} diff --git a/x/earn/keeper/deposit.go b/x/earn/keeper/deposit.go index d9525320..541bb206 100644 --- a/x/earn/keeper/deposit.go +++ b/x/earn/keeper/deposit.go @@ -2,7 +2,6 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/kava-labs/kava/x/earn/types" ) @@ -32,16 +31,6 @@ func (k *Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, amount sdk.C return err } - // Check if this denom is allowed for the strategy - if !strategy.IsDenomSupported(amount.Denom) { - return sdkerrors.Wrapf( - types.ErrStrategyDenomNotSupported, - "denom %s is not supported by the strategy %s", - amount.Denom, - strategy.GetStrategyType(), - ) - } - // Transfer amount to module account if err := k.bankKeeper.SendCoinsFromAccountToModule( ctx, diff --git a/x/earn/keeper/grpc_query.go b/x/earn/keeper/grpc_query.go index 30d82ed6..c2e50540 100644 --- a/x/earn/keeper/grpc_query.go +++ b/x/earn/keeper/grpc_query.go @@ -2,11 +2,14 @@ package keeper import ( "context" + "fmt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" "github.com/kava-labs/kava/x/earn/types" ) @@ -23,7 +26,10 @@ func NewQueryServerImpl(k Keeper) types.QueryServer { var _ types.QueryServer = queryServer{} // Params implements the gRPC service handler for querying x/earn parameters. -func (s queryServer) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (s queryServer) Params( + ctx context.Context, + req *types.QueryParamsRequest, +) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } @@ -33,3 +39,281 @@ func (s queryServer) Params(ctx context.Context, req *types.QueryParamsRequest) return &types.QueryParamsResponse{Params: params}, nil } + +// Vaults implements the gRPC service handler for querying x/earn vaults. +func (s queryServer) Vaults( + ctx context.Context, + req *types.QueryVaultsRequest, +) (*types.QueryVaultsResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + var queriedAllowedVaults types.AllowedVaults + + if req.Denom != "" { + // Only 1 vault + allowedVault, found := s.keeper.GetAllowedVault(sdkCtx, req.Denom) + if !found { + return nil, status.Errorf(codes.NotFound, "vault not found with specified denom") + } + + queriedAllowedVaults = types.AllowedVaults{allowedVault} + } else { + // All vaults + queriedAllowedVaults = s.keeper.GetAllowedVaults(sdkCtx) + } + + vaults := []types.VaultResponse{} + + for _, allowedVault := range queriedAllowedVaults { + totalSupplied, err := s.keeper.GetVaultTotalSupplied(sdkCtx, allowedVault.Denom) + if err != nil { + // No supply yet, no error just zero + totalSupplied = sdk.NewCoin(allowedVault.Denom, sdk.ZeroInt()) + } + + totalValue, err := s.keeper.GetVaultTotalValue(sdkCtx, allowedVault.Denom) + if err != nil { + return nil, err + } + + vaults = append(vaults, types.VaultResponse{ + Denom: allowedVault.Denom, + VaultStrategy: allowedVault.VaultStrategy, + TotalSupplied: totalSupplied.Amount, + TotalValue: totalValue.Amount, + }) + } + + return &types.QueryVaultsResponse{ + Vaults: vaults, + }, nil +} + +// Deposits implements the gRPC service handler for querying x/earn deposits. +func (s queryServer) Deposits( + ctx context.Context, + req *types.QueryDepositsRequest, +) (*types.QueryDepositsResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + // 1. Specific account and specific vault + if req.Owner != "" && req.Denom != "" { + owner, err := sdk.AccAddressFromBech32(req.Owner) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "Invalid address") + } + + shareRecord, found := s.keeper.GetVaultShareRecord(sdkCtx, owner) + if !found { + return nil, status.Error(codes.NotFound, "No deposit found for owner") + } + + if shareRecord.AmountSupplied.AmountOf(req.Denom).IsZero() { + return nil, status.Error(codes.NotFound, fmt.Sprintf("No deposit for denom %s found for owner", req.Denom)) + } + + value, err := getAccountValue(sdkCtx, s.keeper, owner, shareRecord.AmountSupplied) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + return &types.QueryDepositsResponse{ + Deposits: []types.DepositResponse{ + { + Depositor: owner.String(), + AmountSupplied: shareRecord.AmountSupplied, + Value: value, + }, + }, + Pagination: nil, + }, nil + } + + // 2. All accounts, specific vault + if req.Owner == "" && req.Denom != "" { + _, found := s.keeper.GetVaultRecord(sdkCtx, req.Denom) + if !found { + return nil, status.Error(codes.NotFound, "Vault record for denom not found") + } + + deposits := []types.DepositResponse{} + store := prefix.NewStore(sdkCtx.KVStore(s.keeper.key), types.VaultShareRecordKeyPrefix) + + pageRes, err := query.FilteredPaginate( + store, + req.Pagination, + func(key []byte, value []byte, accumulate bool) (bool, error) { + var record types.VaultShareRecord + err := s.keeper.cdc.Unmarshal(value, &record) + if err != nil { + return false, err + } + + // Only those that have amount of requested denom + if record.AmountSupplied.AmountOf(req.Denom).IsZero() { + // inform paginate that there was no match on this key + return false, nil + } + + if accumulate { + accValue, err := getAccountValue(sdkCtx, s.keeper, record.Depositor, record.AmountSupplied) + if err != nil { + return false, err + } + + // only add to results if paginate tells us to + deposits = append(deposits, types.DepositResponse{ + Depositor: record.Depositor.String(), + AmountSupplied: record.AmountSupplied, + Value: accValue, + }) + } + + // inform paginate that were was a match on this key + return true, nil + }, + ) + + if err != nil { + return nil, err + } + + return &types.QueryDepositsResponse{ + Deposits: deposits, + Pagination: pageRes, + }, nil + } + + // 3. Specific account, all vaults + if req.Owner != "" && req.Denom == "" { + owner, err := sdk.AccAddressFromBech32(req.Owner) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "Invalid address") + } + + deposits := []types.DepositResponse{} + + accountShare, found := s.keeper.GetVaultShareRecord(sdkCtx, owner) + if !found { + return nil, status.Error(codes.NotFound, "No deposit found for owner") + } + + value, err := getAccountValue(sdkCtx, s.keeper, owner, accountShare.AmountSupplied) + if err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + deposits = append(deposits, types.DepositResponse{ + Depositor: owner.String(), + AmountSupplied: accountShare.AmountSupplied, + Value: value, + }) + + return &types.QueryDepositsResponse{ + Deposits: deposits, + Pagination: nil, + }, nil + } + + // 4. All accounts, all vaults + deposits := []types.DepositResponse{} + store := prefix.NewStore(sdkCtx.KVStore(s.keeper.key), types.VaultShareRecordKeyPrefix) + + pageRes, err := query.Paginate( + store, + req.Pagination, + func(key []byte, value []byte) error { + var record types.VaultShareRecord + err := s.keeper.cdc.Unmarshal(value, &record) + if err != nil { + return err + } + + accValue, err := getAccountValue(sdkCtx, s.keeper, record.Depositor, record.AmountSupplied) + if err != nil { + return err + } + + // only add to results if paginate tells us to + deposits = append(deposits, types.DepositResponse{ + Depositor: record.Depositor.String(), + AmountSupplied: record.AmountSupplied, + Value: accValue, + }) + + return nil + }, + ) + + if err != nil { + return nil, err + } + + return &types.QueryDepositsResponse{ + Deposits: deposits, + Pagination: pageRes, + }, nil +} + +// Deposits implements the gRPC service handler for querying x/earn deposits. +func (s queryServer) TotalDeposited( + ctx context.Context, + req *types.QueryTotalDepositedRequest, +) (*types.QueryTotalDepositedResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + // Single vault + if req.Denom != "" { + totalSupplied, err := s.keeper.GetVaultTotalSupplied(sdkCtx, req.Denom) + if err != nil { + return nil, err + } + + return &types.QueryTotalDepositedResponse{ + SuppliedCoins: sdk.NewCoins(totalSupplied), + }, nil + } + + coins := sdk.NewCoins() + vaults := s.keeper.GetAllVaultRecords(sdkCtx) + + for _, vault := range vaults { + coins = coins.Add(vault.TotalSupply) + } + + return &types.QueryTotalDepositedResponse{ + SuppliedCoins: coins, + }, nil +} + +func getAccountValue( + ctx sdk.Context, + keeper Keeper, + account sdk.AccAddress, + supplied sdk.Coins, +) (sdk.Coins, error) { + value := sdk.NewCoins() + + for _, coin := range supplied { + accValue, err := keeper.GetVaultAccountValue(ctx, coin.Denom, account) + if err != nil { + return nil, err + } + + value = value.Add(sdk.NewCoin(coin.Denom, accValue.Amount)) + } + + return value, nil +} diff --git a/x/earn/keeper/grpc_query_test.go b/x/earn/keeper/grpc_query_test.go index 99eca6d1..462c5f4c 100644 --- a/x/earn/keeper/grpc_query_test.go +++ b/x/earn/keeper/grpc_query_test.go @@ -5,6 +5,9 @@ import ( "testing" "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/kava-labs/kava/x/earn/keeper" "github.com/kava-labs/kava/x/earn/testutil" @@ -53,3 +56,341 @@ func (suite *grpcQueryTestSuite) TestQueryParams() { res.Params.AllowedVaults, ) } + +func (suite *grpcQueryTestSuite) TestVaults_ZeroSupply() { + // Add vaults + suite.CreateVault("usdx", types.STRATEGY_TYPE_HARD) + suite.CreateVault("busd", types.STRATEGY_TYPE_HARD) + + suite.Run("single", func() { + res, err := suite.queryClient.Vaults(context.Background(), types.NewQueryVaultsRequest("usdx")) + suite.Require().NoError(err) + suite.Require().Len(res.Vaults, 1) + suite.Require().Equal( + types.VaultResponse{ + Denom: "usdx", + VaultStrategy: types.STRATEGY_TYPE_HARD, + TotalSupplied: sdk.NewInt(0), + TotalValue: sdk.NewInt(0), + }, + res.Vaults[0], + ) + }) + + suite.Run("all", func() { + res, err := suite.queryClient.Vaults(context.Background(), types.NewQueryVaultsRequest("")) + suite.Require().NoError(err) + suite.Require().Len(res.Vaults, 2) + suite.Require().ElementsMatch( + []types.VaultResponse{ + { + Denom: "usdx", + VaultStrategy: types.STRATEGY_TYPE_HARD, + TotalSupplied: sdk.NewInt(0), + TotalValue: sdk.NewInt(0), + }, + { + Denom: "busd", + VaultStrategy: types.STRATEGY_TYPE_HARD, + TotalSupplied: sdk.NewInt(0), + TotalValue: sdk.NewInt(0), + }, + }, + res.Vaults, + ) + }) +} + +func (suite *grpcQueryTestSuite) TestVaults_WithSupply() { + vaultDenom := "usdx" + + startBalance := sdk.NewInt64Coin(vaultDenom, 1000) + depositAmount := sdk.NewInt64Coin(vaultDenom, 100) + + suite.CreateVault(vaultDenom, types.STRATEGY_TYPE_HARD) + + acc := suite.CreateAccount(sdk.NewCoins(startBalance), 0) + + err := suite.Keeper.Deposit(suite.Ctx, acc.GetAddress(), depositAmount) + suite.Require().NoError(err) + + res, err := suite.queryClient.Vaults(context.Background(), types.NewQueryVaultsRequest("usdx")) + suite.Require().NoError(err) + suite.Require().Len(res.Vaults, 1) + suite.Require().Equal( + types.VaultResponse{ + Denom: "usdx", + VaultStrategy: types.STRATEGY_TYPE_HARD, + TotalSupplied: depositAmount.Amount, + TotalValue: depositAmount.Amount, + }, + res.Vaults[0], + ) +} + +func (suite *grpcQueryTestSuite) TestVaults_NotFound() { + _, err := suite.queryClient.Vaults(context.Background(), types.NewQueryVaultsRequest("usdx")) + suite.Require().Error(err) + suite.Require().ErrorIs(err, status.Errorf(codes.NotFound, "vault not found with specified denom")) +} + +func (suite *grpcQueryTestSuite) TestDeposits() { + vault1Denom := "usdx" + vault2Denom := "busd" + vault3Denom := "kava" + + // Add vaults + suite.CreateVault(vault1Denom, types.STRATEGY_TYPE_HARD) + suite.CreateVault(vault2Denom, types.STRATEGY_TYPE_HARD) + suite.CreateVault(vault3Denom, types.STRATEGY_TYPE_HARD) + + startBalance := sdk.NewCoins( + sdk.NewInt64Coin(vault1Denom, 1000), + sdk.NewInt64Coin(vault2Denom, 1000), + sdk.NewInt64Coin(vault3Denom, 1000), + ) + deposit1Amount := sdk.NewInt64Coin(vault1Denom, 100) + deposit2Amount := sdk.NewInt64Coin(vault2Denom, 200) + deposit3Amount := sdk.NewInt64Coin(vault3Denom, 200) + + // Accounts + acc1 := suite.CreateAccount(startBalance, 0).GetAddress() + acc2 := suite.CreateAccount(startBalance, 1).GetAddress() + + // Deposit into each vault from each account - 4 total deposits + // Acc 1: usdx + busd + // Acc 2: usdx + usdc + err := suite.Keeper.Deposit(suite.Ctx, acc1, deposit1Amount) + suite.Require().NoError(err) + err = suite.Keeper.Deposit(suite.Ctx, acc1, deposit2Amount) + suite.Require().NoError(err) + + err = suite.Keeper.Deposit(suite.Ctx, acc2, deposit1Amount) + suite.Require().NoError(err) + err = suite.Keeper.Deposit(suite.Ctx, acc2, deposit3Amount) + suite.Require().NoError(err) + + suite.Run("1) 1 vault for 1 account", func() { + // Query all deposits for account 1 + res, err := suite.queryClient.Deposits( + context.Background(), + types.NewQueryDepositsRequest(acc1.String(), vault1Denom, nil), + ) + suite.Require().NoError(err) + suite.Require().Len(res.Deposits, 1) + suite.Require().ElementsMatchf( + []types.DepositResponse{ + { + Depositor: acc1.String(), + // Still includes all deposits + AmountSupplied: sdk.NewCoins(deposit1Amount, deposit2Amount), + Value: sdk.NewCoins(deposit1Amount, deposit2Amount), + }, + }, + res.Deposits, + "deposits should match, got %v", + res.Deposits, + ) + }) + + suite.Run("1) invalid vault for 1 account", func() { + _, err := suite.queryClient.Deposits( + context.Background(), + types.NewQueryDepositsRequest(acc1.String(), "notavaliddenom", nil), + ) + suite.Require().Error(err) + suite.Require().ErrorIs(err, status.Errorf(codes.NotFound, "No deposit for denom notavaliddenom found for owner")) + }) + + suite.Run("3) all vaults for 1 account", func() { + // Query all deposits for account 1 + res, err := suite.queryClient.Deposits( + context.Background(), + types.NewQueryDepositsRequest(acc1.String(), "", nil), + ) + suite.Require().NoError(err) + suite.Require().Len(res.Deposits, 1) + suite.Require().ElementsMatch( + []types.DepositResponse{ + { + Depositor: acc1.String(), + AmountSupplied: sdk.NewCoins(deposit1Amount, deposit2Amount), + Value: sdk.NewCoins(deposit1Amount, deposit2Amount), + }, + }, + res.Deposits, + ) + }) + + suite.Run("2) all accounts, specific vault", func() { + // Query all deposits for vault 3 + res, err := suite.queryClient.Deposits( + context.Background(), + types.NewQueryDepositsRequest("", vault3Denom, nil), + ) + suite.Require().NoError(err) + suite.Require().Len(res.Deposits, 1) + suite.Require().ElementsMatch( + []types.DepositResponse{ + { + Depositor: acc2.String(), + AmountSupplied: sdk.NewCoins(deposit1Amount, deposit3Amount), + Value: sdk.NewCoins(deposit1Amount, deposit3Amount), + }, + }, + res.Deposits, + ) + }) + + suite.Run("4) all vaults and all accounts", func() { + // Query all deposits for all vaults + res, err := suite.queryClient.Deposits( + context.Background(), + types.NewQueryDepositsRequest("", "", nil), + ) + suite.Require().NoError(err) + suite.Require().Len(res.Deposits, 2) + suite.Require().ElementsMatchf( + []types.DepositResponse{ + { + Depositor: acc1.String(), + AmountSupplied: sdk.NewCoins(deposit1Amount, deposit2Amount), + Value: sdk.NewCoins(deposit1Amount, deposit2Amount), + }, + { + Depositor: acc2.String(), + AmountSupplied: sdk.NewCoins(deposit1Amount, deposit3Amount), + Value: sdk.NewCoins(deposit1Amount, deposit3Amount), + }, + }, + res.Deposits, + "deposits should match, got %v", + res.Deposits, + ) + }) +} + +func (suite *grpcQueryTestSuite) TestDeposits_NotFound() { + _, err := suite.queryClient.Deposits( + context.Background(), + types.NewQueryDepositsRequest("", "usdx", nil), + ) + suite.Require().Error(err) + suite.Require().ErrorIs(err, status.Error(codes.NotFound, "Vault record for denom not found")) +} + +func (suite *grpcQueryTestSuite) TestDeposits_InvalidAddress() { + _, err := suite.queryClient.Deposits( + context.Background(), + types.NewQueryDepositsRequest("asdf", "usdx", nil), + ) + suite.Require().Error(err) + suite.Require().ErrorIs(err, status.Error(codes.InvalidArgument, "Invalid address")) + + _, err = suite.queryClient.Deposits( + context.Background(), + types.NewQueryDepositsRequest("asdf", "", nil), + ) + suite.Require().Error(err) + suite.Require().ErrorIs(err, status.Error(codes.InvalidArgument, "Invalid address")) +} + +func (suite *grpcQueryTestSuite) TestTotalDeposited_NoSupply() { + // Add vaults + suite.CreateVault("usdx", types.STRATEGY_TYPE_HARD) + suite.CreateVault("cats", types.STRATEGY_TYPE_HARD) + + res, err := suite.queryClient.TotalDeposited(context.Background(), types.NewQueryTotalDepositedRequest("")) + suite.Require().NoError(err) + suite.Require().True(res.SuppliedCoins.Empty(), "supplied coins should be empty") +} + +func (suite *grpcQueryTestSuite) TestTotalDeposited_All() { + vault1Denom := "usdx" + vault2Denom := "busd" + + // Add vaults + suite.CreateVault(vault1Denom, types.STRATEGY_TYPE_HARD) + suite.CreateVault(vault2Denom, types.STRATEGY_TYPE_HARD) + + startBalance := sdk.NewCoins( + sdk.NewInt64Coin(vault1Denom, 1000), + sdk.NewInt64Coin(vault2Denom, 1000), + ) + deposit1Amount := sdk.NewInt64Coin(vault1Denom, 100) + deposit2Amount := sdk.NewInt64Coin(vault2Denom, 100) + + acc := suite.CreateAccount(startBalance, 0).GetAddress() + err := suite.Keeper.Deposit(suite.Ctx, acc, deposit1Amount) + suite.Require().NoError(err) + + res, err := suite.queryClient.TotalDeposited( + context.Background(), + types.NewQueryTotalDepositedRequest(""), // query all + ) + suite.Require().NoError(err) + suite.Require().Equal( + sdk.NewCoins(deposit1Amount), + res.SuppliedCoins, + "supplied coins should be sum of all supplied coins", + ) + + err = suite.Keeper.Deposit(suite.Ctx, acc, deposit2Amount) + suite.Require().NoError(err) + + res, err = suite.queryClient.TotalDeposited( + context.Background(), + types.NewQueryTotalDepositedRequest(""), // query all + ) + suite.Require().NoError(err) + suite.Require().Equal( + sdk.NewCoins(deposit1Amount, deposit2Amount), + res.SuppliedCoins, + "supplied coins should be sum of all supplied coins for multiple coins", + ) +} + +func (suite *grpcQueryTestSuite) TestTotalDeposited_Single() { + vault1Denom := "usdx" + vault2Denom := "busd" + + // Add vaults + suite.CreateVault(vault1Denom, types.STRATEGY_TYPE_HARD) + suite.CreateVault(vault2Denom, types.STRATEGY_TYPE_HARD) + + startBalance := sdk.NewCoins( + sdk.NewInt64Coin(vault1Denom, 1000), + sdk.NewInt64Coin(vault2Denom, 1000), + ) + deposit1Amount := sdk.NewInt64Coin(vault1Denom, 100) + deposit2Amount := sdk.NewInt64Coin(vault2Denom, 100) + + acc := suite.CreateAccount(startBalance, 0).GetAddress() + err := suite.Keeper.Deposit(suite.Ctx, acc, deposit1Amount) + suite.Require().NoError(err) + + err = suite.Keeper.Deposit(suite.Ctx, acc, deposit2Amount) + suite.Require().NoError(err) + + res, err := suite.queryClient.TotalDeposited( + context.Background(), + types.NewQueryTotalDepositedRequest(vault1Denom), + ) + suite.Require().NoError(err) + suite.Require().Equal( + sdk.NewCoins(deposit1Amount), + res.SuppliedCoins, + "should only contain queried denom", + ) + + res, err = suite.queryClient.TotalDeposited( + context.Background(), + types.NewQueryTotalDepositedRequest(vault2Denom), + ) + suite.Require().NoError(err) + suite.Require().Equal( + sdk.NewCoins(deposit2Amount), + res.SuppliedCoins, + "should only contain queried denom", + ) +} diff --git a/x/earn/keeper/strategy.go b/x/earn/keeper/strategy.go index dd5ceb58..ec787da9 100644 --- a/x/earn/keeper/strategy.go +++ b/x/earn/keeper/strategy.go @@ -12,10 +12,6 @@ type Strategy interface { // GetStrategyType returns the strategy type GetStrategyType() types.StrategyType - // IsDenomSupported returns true if the denom is supported for this - // strategy. For example, the hard strategy supports "usdx". - IsDenomSupported(string) bool - // GetEstimatedTotalAssets returns the estimated total assets denominated in // GetDenom() of this strategy. This is the value if the strategy were to // liquidate all assets. diff --git a/x/earn/keeper/strategy_hard_test.go b/x/earn/keeper/strategy_hard_test.go index 33a172bd..774dc18d 100644 --- a/x/earn/keeper/strategy_hard_test.go +++ b/x/earn/keeper/strategy_hard_test.go @@ -24,13 +24,6 @@ func TestStrategyLendTestSuite(t *testing.T) { suite.Run(t, new(strategyHardTestSuite)) } -func (suite *strategyHardTestSuite) TestGetSupportedDenoms() { - strategy, err := suite.Keeper.GetStrategy(types.STRATEGY_TYPE_HARD) - suite.Require().NoError(err) - - suite.True(strategy.IsDenomSupported("usdx")) -} - func (suite *strategyHardTestSuite) TestGetStrategyType() { strategy, err := suite.Keeper.GetStrategy(types.STRATEGY_TYPE_HARD) suite.Require().NoError(err) @@ -38,25 +31,6 @@ func (suite *strategyHardTestSuite) TestGetStrategyType() { suite.Equal(types.STRATEGY_TYPE_HARD, strategy.GetStrategyType()) } -func (suite *strategyHardTestSuite) TestDeposit_InvalidDenom() { - // Not supported by hard strategy - vaultDenom := "busd" - startBalance := sdk.NewInt64Coin(vaultDenom, 1000) - depositAmount := sdk.NewInt64Coin(vaultDenom, 100) - - suite.CreateVault(vaultDenom, types.STRATEGY_TYPE_HARD) - - acc := suite.CreateAccount(sdk.NewCoins(startBalance), 0) - - err := suite.Keeper.Deposit(suite.Ctx, acc.GetAddress(), depositAmount) - suite.Require().Error(err) - suite.Require().ErrorIs( - err, - types.ErrStrategyDenomNotSupported, - "strategy should only allow usdx deposits", - ) -} - func (suite *strategyHardTestSuite) TestDeposit_SingleAcc() { vaultDenom := "usdx" startBalance := sdk.NewInt64Coin(vaultDenom, 1000) diff --git a/x/earn/keeper/vault.go b/x/earn/keeper/vault.go index a6adcf2c..82e51d32 100644 --- a/x/earn/keeper/vault.go +++ b/x/earn/keeper/vault.go @@ -136,6 +136,37 @@ func (k *Keeper) SetVaultRecord(ctx sdk.Context, record types.VaultRecord) { store.Set(types.VaultKey(record.Denom), bz) } +// IterateVaultRecords iterates over all vault objects in the store and performs +// a callback function. +func (k Keeper) IterateVaultRecords( + ctx sdk.Context, + cb func(record types.VaultRecord) (stop bool), +) { + store := prefix.NewStore(ctx.KVStore(k.key), types.VaultRecordKeyPrefix) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var record types.VaultRecord + k.cdc.MustUnmarshal(iterator.Value(), &record) + if cb(record) { + break + } + } +} + +// GetAllVaultRecords returns all vault records from the store. +func (k Keeper) GetAllVaultRecords(ctx sdk.Context) types.VaultRecords { + var records types.VaultRecords + + k.IterateVaultRecords(ctx, func(record types.VaultRecord) bool { + records = append(records, record) + return false + }) + + return records +} + // ---------------------------------------------------------------------------- // VaultShare -- user shares per vault diff --git a/x/earn/testutil/suite.go b/x/earn/testutil/suite.go index 53b4bd27..4cf303fd 100644 --- a/x/earn/testutil/suite.go +++ b/x/earn/testutil/suite.go @@ -94,6 +94,42 @@ func (suite *Suite) SetupTest() { sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec(), ), + hardtypes.NewMoneyMarket( + "busd", + hardtypes.NewBorrowLimit( + true, + sdk.MustNewDecFromStr("20000000"), + sdk.MustNewDecFromStr("1"), + ), + "busd:usd", + sdk.NewInt(1000000), + hardtypes.NewInterestRateModel( + sdk.MustNewDecFromStr("0.05"), + sdk.MustNewDecFromStr("2"), + sdk.MustNewDecFromStr("0.8"), + sdk.MustNewDecFromStr("10"), + ), + sdk.MustNewDecFromStr("0.05"), + sdk.ZeroDec(), + ), + hardtypes.NewMoneyMarket( + "kava", + hardtypes.NewBorrowLimit( + true, + sdk.MustNewDecFromStr("20000000"), + sdk.MustNewDecFromStr("1"), + ), + "kava:usd", + sdk.NewInt(1000000), + hardtypes.NewInterestRateModel( + sdk.MustNewDecFromStr("0.05"), + sdk.MustNewDecFromStr("2"), + sdk.MustNewDecFromStr("0.8"), + sdk.MustNewDecFromStr("10"), + ), + sdk.MustNewDecFromStr("0.05"), + sdk.ZeroDec(), + ), }, sdk.NewDec(10), ), @@ -185,9 +221,12 @@ func (suite *Suite) CreateVault(vaultDenom string, vaultStrategy types.StrategyT allowedVaults := suite.Keeper.GetAllowedVaults(suite.Ctx) allowedVaults = append(allowedVaults, vault) + params := types.NewParams(allowedVaults) + suite.Require().NoError(params.Validate()) + suite.Keeper.SetParams( suite.Ctx, - types.NewParams(allowedVaults), + params, ) } diff --git a/x/earn/types/errors.go b/x/earn/types/errors.go index dfd2e8fb..7f65a1eb 100644 --- a/x/earn/types/errors.go +++ b/x/earn/types/errors.go @@ -6,11 +6,10 @@ import ( // earn module errors var ( - ErrInvalidVaultDenom = sdkerrors.Register(ModuleName, 2, "invalid vault denom") - ErrInvalidVaultStrategy = sdkerrors.Register(ModuleName, 3, "invalid vault strategy") - ErrInsufficientAmount = sdkerrors.Register(ModuleName, 4, "insufficient amount") - ErrInsufficientValue = sdkerrors.Register(ModuleName, 5, "insufficient vault account value") - ErrVaultRecordNotFound = sdkerrors.Register(ModuleName, 6, "vault record not found") - ErrVaultShareRecordNotFound = sdkerrors.Register(ModuleName, 7, "vault share record not found") - ErrStrategyDenomNotSupported = sdkerrors.Register(ModuleName, 8, "denom not supported for strategy") + ErrInvalidVaultDenom = sdkerrors.Register(ModuleName, 2, "invalid vault denom") + ErrInvalidVaultStrategy = sdkerrors.Register(ModuleName, 3, "invalid vault strategy") + ErrInsufficientAmount = sdkerrors.Register(ModuleName, 4, "insufficient amount") + ErrInsufficientValue = sdkerrors.Register(ModuleName, 5, "insufficient vault account value") + ErrVaultRecordNotFound = sdkerrors.Register(ModuleName, 6, "vault record not found") + ErrVaultShareRecordNotFound = sdkerrors.Register(ModuleName, 7, "vault share record not found") ) diff --git a/x/earn/types/genesis.pb.go b/x/earn/types/genesis.pb.go index c71187d4..f6964bf0 100644 --- a/x/earn/types/genesis.pb.go +++ b/x/earn/types/genesis.pb.go @@ -94,26 +94,26 @@ func init() { func init() { proto.RegisterFile("kava/earn/v1beta1/genesis.proto", fileDescriptor_514fe130cb964f8c) } var fileDescriptor_514fe130cb964f8c = []byte{ - // 293 bytes of a gzipped FileDescriptorProto + // 294 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcf, 0x4e, 0x2c, 0x4b, 0xd4, 0x4f, 0x4d, 0x2c, 0xca, 0xd3, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x04, 0x29, 0xd0, - 0x03, 0x29, 0xd0, 0x83, 0x2a, 0x90, 0x92, 0xc5, 0xd4, 0x53, 0x96, 0x58, 0x9a, 0x53, 0x02, 0xd1, - 0x21, 0x25, 0x87, 0x29, 0x5d, 0x90, 0x58, 0x94, 0x98, 0x0b, 0x35, 0x51, 0x4a, 0x24, 0x3d, 0x3f, - 0x3d, 0x1f, 0xcc, 0xd4, 0x07, 0xb1, 0x20, 0xa2, 0x4a, 0x93, 0x98, 0xb8, 0x78, 0xdc, 0x21, 0x36, - 0x07, 0x97, 0x24, 0x96, 0xa4, 0x0a, 0x99, 0x73, 0xb1, 0x41, 0xb4, 0x49, 0x30, 0x2a, 0x30, 0x6a, - 0x70, 0x1b, 0x49, 0xea, 0x61, 0xb8, 0x44, 0x2f, 0x00, 0xac, 0xc0, 0x89, 0xe5, 0xc4, 0x3d, 0x79, - 0x86, 0x20, 0xa8, 0x72, 0xa1, 0x48, 0x2e, 0x5e, 0xb0, 0x73, 0xe2, 0x8b, 0x52, 0x93, 0xf3, 0x8b, - 0x52, 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, 0xb8, 0x8d, 0xe4, 0xb0, 0xe8, 0x0f, 0x03, 0xa9, 0x0b, - 0x02, 0x2b, 0x73, 0x12, 0x01, 0x19, 0xb2, 0xea, 0xbe, 0x3c, 0x0f, 0x92, 0x60, 0x71, 0x10, 0x4f, - 0x19, 0x12, 0x4f, 0x28, 0x8f, 0x4b, 0x18, 0x62, 0x74, 0x71, 0x46, 0x62, 0x51, 0x2a, 0xdc, 0x02, - 0x66, 0xb0, 0x05, 0xca, 0xb8, 0x2c, 0x08, 0x06, 0x29, 0x86, 0xda, 0x22, 0x09, 0xb5, 0x45, 0x10, - 0x5d, 0xa6, 0x38, 0x48, 0xb0, 0x0c, 0x5d, 0xc8, 0xc9, 0xe1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, - 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, - 0x8f, 0xe5, 0x18, 0xa2, 0xd4, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, - 0x41, 0xd6, 0xea, 0xe6, 0x24, 0x26, 0x15, 0x83, 0x59, 0xfa, 0x15, 0x90, 0xb0, 0x2f, 0xa9, 0x2c, - 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x87, 0xae, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x97, 0x15, 0xe4, - 0xfa, 0xe8, 0x01, 0x00, 0x00, + 0x03, 0x29, 0xd0, 0x83, 0x2a, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xea, 0x83, 0x58, + 0x10, 0x85, 0x52, 0x72, 0x98, 0x26, 0x15, 0x24, 0x16, 0x25, 0xe6, 0x42, 0x0d, 0x92, 0x92, 0xc5, + 0x94, 0x2f, 0x4b, 0x2c, 0xcd, 0x29, 0x81, 0x48, 0x2b, 0x4d, 0x62, 0xe2, 0xe2, 0x71, 0x87, 0xd8, + 0x1c, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0x64, 0xce, 0xc5, 0x06, 0xd1, 0x2f, 0xc1, 0xa8, 0xc0, 0xa8, + 0xc1, 0x6d, 0x24, 0xa9, 0x87, 0xe1, 0x12, 0xbd, 0x00, 0xb0, 0x02, 0x27, 0x96, 0x13, 0xf7, 0xe4, + 0x19, 0x82, 0xa0, 0xca, 0x85, 0x22, 0xb9, 0x78, 0xc1, 0x06, 0xc7, 0x17, 0xa5, 0x26, 0xe7, 0x17, + 0xa5, 0x14, 0x4b, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x1b, 0xc9, 0x61, 0xd1, 0x1f, 0x06, 0x52, 0x17, + 0x04, 0x56, 0xe6, 0x24, 0x02, 0x32, 0x64, 0xd5, 0x7d, 0x79, 0x1e, 0x24, 0xc1, 0xe2, 0x20, 0x9e, + 0x32, 0x24, 0x9e, 0x50, 0x1e, 0x97, 0x30, 0xc4, 0xe8, 0xe2, 0x8c, 0xc4, 0xa2, 0x54, 0xb8, 0x05, + 0xcc, 0x60, 0x0b, 0x94, 0x71, 0x59, 0x10, 0x0c, 0x52, 0x0c, 0xb5, 0x45, 0x12, 0x6a, 0x8b, 0x20, + 0xba, 0x4c, 0x71, 0x90, 0x60, 0x19, 0xba, 0x90, 0x93, 0xc3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, + 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, + 0x1e, 0xcb, 0x31, 0x44, 0xa9, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, + 0x83, 0xac, 0xd5, 0xcd, 0x49, 0x4c, 0x2a, 0x06, 0xb3, 0xf4, 0x2b, 0x20, 0x81, 0x5c, 0x52, 0x59, + 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x5d, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x54, + 0x3b, 0x56, 0xe8, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/earn/types/params.pb.go b/x/earn/types/params.pb.go index 652f43f4..3062b1cd 100644 --- a/x/earn/types/params.pb.go +++ b/x/earn/types/params.pb.go @@ -23,6 +23,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Params defines the parameters of the earn module. type Params struct { AllowedVaults AllowedVaults `protobuf:"bytes,1,rep,name=allowed_vaults,json=allowedVaults,proto3,castrepeated=AllowedVaults" json:"allowed_vaults"` } diff --git a/x/earn/types/query.go b/x/earn/types/query.go index 6323482a..8649bd22 100644 --- a/x/earn/types/query.go +++ b/x/earn/types/query.go @@ -1,5 +1,35 @@ package types +import "github.com/cosmos/cosmos-sdk/types/query" + +// NewQueryParamsRequest returns a new QueryParamsRequest func NewQueryParamsRequest() *QueryParamsRequest { return &QueryParamsRequest{} } + +// NewQueryVaultsRequest returns a new QueryVaultsRequest +func NewQueryVaultsRequest(denom string) *QueryVaultsRequest { + return &QueryVaultsRequest{ + Denom: denom, + } +} + +// NewQueryDepositsRequest returns a new QueryDepositsRequest +func NewQueryDepositsRequest( + owner string, + denom string, + pagination *query.PageRequest, +) *QueryDepositsRequest { + return &QueryDepositsRequest{ + Owner: owner, + Denom: denom, + Pagination: pagination, + } +} + +// NewQueryTotalDepositedRequest returns a new QueryTotalDepositedRequest +func NewQueryTotalDepositedRequest(denom string) *QueryTotalDepositedRequest { + return &QueryTotalDepositedRequest{ + Denom: denom, + } +} diff --git a/x/earn/types/query.pb.go b/x/earn/types/query.pb.go index f6b002e4..0615b823 100644 --- a/x/earn/types/query.pb.go +++ b/x/earn/types/query.pb.go @@ -7,6 +7,9 @@ import ( context "context" fmt "fmt" _ "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" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -106,34 +109,406 @@ func (m *QueryParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo +// QueryVaultsRequest is the request type for the Query/Vault RPC method. +type QueryVaultsRequest struct { + // vault filters vault by denom + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryVaultsRequest) Reset() { *m = QueryVaultsRequest{} } +func (m *QueryVaultsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVaultsRequest) ProtoMessage() {} +func (*QueryVaultsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_63f8dee2f3192a6b, []int{2} +} +func (m *QueryVaultsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVaultsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVaultsRequest.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 *QueryVaultsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVaultsRequest.Merge(m, src) +} +func (m *QueryVaultsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVaultsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVaultsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVaultsRequest proto.InternalMessageInfo + +// QueryVaultsResponse is the response type for the Query/Vaults RPC method. +type QueryVaultsResponse struct { + // vaults represents the earn module vaults + Vaults []VaultResponse `protobuf:"bytes,1,rep,name=vaults,proto3" json:"vaults"` +} + +func (m *QueryVaultsResponse) Reset() { *m = QueryVaultsResponse{} } +func (m *QueryVaultsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVaultsResponse) ProtoMessage() {} +func (*QueryVaultsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_63f8dee2f3192a6b, []int{3} +} +func (m *QueryVaultsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVaultsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVaultsResponse.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 *QueryVaultsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVaultsResponse.Merge(m, src) +} +func (m *QueryVaultsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVaultsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVaultsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVaultsResponse proto.InternalMessageInfo + +// VaultResponse is the response type for a vault. +type VaultResponse struct { + // denom represents the denom of the vault + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + // VaultStrategy is the strategy used for this vault. + VaultStrategy StrategyType `protobuf:"varint,2,opt,name=vault_strategy,json=vaultStrategy,proto3,enum=kava.earn.v1beta1.StrategyType" json:"vault_strategy,omitempty"` + // TotalSupplied is the total amount of denom coins supplied to the vault. + TotalSupplied github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=total_supplied,json=totalSupplied,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_supplied"` + // TotalValue is the total value of denom coins supplied to the vault if the + // vault were to be liquidated. + TotalValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=total_value,json=totalValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_value"` +} + +func (m *VaultResponse) Reset() { *m = VaultResponse{} } +func (m *VaultResponse) String() string { return proto.CompactTextString(m) } +func (*VaultResponse) ProtoMessage() {} +func (*VaultResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_63f8dee2f3192a6b, []int{4} +} +func (m *VaultResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VaultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VaultResponse.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 *VaultResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_VaultResponse.Merge(m, src) +} +func (m *VaultResponse) XXX_Size() int { + return m.Size() +} +func (m *VaultResponse) XXX_DiscardUnknown() { + xxx_messageInfo_VaultResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_VaultResponse proto.InternalMessageInfo + +// QueryDepositsRequest is the request type for the Query/Deposits RPC method. +type QueryDepositsRequest struct { + // owner optionally filters deposits by owner + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // denom optionally filters deposits by vault denom + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDepositsRequest) Reset() { *m = QueryDepositsRequest{} } +func (m *QueryDepositsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDepositsRequest) ProtoMessage() {} +func (*QueryDepositsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_63f8dee2f3192a6b, []int{5} +} +func (m *QueryDepositsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDepositsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDepositsRequest.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 *QueryDepositsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDepositsRequest.Merge(m, src) +} +func (m *QueryDepositsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDepositsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDepositsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDepositsRequest proto.InternalMessageInfo + +// QueryDepositsResponse is the response type for the Query/Deposits RPC method. +type QueryDepositsResponse struct { + // deposits returns the deposits matching the requested parameters + Deposits []DepositResponse `protobuf:"bytes,1,rep,name=deposits,proto3" json:"deposits"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDepositsResponse) Reset() { *m = QueryDepositsResponse{} } +func (m *QueryDepositsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDepositsResponse) ProtoMessage() {} +func (*QueryDepositsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_63f8dee2f3192a6b, []int{6} +} +func (m *QueryDepositsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDepositsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDepositsResponse.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 *QueryDepositsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDepositsResponse.Merge(m, src) +} +func (m *QueryDepositsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDepositsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDepositsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDepositsResponse proto.InternalMessageInfo + +// DepositResponse defines a deposit query response type. +type DepositResponse struct { + // depositor represents the owner of the deposit. + Depositor string `protobuf:"bytes,1,opt,name=depositor,proto3" json:"depositor,omitempty"` + // Amount represents the amount supplied to vaults. + AmountSupplied github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=amount_supplied,json=amountSupplied,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount_supplied"` + // Value represents the total accumulated value of denom coins supplied to + // vaults. This may be greater than or equal to amount_supplied depending on + // the strategy. + Value github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=value,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"value"` +} + +func (m *DepositResponse) Reset() { *m = DepositResponse{} } +func (m *DepositResponse) String() string { return proto.CompactTextString(m) } +func (*DepositResponse) ProtoMessage() {} +func (*DepositResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_63f8dee2f3192a6b, []int{7} +} +func (m *DepositResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DepositResponse.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 *DepositResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DepositResponse.Merge(m, src) +} +func (m *DepositResponse) XXX_Size() int { + return m.Size() +} +func (m *DepositResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DepositResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DepositResponse proto.InternalMessageInfo + +// QueryTotalDepositedRequest is the request type for the Query/TotalDeposited RPC method. +type QueryTotalDepositedRequest struct { + // denom represents the vault denom to query total deposited amount for. + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryTotalDepositedRequest) Reset() { *m = QueryTotalDepositedRequest{} } +func (m *QueryTotalDepositedRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalDepositedRequest) ProtoMessage() {} +func (*QueryTotalDepositedRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_63f8dee2f3192a6b, []int{8} +} +func (m *QueryTotalDepositedRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalDepositedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalDepositedRequest.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 *QueryTotalDepositedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalDepositedRequest.Merge(m, src) +} +func (m *QueryTotalDepositedRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalDepositedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalDepositedRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalDepositedRequest proto.InternalMessageInfo + +// QueryTotalDepositedResponse is the response type for the Query/TotalDeposited RPC method. +type QueryTotalDepositedResponse struct { + SuppliedCoins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=supplied_coins,json=suppliedCoins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"supplied_coins"` +} + +func (m *QueryTotalDepositedResponse) Reset() { *m = QueryTotalDepositedResponse{} } +func (m *QueryTotalDepositedResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalDepositedResponse) ProtoMessage() {} +func (*QueryTotalDepositedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_63f8dee2f3192a6b, []int{9} +} +func (m *QueryTotalDepositedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalDepositedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalDepositedResponse.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 *QueryTotalDepositedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalDepositedResponse.Merge(m, src) +} +func (m *QueryTotalDepositedResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalDepositedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalDepositedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalDepositedResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "kava.earn.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "kava.earn.v1beta1.QueryParamsResponse") + proto.RegisterType((*QueryVaultsRequest)(nil), "kava.earn.v1beta1.QueryVaultsRequest") + proto.RegisterType((*QueryVaultsResponse)(nil), "kava.earn.v1beta1.QueryVaultsResponse") + proto.RegisterType((*VaultResponse)(nil), "kava.earn.v1beta1.VaultResponse") + proto.RegisterType((*QueryDepositsRequest)(nil), "kava.earn.v1beta1.QueryDepositsRequest") + proto.RegisterType((*QueryDepositsResponse)(nil), "kava.earn.v1beta1.QueryDepositsResponse") + proto.RegisterType((*DepositResponse)(nil), "kava.earn.v1beta1.DepositResponse") + proto.RegisterType((*QueryTotalDepositedRequest)(nil), "kava.earn.v1beta1.QueryTotalDepositedRequest") + proto.RegisterType((*QueryTotalDepositedResponse)(nil), "kava.earn.v1beta1.QueryTotalDepositedResponse") } func init() { proto.RegisterFile("kava/earn/v1beta1/query.proto", fileDescriptor_63f8dee2f3192a6b) } var fileDescriptor_63f8dee2f3192a6b = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcd, 0x4e, 0x2c, 0x4b, - 0xd4, 0x4f, 0x4d, 0x2c, 0xca, 0xd3, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x2c, - 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x04, 0x49, 0xeb, 0x81, 0xa4, - 0xf5, 0xa0, 0xd2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x59, 0x7d, 0x10, 0x0b, 0xa2, 0x50, - 0x4a, 0x26, 0x3d, 0x3f, 0x3f, 0x3d, 0x27, 0x55, 0x3f, 0xb1, 0x20, 0x53, 0x3f, 0x31, 0x2f, 0x2f, - 0xbf, 0x24, 0xb1, 0x24, 0x33, 0x3f, 0xaf, 0x18, 0x2a, 0x2b, 0x99, 0x9c, 0x5f, 0x9c, 0x9b, 0x5f, - 0x1c, 0x0f, 0xd1, 0x06, 0xe1, 0x40, 0xa5, 0xe4, 0x30, 0x1d, 0x50, 0x90, 0x58, 0x94, 0x98, 0x0b, - 0x95, 0x57, 0x92, 0xe2, 0x12, 0x0a, 0x04, 0x39, 0x28, 0x00, 0x2c, 0x18, 0x94, 0x5a, 0x58, 0x9a, - 0x5a, 0x5c, 0x62, 0xc5, 0xd2, 0xb1, 0x40, 0x9e, 0x41, 0x29, 0x84, 0x4b, 0x18, 0x45, 0xae, 0xb8, - 0x20, 0x3f, 0xaf, 0x38, 0x55, 0xc8, 0x9c, 0x8b, 0x0d, 0x62, 0x84, 0x04, 0xa3, 0x02, 0xa3, 0x06, - 0xb7, 0x91, 0xa4, 0x1e, 0x86, 0x2f, 0xf4, 0x20, 0x5a, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, - 0x82, 0x2a, 0x87, 0x98, 0x6a, 0xd4, 0xcc, 0xc8, 0xc5, 0x0a, 0x36, 0x56, 0xa8, 0x8a, 0x8b, 0x0d, - 0xa2, 0x4e, 0x48, 0x15, 0x8b, 0x11, 0x98, 0xce, 0x92, 0x52, 0x23, 0xa4, 0x0c, 0xe2, 0x42, 0x25, - 0xc5, 0xa6, 0xcb, 0x4f, 0x26, 0x33, 0x49, 0x0b, 0x49, 0xea, 0xe3, 0xf2, 0xbd, 0x93, 0xc3, 0x89, - 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, - 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xa9, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, - 0xe9, 0x25, 0xe7, 0xe7, 0x82, 0xb5, 0xeb, 0xe6, 0x24, 0x26, 0x15, 0x43, 0x0c, 0xaa, 0x80, 0x18, - 0x55, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x40, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x84, 0xd8, 0x0f, 0xf9, 0xe3, 0x01, 0x00, 0x00, + // 833 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6f, 0xd3, 0x48, + 0x14, 0x8f, 0xd3, 0x26, 0x6a, 0x27, 0x4a, 0xaa, 0x9d, 0xcd, 0x4a, 0x49, 0xba, 0x75, 0x52, 0x57, + 0xdb, 0x66, 0xab, 0x8d, 0xbd, 0xcd, 0x4a, 0xbb, 0x97, 0xd5, 0x4a, 0x9b, 0xad, 0x16, 0xf5, 0x82, + 0xc0, 0x2d, 0x3d, 0x20, 0xa1, 0x68, 0x12, 0x8f, 0x8c, 0xd5, 0xc4, 0xe3, 0xda, 0x93, 0x40, 0x41, + 0x5c, 0xfa, 0x09, 0x40, 0x7c, 0x03, 0x40, 0x1c, 0xb8, 0x21, 0xfa, 0x21, 0x7a, 0xac, 0xca, 0x05, + 0x71, 0x28, 0xd0, 0xf2, 0x41, 0x90, 0xe7, 0x4f, 0x52, 0x27, 0x0e, 0xe9, 0xa1, 0xa7, 0x64, 0xe6, + 0xbd, 0xf7, 0xfb, 0xfd, 0xe6, 0xcd, 0x6f, 0x9e, 0xc1, 0xd2, 0x1e, 0xea, 0x23, 0x03, 0x23, 0xdf, + 0x35, 0xfa, 0x1b, 0x2d, 0x4c, 0xd1, 0x86, 0xb1, 0xdf, 0xc3, 0xfe, 0x81, 0xee, 0xf9, 0x84, 0x12, + 0xf8, 0x43, 0x18, 0xd6, 0xc3, 0xb0, 0x2e, 0xc2, 0xa5, 0x62, 0x9b, 0x04, 0x5d, 0x12, 0x34, 0x59, + 0x82, 0xc1, 0x17, 0x3c, 0xbb, 0xb4, 0xce, 0x57, 0x46, 0x0b, 0x05, 0x98, 0xc3, 0x0c, 0x40, 0x3d, + 0x64, 0x3b, 0x2e, 0xa2, 0x0e, 0x71, 0x45, 0xae, 0x7a, 0x39, 0x57, 0x66, 0xb5, 0x89, 0x23, 0xe3, + 0x79, 0x9b, 0xd8, 0x84, 0x73, 0x84, 0xff, 0xc4, 0xee, 0xcf, 0x36, 0x21, 0x76, 0x07, 0x1b, 0xc8, + 0x73, 0x0c, 0xe4, 0xba, 0x84, 0x32, 0x48, 0xc9, 0xaf, 0x8e, 0x1f, 0xc6, 0x43, 0x3e, 0xea, 0xca, + 0x78, 0x65, 0x3c, 0x1e, 0x50, 0x1f, 0x51, 0x6c, 0x8b, 0xf3, 0x6a, 0x79, 0x00, 0x6f, 0x87, 0xba, + 0x6f, 0xb1, 0x32, 0x13, 0xef, 0xf7, 0x70, 0x40, 0xb5, 0x9b, 0xe0, 0xc7, 0xc8, 0x6e, 0xe0, 0x11, + 0x37, 0xc0, 0xf0, 0x2f, 0x90, 0xe6, 0xf0, 0x05, 0xa5, 0xa2, 0x54, 0x33, 0xf5, 0xa2, 0x3e, 0xd6, + 0x2d, 0x9d, 0x97, 0x34, 0x66, 0x8f, 0xcf, 0xca, 0x09, 0x53, 0xa4, 0x6b, 0xeb, 0x82, 0x65, 0x17, + 0xf5, 0x3a, 0x54, 0xb2, 0xc0, 0x3c, 0x48, 0x59, 0xd8, 0x25, 0x5d, 0x86, 0x36, 0x6f, 0xf2, 0x85, + 0x76, 0x47, 0x70, 0xcb, 0x5c, 0xc1, 0xfd, 0x0f, 0x48, 0xf7, 0xd9, 0x4e, 0x41, 0xa9, 0xcc, 0x54, + 0x33, 0xf5, 0x4a, 0x0c, 0x37, 0x2b, 0x91, 0x15, 0x52, 0x02, 0xaf, 0xd2, 0xde, 0x26, 0x41, 0x36, + 0x12, 0x8f, 0xa7, 0x87, 0xff, 0x83, 0x1c, 0xab, 0x68, 0xca, 0x46, 0x15, 0x92, 0x15, 0xa5, 0x9a, + 0xab, 0x97, 0x63, 0xf8, 0xb6, 0x45, 0xca, 0xce, 0x81, 0x87, 0xcd, 0x2c, 0x2b, 0x93, 0x5b, 0xb0, + 0x0d, 0x72, 0x94, 0x50, 0xd4, 0x69, 0x06, 0x3d, 0xcf, 0xeb, 0x38, 0xd8, 0x2a, 0xcc, 0x84, 0x34, + 0x8d, 0xbf, 0x43, 0x55, 0x1f, 0xcf, 0xca, 0xab, 0xb6, 0x43, 0xef, 0xf7, 0x5a, 0x7a, 0x9b, 0x74, + 0x85, 0xa7, 0xc4, 0x4f, 0x2d, 0xb0, 0xf6, 0x0c, 0x7a, 0xe0, 0xe1, 0x40, 0xdf, 0x72, 0xe9, 0xe9, + 0x51, 0x0d, 0x08, 0xcb, 0x6d, 0xb9, 0xd4, 0xcc, 0x32, 0xcc, 0x6d, 0x01, 0x09, 0xef, 0x81, 0x0c, + 0x27, 0xe9, 0xa3, 0x4e, 0x0f, 0x17, 0x66, 0xaf, 0x81, 0x01, 0x30, 0xc0, 0xdd, 0x10, 0x4f, 0x7b, + 0xa5, 0x80, 0x3c, 0xbb, 0x8b, 0x4d, 0xec, 0x91, 0xc0, 0x19, 0xde, 0x9c, 0x0e, 0x52, 0xe4, 0x81, + 0x8b, 0x7d, 0xde, 0xba, 0x46, 0xe1, 0xf4, 0xa8, 0x96, 0x17, 0x18, 0xff, 0x5a, 0x96, 0x8f, 0x83, + 0x60, 0x9b, 0xfa, 0x8e, 0x6b, 0x9b, 0x3c, 0x6d, 0xd8, 0xea, 0x64, 0xb4, 0xd5, 0x60, 0xf8, 0x4a, + 0x58, 0x7b, 0x32, 0xf5, 0x55, 0x5d, 0xe0, 0x84, 0xcf, 0x44, 0xe7, 0x2f, 0x73, 0x68, 0x2d, 0x1b, + 0x0b, 0x05, 0xe6, 0xa5, 0x4a, 0xed, 0xb5, 0x02, 0x7e, 0x1a, 0x91, 0x29, 0xae, 0x78, 0x13, 0xcc, + 0x59, 0x62, 0x4f, 0xd8, 0x46, 0x8b, 0xb9, 0x46, 0x51, 0x36, 0x62, 0x9c, 0x41, 0x25, 0xbc, 0x11, + 0xd1, 0x99, 0x64, 0x3a, 0xd7, 0xa6, 0xea, 0xe4, 0x60, 0x11, 0xa1, 0x2f, 0x92, 0x60, 0x61, 0x84, + 0x0c, 0xfe, 0x09, 0xe6, 0x05, 0x11, 0x99, 0xde, 0xce, 0x61, 0x2a, 0xa4, 0x60, 0x01, 0x75, 0x49, + 0xcf, 0xa5, 0x43, 0x83, 0x25, 0xd9, 0x09, 0x8b, 0x11, 0x65, 0x52, 0xd3, 0x7f, 0xc4, 0x71, 0x1b, + 0xbf, 0x87, 0x07, 0x7b, 0xf3, 0xa9, 0x5c, 0xbd, 0x82, 0x33, 0xc2, 0x82, 0xc0, 0xcc, 0x71, 0x8e, + 0x81, 0xe1, 0x10, 0x48, 0x71, 0xab, 0xcd, 0x5c, 0x3f, 0x17, 0x47, 0xd6, 0xea, 0xa0, 0xc4, 0x2e, + 0x73, 0x27, 0xf4, 0xa1, 0xe8, 0x16, 0xb6, 0xbe, 0x3f, 0x33, 0x9e, 0x29, 0x60, 0x31, 0xb6, 0x48, + 0x34, 0xd9, 0x07, 0x39, 0xd9, 0xa5, 0x66, 0x38, 0x72, 0xa5, 0x1b, 0xae, 0x55, 0x7f, 0x56, 0x52, + 0xb0, 0x65, 0xfd, 0xdd, 0x2c, 0x48, 0x31, 0x4d, 0xf0, 0x11, 0x48, 0xf3, 0xa9, 0x08, 0x7f, 0x89, + 0x71, 0xdf, 0xf8, 0xf8, 0x2d, 0xad, 0x4e, 0x4b, 0xe3, 0xc7, 0xd2, 0x96, 0x0f, 0xdf, 0x7f, 0x7d, + 0x9e, 0x5c, 0x84, 0x45, 0x63, 0xd2, 0x77, 0x00, 0x1e, 0x2a, 0x20, 0xcd, 0x27, 0xe9, 0x64, 0xf2, + 0xc8, 0x54, 0x9e, 0x4c, 0x1e, 0x1d, 0xc8, 0xda, 0xaf, 0x8c, 0x7c, 0x05, 0x2e, 0xc7, 0x90, 0xf3, + 0x99, 0x6b, 0x3c, 0x66, 0xb7, 0xf3, 0x24, 0x14, 0x31, 0x27, 0xdf, 0x26, 0x5c, 0x9b, 0x84, 0x3f, + 0x32, 0x64, 0x4a, 0xd5, 0xe9, 0x89, 0x42, 0xca, 0x0a, 0x93, 0xb2, 0x04, 0x17, 0x63, 0xa4, 0x0c, + 0x5e, 0xf1, 0x4b, 0x05, 0xe4, 0xa2, 0xf6, 0x80, 0xb5, 0x49, 0x0c, 0xb1, 0xde, 0x2b, 0xe9, 0x57, + 0x4d, 0x17, 0xb2, 0xea, 0x4c, 0xd6, 0x6f, 0x70, 0x3d, 0x46, 0x16, 0x9b, 0xb2, 0x35, 0x4b, 0xd6, + 0xc8, 0x56, 0x35, 0x36, 0x8f, 0xbf, 0xa8, 0x89, 0xe3, 0x73, 0x55, 0x39, 0x39, 0x57, 0x95, 0xcf, + 0xe7, 0xaa, 0xf2, 0xf4, 0x42, 0x4d, 0x9c, 0x5c, 0xa8, 0x89, 0x0f, 0x17, 0x6a, 0xe2, 0xee, 0xe5, + 0x91, 0x1e, 0x62, 0xd6, 0x3a, 0xa8, 0x15, 0x70, 0xf4, 0x87, 0x1c, 0x9f, 0x19, 0xb2, 0x95, 0x66, + 0x1f, 0xf7, 0x3f, 0xbe, 0x05, 0x00, 0x00, 0xff, 0xff, 0x3b, 0xb1, 0x1a, 0x34, 0xed, 0x08, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -150,6 +525,12 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Params queries all parameters of the earn module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Vaults queries vaults based on vault denom + Vaults(ctx context.Context, in *QueryVaultsRequest, opts ...grpc.CallOption) (*QueryVaultsResponse, error) + // Deposits queries deposit details based on owner address and vault + Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) + // TotalDeposited queries total deposited amount for each vault. + TotalDeposited(ctx context.Context, in *QueryTotalDepositedRequest, opts ...grpc.CallOption) (*QueryTotalDepositedResponse, error) } type queryClient struct { @@ -169,10 +550,43 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) Vaults(ctx context.Context, in *QueryVaultsRequest, opts ...grpc.CallOption) (*QueryVaultsResponse, error) { + out := new(QueryVaultsResponse) + err := c.cc.Invoke(ctx, "/kava.earn.v1beta1.Query/Vaults", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) { + out := new(QueryDepositsResponse) + err := c.cc.Invoke(ctx, "/kava.earn.v1beta1.Query/Deposits", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TotalDeposited(ctx context.Context, in *QueryTotalDepositedRequest, opts ...grpc.CallOption) (*QueryTotalDepositedResponse, error) { + out := new(QueryTotalDepositedResponse) + err := c.cc.Invoke(ctx, "/kava.earn.v1beta1.Query/TotalDeposited", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Params queries all parameters of the earn module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Vaults queries vaults based on vault denom + Vaults(context.Context, *QueryVaultsRequest) (*QueryVaultsResponse, error) + // Deposits queries deposit details based on owner address and vault + Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) + // TotalDeposited queries total deposited amount for each vault. + TotalDeposited(context.Context, *QueryTotalDepositedRequest) (*QueryTotalDepositedResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -182,6 +596,15 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedQueryServer) Vaults(ctx context.Context, req *QueryVaultsRequest) (*QueryVaultsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Vaults not implemented") +} +func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented") +} +func (*UnimplementedQueryServer) TotalDeposited(ctx context.Context, req *QueryTotalDepositedRequest) (*QueryTotalDepositedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalDeposited not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -205,6 +628,60 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Query_Vaults_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVaultsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Vaults(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kava.earn.v1beta1.Query/Vaults", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Vaults(ctx, req.(*QueryVaultsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDepositsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Deposits(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kava.earn.v1beta1.Query/Deposits", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Deposits(ctx, req.(*QueryDepositsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TotalDeposited_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalDepositedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalDeposited(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kava.earn.v1beta1.Query/TotalDeposited", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalDeposited(ctx, req.(*QueryTotalDepositedRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.earn.v1beta1.Query", HandlerType: (*QueryServer)(nil), @@ -213,6 +690,18 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, + { + MethodName: "Vaults", + Handler: _Query_Vaults_Handler, + }, + { + MethodName: "Deposits", + Handler: _Query_Deposits_Handler, + }, + { + MethodName: "TotalDeposited", + Handler: _Query_TotalDeposited_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "kava/earn/v1beta1/query.proto", @@ -274,6 +763,351 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryVaultsRequest) 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 *QueryVaultsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVaultsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryVaultsResponse) 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 *QueryVaultsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVaultsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Vaults) > 0 { + for iNdEx := len(m.Vaults) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Vaults[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *VaultResponse) 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 *VaultResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TotalValue.Size() + i -= size + if _, err := m.TotalValue.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.TotalSupplied.Size() + i -= size + if _, err := m.TotalSupplied.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.VaultStrategy != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.VaultStrategy)) + i-- + dAtA[i] = 0x10 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDepositsRequest) 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 *QueryDepositsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDepositsResponse) 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 *QueryDepositsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Deposits) > 0 { + for iNdEx := len(m.Deposits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *DepositResponse) 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 *DepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Value) > 0 { + for iNdEx := len(m.Value) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Value[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.AmountSupplied) > 0 { + for iNdEx := len(m.AmountSupplied) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AmountSupplied[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTotalDepositedRequest) 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 *QueryTotalDepositedRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalDepositedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTotalDepositedResponse) 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 *QueryTotalDepositedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalDepositedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SuppliedCoins) > 0 { + for iNdEx := len(m.SuppliedCoins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SuppliedCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -305,6 +1139,147 @@ func (m *QueryParamsResponse) Size() (n int) { return n } +func (m *QueryVaultsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVaultsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Vaults) > 0 { + for _, e := range m.Vaults { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *VaultResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.VaultStrategy != 0 { + n += 1 + sovQuery(uint64(m.VaultStrategy)) + } + l = m.TotalSupplied.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.TotalValue.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDepositsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Deposits) > 0 { + for _, e := range m.Deposits { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *DepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.AmountSupplied) > 0 { + for _, e := range m.AmountSupplied { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if len(m.Value) > 0 { + for _, e := range m.Value { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryTotalDepositedRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTotalDepositedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.SuppliedCoins) > 0 { + for _, e := range m.SuppliedCoins { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -444,6 +1419,927 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryVaultsRequest) 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: QueryVaultsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVaultsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + 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 (m *QueryVaultsResponse) 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: QueryVaultsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVaultsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Vaults", 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.Vaults = append(m.Vaults, VaultResponse{}) + if err := m.Vaults[len(m.Vaults)-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 (m *VaultResponse) 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: VaultResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VaultStrategy", wireType) + } + m.VaultStrategy = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VaultStrategy |= StrategyType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalSupplied", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalSupplied.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalValue", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TotalValue.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 (m *QueryDepositsRequest) 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: QueryDepositsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.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 (m *QueryDepositsResponse) 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: QueryDepositsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposits", 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.Deposits = append(m.Deposits, DepositResponse{}) + if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.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 (m *DepositResponse) 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: DepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountSupplied", 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.AmountSupplied = append(m.AmountSupplied, types.Coin{}) + if err := m.AmountSupplied[len(m.AmountSupplied)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", 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.Value = append(m.Value, types.Coin{}) + if err := m.Value[len(m.Value)-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 (m *QueryTotalDepositedRequest) 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: QueryTotalDepositedRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalDepositedRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + 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 (m *QueryTotalDepositedResponse) 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: QueryTotalDepositedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalDepositedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SuppliedCoins", 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.SuppliedCoins = append(m.SuppliedCoins, types.Coin{}) + if err := m.SuppliedCoins[len(m.SuppliedCoins)-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) { l := len(dAtA) iNdEx := 0 diff --git a/x/earn/types/query.pb.gw.go b/x/earn/types/query.pb.gw.go index d1ab7bf6..a2eb6deb 100644 --- a/x/earn/types/query.pb.gw.go +++ b/x/earn/types/query.pb.gw.go @@ -49,6 +49,150 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +func request_Query_Vaults_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVaultsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := client.Vaults(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Vaults_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVaultsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := server.Vaults(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Deposits_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Deposits_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDepositsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Deposits_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Deposits(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Deposits_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDepositsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Deposits_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Deposits(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_TotalDeposited_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalDepositedRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := client.TotalDeposited(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TotalDeposited_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalDepositedRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := server.TotalDeposited(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -75,6 +219,66 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_Vaults_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Vaults_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Vaults_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Deposits_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Deposits_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Deposits_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalDeposited_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TotalDeposited_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TotalDeposited_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -136,13 +340,85 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_Vaults_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_Vaults_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_Vaults_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Deposits_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_Deposits_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_Deposits_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalDeposited_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_TotalDeposited_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_TotalDeposited_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"kava", "earn", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Vaults_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_TotalDeposited_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", "total-deposited", "denom"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Vaults_0 = runtime.ForwardResponseMessage + + forward_Query_Deposits_0 = runtime.ForwardResponseMessage + + forward_Query_TotalDeposited_0 = runtime.ForwardResponseMessage ) diff --git a/x/earn/types/strategy.pb.go b/x/earn/types/strategy.pb.go index 6138e542..f7134816 100644 --- a/x/earn/types/strategy.pb.go +++ b/x/earn/types/strategy.pb.go @@ -5,8 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" math "math" @@ -23,24 +21,30 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// StrategyType is the type of strategy that a vault uses to optimize yields. type StrategyType int32 const ( - STRATEGY_TYPE_UNKNOWN StrategyType = 0 - STRATEGY_TYPE_HARD StrategyType = 1 + // STRATEGY_TYPE_UNSPECIFIED represents an unspecified or invalid strategy type. + STRATEGY_TYPE_UNSPECIFIED StrategyType = 0 + // STRATEGY_TYPE_HARD represents the strategy that deposits assets in the Hard + // module. + STRATEGY_TYPE_HARD StrategyType = 1 + // STRATEGY_TYPE_SAVINGS represents the strategy that deposits assets in the + // Savings module. STRATEGY_TYPE_SAVINGS StrategyType = 2 ) var StrategyType_name = map[int32]string{ - 0: "STRATEGY_TYPE_UNKNOWN", + 0: "STRATEGY_TYPE_UNSPECIFIED", 1: "STRATEGY_TYPE_HARD", 2: "STRATEGY_TYPE_SAVINGS", } var StrategyType_value = map[string]int32{ - "STRATEGY_TYPE_UNKNOWN": 0, - "STRATEGY_TYPE_HARD": 1, - "STRATEGY_TYPE_SAVINGS": 2, + "STRATEGY_TYPE_UNSPECIFIED": 0, + "STRATEGY_TYPE_HARD": 1, + "STRATEGY_TYPE_SAVINGS": 2, } func (x StrategyType) String() string { @@ -58,21 +62,19 @@ func init() { func init() { proto.RegisterFile("kava/earn/v1beta1/strategy.proto", fileDescriptor_257c4968dd48fa09) } var fileDescriptor_257c4968dd48fa09 = []byte{ - // 243 bytes of a gzipped FileDescriptorProto + // 220 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0x4e, 0x2c, 0x4b, 0xd4, 0x4f, 0x4d, 0x2c, 0xca, 0xd3, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x2e, 0x29, 0x4a, 0x2c, 0x49, 0x4d, 0xaf, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x04, 0xa9, 0xd0, 0x03, 0xa9, 0xd0, 0x83, 0xaa, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xea, 0x83, - 0x58, 0x10, 0x85, 0x52, 0x72, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xfa, 0x49, 0x89, 0xc5, 0xa9, - 0x70, 0xc3, 0x92, 0xf3, 0x33, 0xf3, 0xa0, 0xf2, 0x92, 0x10, 0xf9, 0x78, 0x88, 0x46, 0x08, 0x07, - 0x22, 0xa5, 0x95, 0xc4, 0xc5, 0x13, 0x0c, 0xb5, 0x35, 0xa4, 0xb2, 0x20, 0x55, 0x48, 0x92, 0x4b, - 0x34, 0x38, 0x24, 0xc8, 0x31, 0xc4, 0xd5, 0x3d, 0x32, 0x3e, 0x24, 0x32, 0xc0, 0x35, 0x3e, 0xd4, - 0xcf, 0xdb, 0xcf, 0x3f, 0xdc, 0x4f, 0x80, 0x41, 0x48, 0x8c, 0x4b, 0x08, 0x55, 0xca, 0xc3, 0x31, - 0xc8, 0x45, 0x80, 0x11, 0x53, 0x4b, 0xb0, 0x63, 0x98, 0xa7, 0x9f, 0x7b, 0xb0, 0x00, 0x93, 0x14, - 0x4b, 0xc7, 0x62, 0x39, 0x06, 0x27, 0x87, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, - 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, - 0x88, 0x52, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x79, 0x56, - 0x37, 0x27, 0x31, 0xa9, 0x18, 0xcc, 0xd2, 0xaf, 0x80, 0x04, 0x4d, 0x49, 0x65, 0x41, 0x6a, 0x71, - 0x12, 0x1b, 0xd8, 0xb1, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x62, 0x68, 0x2c, 0xbc, 0x34, - 0x01, 0x00, 0x00, + 0x58, 0x10, 0x85, 0x5a, 0x69, 0x5c, 0x3c, 0xc1, 0x50, 0xad, 0x21, 0x95, 0x05, 0xa9, 0x42, 0xb2, + 0x5c, 0x92, 0xc1, 0x21, 0x41, 0x8e, 0x21, 0xae, 0xee, 0x91, 0xf1, 0x21, 0x91, 0x01, 0xae, 0xf1, + 0xa1, 0x7e, 0xc1, 0x01, 0xae, 0xce, 0x9e, 0x6e, 0x9e, 0xae, 0x2e, 0x02, 0x0c, 0x42, 0x62, 0x5c, + 0x42, 0xa8, 0xd2, 0x1e, 0x8e, 0x41, 0x2e, 0x02, 0x8c, 0x42, 0x92, 0x5c, 0xa2, 0xa8, 0xe2, 0xc1, + 0x8e, 0x61, 0x9e, 0x7e, 0xee, 0xc1, 0x02, 0x4c, 0x52, 0x2c, 0x1d, 0x8b, 0xe5, 0x18, 0x9c, 0x1c, + 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, + 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x2d, 0x3d, 0xb3, 0x24, 0xa3, + 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xe4, 0x6a, 0xdd, 0x9c, 0xc4, 0xa4, 0x62, 0x30, 0x4b, + 0xbf, 0x02, 0xe2, 0xc7, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x83, 0x8d, 0x01, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x81, 0x9e, 0x23, 0x1c, 0xfd, 0x00, 0x00, 0x00, } diff --git a/x/earn/types/tx.pb.go b/x/earn/types/tx.pb.go index d270a601..221b019b 100644 --- a/x/earn/types/tx.pb.go +++ b/x/earn/types/tx.pb.go @@ -202,26 +202,26 @@ var fileDescriptor_2e9dcf48a3fa0009 = []byte{ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xca, 0x4e, 0x2c, 0x4b, 0xd4, 0x4f, 0x4d, 0x2c, 0xca, 0xd3, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x04, 0xc9, 0xe9, 0x81, 0xe4, 0xf4, 0xa0, 0x72, - 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x59, 0x7d, 0x10, 0x0b, 0xa2, 0x50, 0x4a, 0x32, 0x39, - 0xbf, 0x38, 0x37, 0xbf, 0x38, 0x1e, 0x22, 0x01, 0xe1, 0x40, 0xa5, 0xe4, 0x20, 0x3c, 0xfd, 0xa4, - 0xc4, 0xe2, 0x54, 0xb8, 0x0d, 0xc9, 0xf9, 0x99, 0x79, 0x10, 0x79, 0xa5, 0x66, 0x46, 0x2e, 0x2e, - 0xdf, 0xe2, 0x74, 0x97, 0xd4, 0x82, 0xfc, 0xe2, 0xcc, 0x12, 0x21, 0x33, 0x2e, 0xce, 0x14, 0x08, - 0x33, 0xbf, 0x48, 0x82, 0x51, 0x81, 0x51, 0x83, 0xd3, 0x49, 0xe2, 0xd2, 0x16, 0x5d, 0x11, 0xa8, - 0x99, 0x8e, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x41, 0x08, - 0xa5, 0x42, 0xe6, 0x5c, 0x6c, 0x89, 0xb9, 0xf9, 0xa5, 0x79, 0x25, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, - 0xdc, 0x46, 0x92, 0x7a, 0x50, 0x1d, 0x20, 0x7b, 0x61, 0xae, 0xd7, 0x73, 0xce, 0xcf, 0xcc, 0x73, - 0x62, 0x39, 0x71, 0x4f, 0x9e, 0x21, 0x08, 0xaa, 0xdc, 0x8a, 0xa5, 0x63, 0x81, 0x3c, 0x83, 0x92, - 0x08, 0x97, 0x10, 0xc2, 0x11, 0x41, 0xa9, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x4a, 0x55, 0x5c, - 0xdc, 0xbe, 0xc5, 0xe9, 0xe1, 0x99, 0x25, 0x19, 0x29, 0x45, 0x89, 0xe5, 0x42, 0x3a, 0x5c, 0x2c, - 0x69, 0x45, 0xf9, 0xb9, 0x04, 0x9d, 0x05, 0x56, 0x45, 0xa9, 0x8b, 0x44, 0xb9, 0x84, 0x91, 0xec, - 0x86, 0x39, 0xc9, 0x68, 0x15, 0x23, 0x17, 0xb3, 0x6f, 0x71, 0xba, 0x90, 0x3f, 0x17, 0x3b, 0x2c, - 0xc8, 0x64, 0xf5, 0x30, 0xa2, 0x49, 0x0f, 0xe1, 0x19, 0x29, 0x55, 0xbc, 0xd2, 0x30, 0x83, 0x85, - 0x82, 0xb8, 0x38, 0xe0, 0x1e, 0x95, 0xc3, 0xae, 0x05, 0x26, 0x2f, 0xa5, 0x86, 0x5f, 0x1e, 0x66, - 0xa6, 0x93, 0xc3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, - 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xa9, 0xa5, 0x67, - 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x83, 0xcc, 0xd2, 0xcd, 0x49, 0x4c, 0x2a, - 0x06, 0xb3, 0xf4, 0x2b, 0x20, 0x89, 0xb1, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x9c, 0x48, - 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x62, 0xb1, 0xf7, 0xa6, 0x02, 0x00, 0x00, + 0x52, 0x92, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0x60, 0x05, 0xfa, 0x10, 0x0e, 0x44, 0xb5, + 0x94, 0x1c, 0x84, 0xa7, 0x9f, 0x94, 0x58, 0x9c, 0x0a, 0x37, 0x2b, 0x39, 0x3f, 0x33, 0x0f, 0x2a, + 0x2f, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0xd1, 0x07, 0x62, 0x41, 0x44, 0x95, 0x9a, 0x19, 0xb9, 0xb8, + 0x7c, 0x8b, 0xd3, 0x5d, 0x52, 0x0b, 0xf2, 0x8b, 0x33, 0x4b, 0x84, 0xcc, 0xb8, 0x38, 0x53, 0x20, + 0xcc, 0xfc, 0x22, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x4e, 0x27, 0x89, 0x4b, 0x5b, 0x74, 0x45, 0xa0, + 0x36, 0x39, 0xa6, 0xa4, 0x14, 0xa5, 0x16, 0x17, 0x07, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x07, 0x21, + 0x94, 0x0a, 0x99, 0x73, 0xb1, 0x25, 0xe6, 0xe6, 0x97, 0xe6, 0x95, 0x48, 0x30, 0x29, 0x30, 0x6a, + 0x70, 0x1b, 0x49, 0xea, 0x41, 0x75, 0x80, 0x5c, 0x03, 0x73, 0xbd, 0x9e, 0x73, 0x7e, 0x66, 0x9e, + 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x50, 0xe5, 0x56, 0x2c, 0x1d, 0x0b, 0xe4, 0x19, 0x94, + 0x44, 0xb8, 0x84, 0x10, 0x8e, 0x08, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x55, 0xaa, 0xe2, + 0xe2, 0xf6, 0x2d, 0x4e, 0x0f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0x17, 0xd2, 0xe1, 0x62, + 0x49, 0x2b, 0xca, 0xcf, 0x25, 0xe8, 0x2c, 0xb0, 0x2a, 0x4a, 0x5d, 0x24, 0xca, 0x25, 0x8c, 0x64, + 0x37, 0xcc, 0x49, 0x46, 0xab, 0x18, 0xb9, 0x98, 0x7d, 0x8b, 0xd3, 0x85, 0xfc, 0xb9, 0xd8, 0x61, + 0x41, 0x26, 0xab, 0x87, 0x11, 0x4d, 0x7a, 0x08, 0xcf, 0x48, 0xa9, 0xe2, 0x95, 0x86, 0x19, 0x2c, + 0x14, 0xc4, 0xc5, 0x01, 0xf7, 0xa8, 0x1c, 0x76, 0x2d, 0x30, 0x79, 0x29, 0x35, 0xfc, 0xf2, 0x30, + 0x33, 0x9d, 0x1c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, + 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x2d, 0x3d, + 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x64, 0x96, 0x6e, 0x4e, 0x62, 0x52, + 0x31, 0x98, 0xa5, 0x5f, 0x01, 0x49, 0x8c, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x44, + 0x62, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x48, 0xd0, 0x39, 0xa6, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/earn/types/vault.go b/x/earn/types/vault.go index ff4d51ba..35c21482 100644 --- a/x/earn/types/vault.go +++ b/x/earn/types/vault.go @@ -59,7 +59,7 @@ func (a *AllowedVault) Validate() error { return ErrInvalidVaultDenom } - if a.VaultStrategy == STRATEGY_TYPE_UNKNOWN { + if a.VaultStrategy == STRATEGY_TYPE_UNSPECIFIED { return ErrInvalidVaultStrategy } diff --git a/x/earn/types/vault.pb.go b/x/earn/types/vault.pb.go index ab6127c5..72c6d1bd 100644 --- a/x/earn/types/vault.pb.go +++ b/x/earn/types/vault.pb.go @@ -31,7 +31,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type AllowedVault struct { // Denom is the only supported denomination of the vault for deposits and withdrawals. Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // VaultStrategy is the strategies to use for this vault. + // VaultStrategy is the strategy used for this vault. VaultStrategy StrategyType `protobuf:"varint,2,opt,name=vault_strategy,json=vaultStrategy,proto3,enum=kava.earn.v1beta1.StrategyType" json:"vault_strategy,omitempty"` } @@ -79,7 +79,7 @@ func (m *AllowedVault) GetVaultStrategy() StrategyType { if m != nil { return m.VaultStrategy } - return STRATEGY_TYPE_UNKNOWN + return STRATEGY_TYPE_UNSPECIFIED } // VaultRecord is the state of a vault and is used to store the state of a @@ -206,32 +206,32 @@ func init() { proto.RegisterFile("kava/earn/v1beta1/vault.proto", fileDescriptor var fileDescriptor_884eb89509fbdc04 = []byte{ // 417 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbf, 0xae, 0xd3, 0x30, - 0x14, 0xc6, 0x93, 0xcb, 0x1f, 0xe9, 0xba, 0xa5, 0x40, 0xb8, 0x43, 0xef, 0x95, 0x48, 0xa2, 0x0e, - 0xa8, 0x4b, 0x1c, 0xee, 0xe5, 0x05, 0x68, 0x90, 0x10, 0x73, 0x82, 0x18, 0x58, 0x2a, 0x27, 0x36, - 0x69, 0xd4, 0x24, 0x27, 0x8a, 0x9d, 0x42, 0xde, 0x82, 0xe7, 0x60, 0xe6, 0x21, 0x3a, 0x56, 0x4c, - 0x4c, 0x05, 0xb5, 0x2f, 0xc0, 0xcc, 0x84, 0xfc, 0xa7, 0x05, 0xa9, 0x02, 0x31, 0xc5, 0xf6, 0x77, - 0xbe, 0xf3, 0x3b, 0x9f, 0x63, 0xf4, 0x78, 0x49, 0x56, 0x24, 0x64, 0xa4, 0xad, 0xc3, 0xd5, 0x75, - 0xca, 0x04, 0xb9, 0x0e, 0x57, 0xa4, 0x2b, 0x05, 0x6e, 0x5a, 0x10, 0xe0, 0x3c, 0x94, 0x32, 0x96, - 0x32, 0x36, 0xf2, 0xd5, 0x45, 0x0e, 0x39, 0x28, 0x35, 0x94, 0x2b, 0x5d, 0x78, 0xe5, 0x66, 0xc0, - 0x2b, 0xe0, 0x61, 0x4a, 0x38, 0x3b, 0x76, 0xca, 0xa0, 0xa8, 0x8d, 0x7e, 0xa9, 0xf5, 0xb9, 0x36, - 0xea, 0x8d, 0x91, 0xfc, 0xd3, 0x11, 0xb8, 0x68, 0x89, 0x60, 0x79, 0xaf, 0x2b, 0x26, 0x25, 0x1a, - 0xce, 0xca, 0x12, 0xde, 0x33, 0xfa, 0x46, 0xce, 0xe6, 0x5c, 0xa0, 0x3b, 0x94, 0xd5, 0x50, 0x8d, - 0x6d, 0xdf, 0x9e, 0x9e, 0xc7, 0x7a, 0xe3, 0xbc, 0x44, 0x23, 0x35, 0xfa, 0xfc, 0xe0, 0x1e, 0x9f, - 0xf9, 0xf6, 0x74, 0x74, 0xe3, 0xe1, 0x93, 0x10, 0x38, 0x31, 0x25, 0xaf, 0xfb, 0x86, 0xc5, 0xf7, - 0x94, 0xed, 0x70, 0x34, 0xc9, 0xd1, 0x40, 0x61, 0x62, 0x96, 0x41, 0x4b, 0xff, 0x02, 0x8b, 0xd0, - 0x50, 0x80, 0x20, 0xe5, 0x9c, 0x77, 0x4d, 0x53, 0x6a, 0xd4, 0xe0, 0xe6, 0x12, 0x9b, 0x64, 0xf2, - 0x1a, 0x8e, 0xb0, 0x17, 0x50, 0xd4, 0xd1, 0xed, 0xf5, 0xd6, 0xb3, 0xe2, 0x81, 0x32, 0x25, 0xca, - 0x33, 0xf9, 0x61, 0xa3, 0x07, 0x8a, 0x94, 0x2c, 0x48, 0xcb, 0x0c, 0xee, 0x1d, 0x3a, 0xa7, 0xac, - 0x01, 0x5e, 0x08, 0x68, 0x15, 0x72, 0x18, 0xbd, 0xfa, 0xb9, 0xf5, 0x82, 0xbc, 0x10, 0x8b, 0x2e, - 0xc5, 0x19, 0x54, 0xe6, 0xf6, 0xcc, 0x27, 0xe0, 0x74, 0x19, 0x8a, 0xbe, 0x61, 0x1c, 0xcf, 0xb2, - 0x6c, 0x46, 0x69, 0xcb, 0x38, 0xff, 0xf2, 0x39, 0x78, 0x64, 0x26, 0x31, 0x27, 0x51, 0x2f, 0x18, - 0x8f, 0x7f, 0xb7, 0x76, 0x04, 0xba, 0x4f, 0x2a, 0xe8, 0x6a, 0xa1, 0x13, 0x14, 0x8c, 0x8e, 0xcf, - 0xfc, 0x5b, 0xff, 0xce, 0xf0, 0x54, 0x66, 0xf8, 0xf4, 0xcd, 0x9b, 0xfe, 0xc7, 0x30, 0xd2, 0xc0, - 0xe3, 0x91, 0x66, 0x24, 0x06, 0x11, 0x3d, 0x5f, 0xef, 0x5c, 0x7b, 0xb3, 0x73, 0xed, 0xef, 0x3b, - 0xd7, 0xfe, 0xb8, 0x77, 0xad, 0xcd, 0xde, 0xb5, 0xbe, 0xee, 0x5d, 0xeb, 0xed, 0x93, 0x3f, 0x7a, - 0xca, 0xff, 0x15, 0x94, 0x24, 0xe5, 0x6a, 0x15, 0x7e, 0xd0, 0x8f, 0x43, 0xf5, 0x4d, 0xef, 0xaa, - 0x27, 0xf1, 0xec, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x82, 0x2c, 0xf8, 0xd8, 0xb9, 0x02, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbd, 0x8e, 0xd3, 0x40, + 0x10, 0xc7, 0xed, 0xe3, 0x43, 0xba, 0x4d, 0x08, 0x60, 0xae, 0xc8, 0x9d, 0x84, 0x6d, 0xa5, 0x40, + 0x69, 0xbc, 0xe6, 0x8e, 0x17, 0x20, 0x46, 0x42, 0xd4, 0x36, 0xa2, 0xa0, 0x89, 0xd6, 0xde, 0xc5, + 0xb1, 0x62, 0x7b, 0x2c, 0xef, 0x3a, 0xe0, 0xb7, 0xe0, 0x39, 0xa8, 0x79, 0x88, 0x94, 0x11, 0x15, + 0x55, 0x40, 0xc9, 0x0b, 0x50, 0x53, 0xa1, 0xfd, 0x48, 0x40, 0x8a, 0x40, 0x54, 0xde, 0x9d, 0x99, + 0xff, 0xfc, 0xfe, 0x33, 0x5e, 0xf4, 0x78, 0x49, 0x56, 0x24, 0x64, 0xa4, 0xad, 0xc3, 0xd5, 0x75, + 0xca, 0x04, 0xb9, 0x0e, 0x57, 0xa4, 0x2b, 0x05, 0x6e, 0x5a, 0x10, 0xe0, 0x3c, 0x94, 0x69, 0x2c, + 0xd3, 0xd8, 0xa4, 0xaf, 0x2e, 0x33, 0xe0, 0x15, 0xf0, 0xb9, 0x2a, 0x08, 0xf5, 0x45, 0x57, 0x5f, + 0xb9, 0xfa, 0x16, 0xa6, 0x84, 0xb3, 0x63, 0xbb, 0x0c, 0x8a, 0xda, 0xe4, 0x2f, 0x72, 0xc8, 0x41, + 0xeb, 0xe4, 0xc9, 0x44, 0xfd, 0x53, 0x0b, 0x5c, 0xb4, 0x44, 0xb0, 0xbc, 0xd7, 0x15, 0x93, 0x12, + 0x0d, 0x67, 0x65, 0x09, 0xef, 0x19, 0x7d, 0x23, 0xbd, 0x39, 0x17, 0xe8, 0x0e, 0x65, 0x35, 0x54, + 0x63, 0xdb, 0xb7, 0xa7, 0xe7, 0xb1, 0xbe, 0x38, 0x2f, 0xd1, 0x48, 0x59, 0x9f, 0x1f, 0xd4, 0xe3, + 0x33, 0xdf, 0x9e, 0x8e, 0x6e, 0x3c, 0x7c, 0x32, 0x04, 0x4e, 0x4c, 0xc9, 0xeb, 0xbe, 0x61, 0xf1, + 0x3d, 0x25, 0x3b, 0x84, 0x26, 0x39, 0x1a, 0x28, 0x4c, 0xcc, 0x32, 0x68, 0xe9, 0x5f, 0x60, 0x11, + 0x1a, 0x0a, 0x10, 0xa4, 0x9c, 0xf3, 0xae, 0x69, 0x4a, 0x8d, 0x1a, 0xdc, 0x5c, 0x62, 0xb3, 0x0f, + 0xb9, 0x81, 0x23, 0xec, 0x05, 0x14, 0x75, 0x74, 0x7b, 0xbd, 0xf5, 0xac, 0x78, 0xa0, 0x44, 0x89, + 0xd2, 0x4c, 0x7e, 0xd8, 0xe8, 0x81, 0x22, 0x25, 0x0b, 0xd2, 0x32, 0x83, 0x7b, 0x87, 0xce, 0x29, + 0x6b, 0x80, 0x17, 0x02, 0x5a, 0x85, 0x1c, 0x46, 0xaf, 0x7e, 0x6e, 0xbd, 0x20, 0x2f, 0xc4, 0xa2, + 0x4b, 0x71, 0x06, 0x95, 0xd9, 0xb9, 0xf9, 0x04, 0x9c, 0x2e, 0x43, 0xd1, 0x37, 0x8c, 0xe3, 0x59, + 0x96, 0xcd, 0x28, 0x6d, 0x19, 0xe7, 0x5f, 0x3e, 0x07, 0x8f, 0x8c, 0x13, 0x13, 0x89, 0x7a, 0xc1, + 0x78, 0xfc, 0xbb, 0xb5, 0x23, 0xd0, 0x7d, 0x52, 0x41, 0x57, 0x0b, 0x3d, 0x41, 0xc1, 0xe8, 0xf8, + 0xcc, 0xbf, 0xf5, 0xef, 0x19, 0x9e, 0xca, 0x19, 0x3e, 0x7d, 0xf3, 0xa6, 0xff, 0x61, 0x46, 0x0a, + 0x78, 0x3c, 0xd2, 0x8c, 0xc4, 0x20, 0xa2, 0xe7, 0xeb, 0x9d, 0x6b, 0x6f, 0x76, 0xae, 0xfd, 0x7d, + 0xe7, 0xda, 0x1f, 0xf7, 0xae, 0xb5, 0xd9, 0xbb, 0xd6, 0xd7, 0xbd, 0x6b, 0xbd, 0x7d, 0xf2, 0x47, + 0x4f, 0xf9, 0xbf, 0x82, 0x92, 0xa4, 0x5c, 0x9d, 0xc2, 0x0f, 0xfa, 0x71, 0xa8, 0xbe, 0xe9, 0x5d, + 0xf5, 0x24, 0x9e, 0xfd, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x80, 0xa4, 0xff, 0xb9, 0x02, 0x00, 0x00, }