laconicd-deprecated/x/feemarket/keeper/grpc_query.go
crypto-facs 620f6a6770
imp(feemarket): update BaseFee based on GasWanted (#1105)
* add gasWanted transient store keys

* add gasWanted transient store keeper functions

* add gasWanted transient store tracker

* add comment

* remove unncesary comment

* remove unnecesary function

* fix tests

* fix bad comment

* remove unnecesary comment

* update comment

* update changelog

* Update CHANGELOG.md

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* add GasWantedDecorator

* remove unnecesary comments

* gasWanted decorator test

* fix tests

* fix tests and build

* fix lint

* updated end block event

* Update app/ante/fee_market.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* fix undeclared variable

* Update app/ante/fee_market_test.go

* remove unnecesary line

* migrate MinGasMultiplier to FeeMarket module

* set limited gas wanted

* remove old newKeeper param

* update proto comment

* fix test

* update comments

* Update x/feemarket/keeper/abci.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* address comments from review

* tidy

* tests

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-06-05 09:22:33 +00:00

47 lines
1.1 KiB
Go

package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tharsis/ethermint/x/feemarket/types"
)
var _ types.QueryServer = Keeper{}
// Params implements the Query/Params gRPC method
func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
params := k.GetParams(ctx)
return &types.QueryParamsResponse{
Params: params,
}, nil
}
// BaseFee implements the Query/BaseFee gRPC method
func (k Keeper) BaseFee(c context.Context, _ *types.QueryBaseFeeRequest) (*types.QueryBaseFeeResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
res := &types.QueryBaseFeeResponse{}
baseFee := k.GetBaseFee(ctx)
if baseFee != nil {
aux := sdk.NewIntFromBigInt(baseFee)
res.BaseFee = &aux
}
return res, nil
}
// BlockGas implements the Query/BlockGas gRPC method
func (k Keeper) BlockGas(c context.Context, _ *types.QueryBlockGasRequest) (*types.QueryBlockGasResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
gas := k.GetBlockGasWanted(ctx)
return &types.QueryBlockGasResponse{
Gas: int64(gas),
}, nil
}