From b34b5f1102b0df8acffb367455b7234960b7eba9 Mon Sep 17 00:00:00 2001 From: javiersuweijie Date: Wed, 19 Oct 2022 17:19:14 +0800 Subject: [PATCH] added rewards query --- docs/static/openapi.yml | 170 +++++-- go.mod | 1 - go.sum | 2 - proto/alliance/query.proto | 27 + x/alliance/client/cli/query.go | 1 + x/alliance/client/cli/query_rewards.go | 42 ++ x/alliance/keeper/grpc_query_rewards.go | 42 ++ x/alliance/types/msg.go | 2 +- x/alliance/types/query.pb.go | 622 ++++++++++++++++++++++-- x/alliance/types/query.pb.gw.go | 163 +++++++ 10 files changed, 983 insertions(+), 89 deletions(-) create mode 100644 x/alliance/client/cli/query_rewards.go create mode 100644 x/alliance/keeper/grpc_query_rewards.go diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 20fc342d8..c19f8212a 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -43,8 +43,6 @@ paths: will be redirected to the distribution rewards pool total_tokens: type: string - total_shares: - type: string title: 'key: denom value: AllianceAsset' pagination: type: object @@ -174,15 +172,6 @@ paths: type: string format: date-time title: Last application of `take_rate` on assets - global_reward_indices: - type: array - items: - type: object - properties: - denom: - type: string - index: - type: string default: description: An unexpected error response. schema: @@ -203,6 +192,122 @@ paths: additionalProperties: {} tags: - Query + '/terra/alliances/{delegator_addr_1}/{validator_addr}/{denom}': + get: + summary: 'Query for rewards by delegator addr, validator_addr and denom' + operationId: AllianceAllianceAllianceDelegationRewards + responses: + '200': + description: A successful response. + schema: + type: object + properties: + rewards: + 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. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: delegator_addr_1 + in: path + required: true + type: string + - name: validator_addr + in: path + required: true + type: string + - name: denom + in: path + required: true + 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 + - 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 + tags: + - Query '/terra/alliances/{delegator_addr}': get: summary: Query all paginated alliance delegations for a delegator addr @@ -744,8 +849,6 @@ paths: will be redirected to the distribution rewards pool total_tokens: type: string - total_shares: - type: string title: 'key: denom value: AllianceAsset' default: description: An unexpected error response. @@ -44914,9 +45017,24 @@ definitions: will be redirected to the distribution rewards pool total_tokens: type: string - total_shares: - type: string title: 'key: denom value: AllianceAsset' + alliance.alliance.AllianceDelegationRewardsResponse: + type: object + properties: + rewards: + 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. alliance.alliance.Delegation: type: object properties: @@ -45009,15 +45127,6 @@ definitions: type: string format: date-time title: Last application of `take_rate` on assets - global_reward_indices: - type: array - items: - type: object - properties: - denom: - type: string - index: - type: string alliance.alliance.QueryAllianceDelegationResponse: type: object properties: @@ -45102,8 +45211,6 @@ definitions: will be redirected to the distribution rewards pool total_tokens: type: string - total_shares: - type: string title: 'key: denom value: AllianceAsset' alliance.alliance.QueryAlliancesDelegationsResponse: type: object @@ -45219,8 +45326,6 @@ definitions: will be redirected to the distribution rewards pool total_tokens: type: string - total_shares: - type: string title: 'key: denom value: AllianceAsset' pagination: type: object @@ -45263,15 +45368,6 @@ definitions: type: string format: date-time title: Last application of `take_rate` on assets - global_reward_indices: - type: array - items: - type: object - properties: - denom: - type: string - index: - type: string alliance.alliance.RewardIndex: type: object properties: diff --git a/go.mod b/go.mod index 900bfd474..92b9764d2 100644 --- a/go.mod +++ b/go.mod @@ -103,7 +103,6 @@ require ( github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect diff --git a/go.sum b/go.sum index 113e81eca..0cca940a8 100644 --- a/go.sum +++ b/go.sum @@ -783,8 +783,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0 h1:kr3j8iIMR4ywO/O0rvksXaJvauGGCMg2zAZIiNZ9uIQ= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0/go.mod h1:ummNFgdgLhhX7aIiy35vVmQNS0rWXknfPE0qe6fmFXg= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= diff --git a/proto/alliance/query.proto b/proto/alliance/query.proto index 7ebb9f84b..e13f115df 100644 --- a/proto/alliance/query.proto +++ b/proto/alliance/query.proto @@ -6,6 +6,7 @@ import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "alliance/params.proto"; import "alliance/alliance.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "alliance/delegations.proto"; option go_package = "alliance/x/alliance/types"; @@ -39,6 +40,11 @@ service Query { rpc AllianceDelegation(QueryAllianceDelegationRequest) returns (QueryAllianceDelegationResponse) { option (google.api.http).get = "/terra/alliances/{delegator_addr}/{validator_addr}/{denom}"; } + + // Query for rewards by delegator addr, validator_addr and denom + rpc AllianceDelegationRewards(AllianceDelegationRewardsRequest) returns (AllianceDelegationRewardsResponse) { + option (google.api.http).get = "/terra/alliances/{delegator_addr}/{validator_addr}/{denom}"; + } } // Params @@ -104,4 +110,25 @@ message QueryAllianceDelegationRequest { message QueryAllianceDelegationResponse { DelegationResponse delegation = 1 [(gogoproto.nullable) = false]; +} + +// AllianceDelegation +message AllianceDelegationRewardsRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string delegator_addr = 1; + string validator_addr = 2; + string denom = 3; + cosmos.base.query.v1beta1.PageRequest pagination = 4; +} + +message AllianceDelegationRewardsResponse { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + repeated cosmos.base.v1beta1.Coin rewards = 1 [ + (gogoproto.nullable) = false, + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin" + ]; } \ No newline at end of file diff --git a/x/alliance/client/cli/query.go b/x/alliance/client/cli/query.go index e57fb523f..d9e9186d4 100644 --- a/x/alliance/client/cli/query.go +++ b/x/alliance/client/cli/query.go @@ -26,6 +26,7 @@ func GetQueryCmd() *cobra.Command { cmd.AddCommand(CmdQueryAlliancesDelegation()) cmd.AddCommand(CmdQueryAlliancesDelegationByValidator()) cmd.AddCommand(CmdQueryAllianceDelegation()) + cmd.AddCommand(CmdQueryRewards()) return cmd } diff --git a/x/alliance/client/cli/query_rewards.go b/x/alliance/client/cli/query_rewards.go new file mode 100644 index 000000000..675476b7e --- /dev/null +++ b/x/alliance/client/cli/query_rewards.go @@ -0,0 +1,42 @@ +package cli + +import ( + "context" + + "alliance/x/alliance/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" +) + +func CmdQueryRewards() *cobra.Command { + cmd := &cobra.Command{ + Use: "rewards delegator_addr validator_addr denom", + Short: "Query module parameters", + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + delegatorAddr := args[0] + validatorAddr := args[1] + denom := args[2] + ctx := client.GetClientContextFromCmd(cmd) + query := types.NewQueryClient(ctx) + params := &types.AllianceDelegationRewardsRequest{ + DelegatorAddr: delegatorAddr, + ValidatorAddr: validatorAddr, + Denom: denom, + } + + res, err := query.AllianceDelegationRewards(context.Background(), params) + if err != nil { + return err + } + + return ctx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/alliance/keeper/grpc_query_rewards.go b/x/alliance/keeper/grpc_query_rewards.go new file mode 100644 index 000000000..ccbb1aaa7 --- /dev/null +++ b/x/alliance/keeper/grpc_query_rewards.go @@ -0,0 +1,42 @@ +package keeper + +import ( + "alliance/x/alliance/types" + "context" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +func (k Keeper) AllianceDelegationRewards(context context.Context, request *types.AllianceDelegationRewardsRequest) (*types.AllianceDelegationRewardsResponse, error) { + ctx := sdk.UnwrapSDKContext(context) + delAddr, err := sdk.AccAddressFromBech32(request.DelegatorAddr) + if err != nil { + return nil, err + } + valAddr, err := sdk.ValAddressFromBech32(request.ValidatorAddr) + if err != nil { + return nil, err + } + _, found := k.GetAssetByDenom(ctx, request.Denom) + if !found { + return nil, types.ErrUnknownAsset + } + + val, found := k.stakingKeeper.GetValidator(ctx, valAddr) + if !found { + return nil, stakingtypes.ErrNoValidatorFound + } + + _, found = k.GetDelegation(ctx, delAddr, val, request.Denom) + if !found { + return nil, stakingtypes.ErrNoDelegation + } + + rewards, err := k.ClaimDelegationRewards(ctx, delAddr, val, request.Denom) + if err != nil { + return nil, err + } + return &types.AllianceDelegationRewardsResponse{ + Rewards: rewards, + }, nil +} diff --git a/x/alliance/types/msg.go b/x/alliance/types/msg.go index 0f1df222c..b856e5bd7 100644 --- a/x/alliance/types/msg.go +++ b/x/alliance/types/msg.go @@ -125,7 +125,7 @@ func (m MsgDeleteAlliance) GetSigners() []sdk.AccAddress { } func (m *MsgClaimDelegationRewards) ValidateBasic() error { - if m.Denom != "" { + if m.Denom == "" { return fmt.Errorf("denom must not be empty") } return nil diff --git a/x/alliance/types/query.pb.go b/x/alliance/types/query.pb.go index a745ec765..a880e75b5 100644 --- a/x/alliance/types/query.pb.go +++ b/x/alliance/types/query.pb.go @@ -6,6 +6,8 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" + github_com_cosmos_cosmos_sdk_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" @@ -517,6 +519,84 @@ func (m *QueryAllianceDelegationResponse) GetDelegation() DelegationResponse { return DelegationResponse{} } +// AllianceDelegation +type AllianceDelegationRewardsRequest struct { + DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` + ValidatorAddr string `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` + Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,4,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *AllianceDelegationRewardsRequest) Reset() { *m = AllianceDelegationRewardsRequest{} } +func (m *AllianceDelegationRewardsRequest) String() string { return proto.CompactTextString(m) } +func (*AllianceDelegationRewardsRequest) ProtoMessage() {} +func (*AllianceDelegationRewardsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c4e633a06a64e02e, []int{11} +} +func (m *AllianceDelegationRewardsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AllianceDelegationRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AllianceDelegationRewardsRequest.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 *AllianceDelegationRewardsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllianceDelegationRewardsRequest.Merge(m, src) +} +func (m *AllianceDelegationRewardsRequest) XXX_Size() int { + return m.Size() +} +func (m *AllianceDelegationRewardsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AllianceDelegationRewardsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AllianceDelegationRewardsRequest proto.InternalMessageInfo + +type AllianceDelegationRewardsResponse struct { + Rewards []github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,1,rep,name=rewards,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"rewards"` +} + +func (m *AllianceDelegationRewardsResponse) Reset() { *m = AllianceDelegationRewardsResponse{} } +func (m *AllianceDelegationRewardsResponse) String() string { return proto.CompactTextString(m) } +func (*AllianceDelegationRewardsResponse) ProtoMessage() {} +func (*AllianceDelegationRewardsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c4e633a06a64e02e, []int{12} +} +func (m *AllianceDelegationRewardsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AllianceDelegationRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AllianceDelegationRewardsResponse.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 *AllianceDelegationRewardsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllianceDelegationRewardsResponse.Merge(m, src) +} +func (m *AllianceDelegationRewardsResponse) XXX_Size() int { + return m.Size() +} +func (m *AllianceDelegationRewardsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AllianceDelegationRewardsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AllianceDelegationRewardsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "alliance.alliance.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "alliance.alliance.QueryParamsResponse") @@ -529,59 +609,68 @@ func init() { proto.RegisterType((*QueryAlliancesDelegationsResponse)(nil), "alliance.alliance.QueryAlliancesDelegationsResponse") proto.RegisterType((*QueryAllianceDelegationRequest)(nil), "alliance.alliance.QueryAllianceDelegationRequest") proto.RegisterType((*QueryAllianceDelegationResponse)(nil), "alliance.alliance.QueryAllianceDelegationResponse") + proto.RegisterType((*AllianceDelegationRewardsRequest)(nil), "alliance.alliance.AllianceDelegationRewardsRequest") + proto.RegisterType((*AllianceDelegationRewardsResponse)(nil), "alliance.alliance.AllianceDelegationRewardsResponse") } func init() { proto.RegisterFile("alliance/query.proto", fileDescriptor_c4e633a06a64e02e) } var fileDescriptor_c4e633a06a64e02e = []byte{ - // 745 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0x4d, 0x4f, 0xd4, 0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, 0x0a, 0x00, 0x00, + // 850 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x96, 0xcf, 0x4f, 0x13, 0x5b, + 0x14, 0xc7, 0x7b, 0xcb, 0x8f, 0x47, 0x0f, 0x79, 0xe4, 0xbd, 0x4b, 0x11, 0x3a, 0x31, 0xd3, 0x32, + 0x06, 0x28, 0x44, 0x67, 0x42, 0x21, 0x31, 0x21, 0xb8, 0xa0, 0x12, 0x5d, 0x18, 0x0d, 0x36, 0xd1, + 0x85, 0x1b, 0x32, 0xed, 0x4c, 0xc6, 0x89, 0xed, 0xdc, 0x32, 0x33, 0x20, 0x48, 0x88, 0x89, 0x2b, + 0x77, 0x9a, 0xb0, 0x74, 0xc3, 0xce, 0x85, 0x7f, 0x82, 0x0b, 0xb7, 0xc4, 0xb8, 0xc0, 0x98, 0x18, + 0xe2, 0x82, 0x18, 0x70, 0xe1, 0x9f, 0x61, 0x3a, 0xf7, 0xde, 0xe9, 0x4c, 0x3b, 0x65, 0x2c, 0xa9, + 0x0b, 0x57, 0x94, 0xdb, 0xf3, 0xe3, 0xf3, 0x3d, 0xe7, 0xdc, 0x7b, 0x0a, 0x69, 0xb5, 0x5a, 0x35, + 0x55, 0xab, 0xa2, 0x2b, 0x1b, 0x9b, 0xba, 0xbd, 0x23, 0xd7, 0x6d, 0xe2, 0x12, 0xfc, 0x3f, 0x3f, + 0x95, 0xf9, 0x07, 0x21, 0x6d, 0x10, 0x83, 0x78, 0xdf, 0x2a, 0x8d, 0x4f, 0xd4, 0x50, 0xb8, 0x6c, + 0x10, 0x62, 0x54, 0x75, 0x45, 0xad, 0x9b, 0x8a, 0x6a, 0x59, 0xc4, 0x55, 0x5d, 0x93, 0x58, 0x0e, + 0xfb, 0x76, 0xae, 0x42, 0x9c, 0x1a, 0x71, 0x94, 0xb2, 0xea, 0xb0, 0xf8, 0xca, 0xd6, 0x7c, 0x59, + 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0x10, 0xcf, 0x5f, 0x38, 0xf8, 0x46, 0x17, 0x0c, 0xed, 0x8b, 0xea, 0x82, + 0x12, 0x96, 0x3c, 0x09, 0x8b, 0xb8, 0x10, 0x2b, 0x41, 0xd9, 0x0d, 0x3f, 0x0a, 0x7b, 0xf8, 0x03, + 0x02, 0xdc, 0x7e, 0x31, 0xf1, 0x7c, 0x1c, 0x48, 0xdb, 0x1b, 0x2f, 0x14, 0xba, 0x71, 0x61, 0xe4, + 0x45, 0x8f, 0x7c, 0x19, 0x2f, 0x75, 0x4f, 0xee, 0xcf, 0xd0, 0x47, 0x04, 0x99, 0x8e, 0x4f, 0x4b, + 0xe4, 0x24, 0xc5, 0xbd, 0xb1, 0x91, 0x6d, 0x88, 0x7d, 0xbd, 0x7a, 0x21, 0xa6, 0xb8, 0x70, 0x78, + 0x2a, 0xa2, 0xa3, 0x53, 0x11, 0x7d, 0x3f, 0x15, 0xd1, 0xeb, 0x33, 0x31, 0x71, 0x74, 0x26, 0x26, + 0x8e, 0xcf, 0xc4, 0xc4, 0xa3, 0x8c, 0xff, 0x13, 0x7d, 0xdb, 0x8f, 0x4c, 0x9f, 0xb7, 0xf2, 0xa0, + 0xf7, 0x43, 0x7d, 0xe1, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x55, 0x28, 0x4e, 0x89, 0x9f, 0x0c, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -607,6 +696,8 @@ type QueryClient interface { AlliancesDelegationByValidator(ctx context.Context, in *QueryAlliancesDelegationByValidatorRequest, opts ...grpc.CallOption) (*QueryAlliancesDelegationsResponse, error) // Query a delegation to an alliance by delegator addr, validator_addr and denom AllianceDelegation(ctx context.Context, in *QueryAllianceDelegationRequest, opts ...grpc.CallOption) (*QueryAllianceDelegationResponse, error) + // Query for rewards by delegator addr, validator_addr and denom + AllianceDelegationRewards(ctx context.Context, in *AllianceDelegationRewardsRequest, opts ...grpc.CallOption) (*AllianceDelegationRewardsResponse, error) } type queryClient struct { @@ -671,6 +762,15 @@ func (c *queryClient) AllianceDelegation(ctx context.Context, in *QueryAllianceD return out, nil } +func (c *queryClient) AllianceDelegationRewards(ctx context.Context, in *AllianceDelegationRewardsRequest, opts ...grpc.CallOption) (*AllianceDelegationRewardsResponse, error) { + out := new(AllianceDelegationRewardsResponse) + err := c.cc.Invoke(ctx, "/alliance.alliance.Query/AllianceDelegationRewards", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) @@ -684,6 +784,8 @@ type QueryServer interface { AlliancesDelegationByValidator(context.Context, *QueryAlliancesDelegationByValidatorRequest) (*QueryAlliancesDelegationsResponse, error) // Query a delegation to an alliance by delegator addr, validator_addr and denom AllianceDelegation(context.Context, *QueryAllianceDelegationRequest) (*QueryAllianceDelegationResponse, error) + // Query for rewards by delegator addr, validator_addr and denom + AllianceDelegationRewards(context.Context, *AllianceDelegationRewardsRequest) (*AllianceDelegationRewardsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -708,6 +810,9 @@ func (*UnimplementedQueryServer) AlliancesDelegationByValidator(ctx context.Cont func (*UnimplementedQueryServer) AllianceDelegation(ctx context.Context, req *QueryAllianceDelegationRequest) (*QueryAllianceDelegationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllianceDelegation not implemented") } +func (*UnimplementedQueryServer) AllianceDelegationRewards(ctx context.Context, req *AllianceDelegationRewardsRequest) (*AllianceDelegationRewardsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllianceDelegationRewards not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -821,6 +926,24 @@ func _Query_AllianceDelegation_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_AllianceDelegationRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AllianceDelegationRewardsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllianceDelegationRewards(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/alliance.alliance.Query/AllianceDelegationRewards", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllianceDelegationRewards(ctx, req.(*AllianceDelegationRewardsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "alliance.alliance.Query", HandlerType: (*QueryServer)(nil), @@ -849,6 +972,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "AllianceDelegation", Handler: _Query_AllianceDelegation_Handler, }, + { + MethodName: "AllianceDelegationRewards", + Handler: _Query_AllianceDelegationRewards_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "alliance/query.proto", @@ -1288,6 +1415,99 @@ func (m *QueryAllianceDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int return len(dAtA) - i, nil } +func (m *AllianceDelegationRewardsRequest) 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 *AllianceDelegationRewardsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AllianceDelegationRewardsRequest) 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] = 0x22 + } + 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] = 0x1a + } + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AllianceDelegationRewardsResponse) 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 *AllianceDelegationRewardsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AllianceDelegationRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Rewards) > 0 { + for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.Rewards[iNdEx].Size() + i -= size + if _, err := m.Rewards[iNdEx].MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + 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 @@ -1470,6 +1690,46 @@ func (m *QueryAllianceDelegationResponse) Size() (n int) { return n } +func (m *AllianceDelegationRewardsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ValidatorAddr) + 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 *AllianceDelegationRewardsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Rewards) > 0 { + for _, e := range m.Rewards { + 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 } @@ -2636,6 +2896,272 @@ func (m *QueryAllianceDelegationResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *AllianceDelegationRewardsRequest) 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: AllianceDelegationRewardsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllianceDelegationRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 4: + 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 *AllianceDelegationRewardsResponse) 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: AllianceDelegationRewardsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllianceDelegationRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", 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.Rewards = append(m.Rewards, github_com_cosmos_cosmos_sdk_types.Coin{}) + if err := m.Rewards[len(m.Rewards)-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/alliance/types/query.pb.gw.go b/x/alliance/types/query.pb.gw.go index 55a7d09b0..00a92d6dd 100644 --- a/x/alliance/types/query.pb.gw.go +++ b/x/alliance/types/query.pb.gw.go @@ -423,6 +423,122 @@ func local_request_Query_AllianceDelegation_0(ctx context.Context, marshaler run } +var ( + filter_Query_AllianceDelegationRewards_0 = &utilities.DoubleArray{Encoding: map[string]int{"delegator_addr": 0, "validator_addr": 1, "denom": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}} +) + +func request_Query_AllianceDelegationRewards_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AllianceDelegationRewardsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_addr") + } + + protoReq.DelegatorAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_addr", err) + } + + val, ok = pathParams["validator_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") + } + + protoReq.ValidatorAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", 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) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllianceDelegationRewards_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AllianceDelegationRewards(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllianceDelegationRewards_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AllianceDelegationRewardsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["delegator_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_addr") + } + + protoReq.DelegatorAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_addr", err) + } + + val, ok = pathParams["validator_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") + } + + protoReq.ValidatorAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", 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) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllianceDelegationRewards_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AllianceDelegationRewards(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. @@ -567,6 +683,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_AllianceDelegationRewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AllianceDelegationRewards_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AllianceDelegationRewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -728,6 +867,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_AllianceDelegationRewards_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_AllianceDelegationRewards_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_AllianceDelegationRewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -743,6 +902,8 @@ var ( pattern_Query_AlliancesDelegationByValidator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3}, []string{"terra", "alliances", "delegator_addr", "validator_addr"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_AllianceDelegation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"terra", "alliances", "delegator_addr", "validator_addr", "denom"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_AllianceDelegationRewards_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"terra", "alliances", "delegator_addr", "validator_addr", "denom"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -757,4 +918,6 @@ var ( forward_Query_AlliancesDelegationByValidator_0 = runtime.ForwardResponseMessage forward_Query_AllianceDelegation_0 = runtime.ForwardResponseMessage + + forward_Query_AllianceDelegationRewards_0 = runtime.ForwardResponseMessage )