-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
grpc_query.go
47 lines (36 loc) · 1.23 KB
/
grpc_query.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package keeper
import (
"context"
"github.com/cosmos/cosmos-sdk/x/mint/types"
)
var _ types.QueryServer = queryServer{}
func NewQueryServerImpl(k Keeper) types.QueryServer {
return queryServer{k}
}
type queryServer struct {
k Keeper
}
// Params returns params of the mint module.
func (q queryServer) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
params, err := q.k.Params.Get(ctx)
if err != nil {
return nil, err
}
return &types.QueryParamsResponse{Params: params}, nil
}
// Inflation returns minter.Inflation of the mint module.
func (q queryServer) Inflation(ctx context.Context, _ *types.QueryInflationRequest) (*types.QueryInflationResponse, error) {
minter, err := q.k.Minter.Get(ctx)
if err != nil {
return nil, err
}
return &types.QueryInflationResponse{Inflation: minter.Inflation}, nil
}
// AnnualProvisions returns minter.AnnualProvisions of the mint module.
func (q queryServer) AnnualProvisions(ctx context.Context, _ *types.QueryAnnualProvisionsRequest) (*types.QueryAnnualProvisionsResponse, error) {
minter, err := q.k.Minter.Get(ctx)
if err != nil {
return nil, err
}
return &types.QueryAnnualProvisionsResponse{AnnualProvisions: minter.AnnualProvisions}, nil
}