-
Notifications
You must be signed in to change notification settings - Fork 0
/
grpc_query_minter.go
41 lines (31 loc) · 1.4 KB
/
grpc_query_minter.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
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/furya-network/furya/x/mint/types"
)
// Inflation returns current inflation.
func (k Keeper) Inflation(c context.Context, _ *types.QueryInflationRequest) (*types.QueryInflationResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
minter := k.GetMinter(ctx)
return &types.QueryInflationResponse{Inflation: minter.Inflation}, nil
}
// PhaseStep returns phase step.
func (k Keeper) PhaseStep(c context.Context, _ *types.QueryPhaseStepRequest) (*types.QueryPhaseStepResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
minter := k.GetMinter(ctx)
return &types.QueryPhaseStepResponse{PhaseStep: minter.PhaseStep}, nil
}
// PhaseProvisions returns current phase provision.
func (k Keeper) PhaseProvisions(c context.Context, _ *types.QueryPhaseProvisionsRequest) (*types.QueryPhaseProvisionsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
minter := k.GetMinter(ctx)
return &types.QueryPhaseProvisionsResponse{PhaseProvisions: minter.PhaseProvisions}, nil
}
// EndPhaseStatus returns end phase status.
func (k Keeper) EndPhaseStatus(c context.Context, _ *types.QueryEndPhaseStatusRequest) (*types.QueryEndPhaseStatusResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
minter := k.GetMinter(ctx)
params := k.GetParams(ctx)
return &types.QueryEndPhaseStatusResponse{IsInEndPhase: params.IsEndPhaseByStep(int(minter.PhaseStep))}, nil
}