-
Notifications
You must be signed in to change notification settings - Fork 48
/
querier.go
43 lines (31 loc) · 946 Bytes
/
querier.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
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/elys-network/elys/x/clock/types"
)
var _ types.QueryServer = &Querier{}
type Querier struct {
keeper Keeper
}
func NewQuerier(k Keeper) Querier {
return Querier{
keeper: k,
}
}
// ContractModules returns contract addresses which are using the clock
func (q Querier) ClockContracts(stdCtx context.Context, _ *types.QueryClockContracts) (*types.QueryClockContractsResponse, error) {
ctx := sdk.UnwrapSDKContext(stdCtx)
p := q.keeper.GetParams(ctx)
return &types.QueryClockContractsResponse{
ContractAddresses: p.ContractAddresses,
}, nil
}
// Params returns the total set of clock parameters.
func (q Querier) Params(stdCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(stdCtx)
p := q.keeper.GetParams(ctx)
return &types.QueryParamsResponse{
Params: &p,
}, nil
}