mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 16:25:21 +00:00
35c848dce6
* Add incentive grpc query service * Register query server * Add grpc query test * Add grpc query test * Fix proto lints * Fix missing savings field, update tests * Update proto docs * Use consts for query reward types * Add owner to queryRewards err * Add empty reward type to be valid
131 lines
4.3 KiB
Protocol Buffer
131 lines
4.3 KiB
Protocol Buffer
syntax = "proto3";
|
|
package kava.incentive.v1beta1;
|
|
|
|
import "gogoproto/gogo.proto";
|
|
import "google/api/annotations.proto";
|
|
import "kava/incentive/v1beta1/apy.proto";
|
|
import "kava/incentive/v1beta1/claims.proto";
|
|
import "kava/incentive/v1beta1/params.proto";
|
|
|
|
option go_package = "github.com/kava-labs/kava/x/incentive/types";
|
|
|
|
// Query defines the gRPC querier service for incentive module.
|
|
service Query {
|
|
// Params queries module params.
|
|
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
|
|
option (google.api.http).get = "/kava/incentive/v1beta1/params";
|
|
}
|
|
|
|
// Rewards queries reward information for a given user.
|
|
rpc Rewards(QueryRewardsRequest) returns (QueryRewardsResponse) {
|
|
option (google.api.http).get = "/kava/incentive/v1beta1/rewards";
|
|
}
|
|
|
|
// Rewards queries the reward factors.
|
|
rpc RewardFactors(QueryRewardFactorsRequest) returns (QueryRewardFactorsResponse) {
|
|
option (google.api.http).get = "/kava/incentive/v1beta1/reward_factors";
|
|
}
|
|
|
|
// Apy queries incentive reward apy for a reward.
|
|
rpc Apy(QueryApyRequest) returns (QueryApyResponse) {
|
|
option (google.api.http).get = "/kava/incentive/v1beta1/apy";
|
|
}
|
|
}
|
|
|
|
// QueryParamsRequest is the request type for the Query/Params RPC method.
|
|
message QueryParamsRequest {}
|
|
|
|
// QueryParamsResponse is the response type for the Query/Params RPC method.
|
|
message QueryParamsResponse {
|
|
Params params = 1 [(gogoproto.nullable) = false];
|
|
}
|
|
|
|
// QueryRewardsRequest is the request type for the Query/Rewards RPC method.
|
|
message QueryRewardsRequest {
|
|
// owner is the address of the user to query rewards for.
|
|
string owner = 1;
|
|
// reward_type is the type of reward to query rewards for, e.g. hard, earn,
|
|
// swap.
|
|
string reward_type = 2;
|
|
// unsynchronized is a flag to query rewards that are not simulated for reward
|
|
// synchronized for the current block.
|
|
bool unsynchronized = 3;
|
|
}
|
|
|
|
// QueryRewardsResponse is the response type for the Query/Rewards RPC method.
|
|
message QueryRewardsResponse {
|
|
repeated USDXMintingClaim usdx_minting_claims = 1 [
|
|
(gogoproto.customname) = "USDXMintingClaims",
|
|
(gogoproto.castrepeated) = "USDXMintingClaims",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
|
|
repeated HardLiquidityProviderClaim hard_liquidity_provider_claims = 2 [
|
|
(gogoproto.castrepeated) = "HardLiquidityProviderClaims",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
|
|
repeated DelegatorClaim delegator_claims = 3 [
|
|
(gogoproto.castrepeated) = "DelegatorClaims",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
|
|
repeated SwapClaim swap_claims = 4 [
|
|
(gogoproto.castrepeated) = "SwapClaims",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
|
|
repeated SavingsClaim savings_claims = 5 [
|
|
(gogoproto.castrepeated) = "SavingsClaims",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
|
|
repeated EarnClaim earn_claims = 6 [
|
|
(gogoproto.castrepeated) = "EarnClaims",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
}
|
|
|
|
// QueryRewardFactorsRequest is the request type for the Query/RewardFactors RPC method.
|
|
message QueryRewardFactorsRequest {}
|
|
|
|
// QueryRewardFactorsResponse is the response type for the Query/RewardFactors RPC method.
|
|
message QueryRewardFactorsResponse {
|
|
repeated RewardIndex usdx_minting_reward_factors = 1 [
|
|
(gogoproto.castrepeated) = "RewardIndexes",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
repeated MultiRewardIndex hard_supply_reward_factors = 2 [
|
|
(gogoproto.castrepeated) = "MultiRewardIndexes",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
repeated MultiRewardIndex hard_borrow_reward_factors = 3 [
|
|
(gogoproto.castrepeated) = "MultiRewardIndexes",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
repeated MultiRewardIndex delegator_reward_factors = 4 [
|
|
(gogoproto.castrepeated) = "MultiRewardIndexes",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
repeated MultiRewardIndex swap_reward_factors = 5 [
|
|
(gogoproto.castrepeated) = "MultiRewardIndexes",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
repeated MultiRewardIndex savings_reward_factors = 6 [
|
|
(gogoproto.castrepeated) = "MultiRewardIndexes",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
repeated MultiRewardIndex earn_reward_factors = 7 [
|
|
(gogoproto.castrepeated) = "MultiRewardIndexes",
|
|
(gogoproto.nullable) = false
|
|
];
|
|
}
|
|
|
|
// QueryApysRequest is the request type for the Query/Apys RPC method.
|
|
message QueryApyRequest {}
|
|
|
|
// QueryApysResponse is the response type for the Query/Apys RPC method.
|
|
message QueryApyResponse {
|
|
repeated Apy earn = 1 [(gogoproto.nullable) = false];
|
|
}
|