-
Notifications
You must be signed in to change notification settings - Fork 663
/
querier.go
37 lines (29 loc) · 1011 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
package globalfee
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/gaia/v10/x/globalfee/types"
)
var _ types.QueryServer = &GrpcQuerier{}
// ParamSource is a read only subset of paramtypes.Subspace
type ParamSource interface {
Get(ctx sdk.Context, key []byte, ptr interface{})
Has(ctx sdk.Context, key []byte) bool
}
type GrpcQuerier struct {
paramSource ParamSource
}
func NewGrpcQuerier(paramSource ParamSource) GrpcQuerier {
return GrpcQuerier{paramSource: paramSource}
}
// MinimumGasPrices return minimum gas prices
func (g GrpcQuerier) MinimumGasPrices(stdCtx context.Context, _ *types.QueryMinimumGasPricesRequest) (*types.QueryMinimumGasPricesResponse, error) {
var minGasPrices sdk.DecCoins
ctx := sdk.UnwrapSDKContext(stdCtx)
if g.paramSource.Has(ctx, types.ParamStoreKeyMinGasPrices) {
g.paramSource.Get(ctx, types.ParamStoreKeyMinGasPrices, &minGasPrices)
}
return &types.QueryMinimumGasPricesResponse{
MinimumGasPrices: minGasPrices,
}, nil
}