mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 15:55:18 +00:00
82e2f26e14
* 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
132 lines
4.8 KiB
Protocol Buffer
132 lines
4.8 KiB
Protocol Buffer
syntax = "proto3";
|
|
package kava.earn.v1beta1;
|
|
|
|
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 "kava/earn/v1beta1/params.proto";
|
|
import "kava/earn/v1beta1/strategy.proto";
|
|
|
|
// Query defines the gRPC querier service for earn module
|
|
service Query {
|
|
// Params queries all parameters of the earn module.
|
|
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 {}
|
|
|
|
// QueryParamsResponse defines the response type for querying x/earn parameters.
|
|
message QueryParamsResponse {
|
|
|
|
// 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];
|
|
}
|