feat(accounts): Add codec.BinaryCodec and Gas to dependencies. (#19068)
Co-authored-by: unknown unknown <unknown@unknown>
This commit is contained in:
co-authored by
unknown unknown
parent
822d90c4b1
commit
498cd6a533
@@ -0,0 +1,30 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"cosmossdk.io/core/gas"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
var _ gas.Service = (*GasService)(nil)
|
||||
|
||||
type GasService struct{}
|
||||
|
||||
func (g GasService) GetGasMeter(ctx context.Context) gas.Meter {
|
||||
sdkCtx := sdk.UnwrapSDKContext(ctx)
|
||||
return sdkCtx.GasMeter()
|
||||
}
|
||||
|
||||
func (g GasService) GetBlockGasMeter(ctx context.Context) gas.Meter {
|
||||
return sdk.UnwrapSDKContext(ctx).BlockGasMeter()
|
||||
}
|
||||
|
||||
func (g GasService) WithGasMeter(ctx context.Context, meter gas.Meter) context.Context {
|
||||
return sdk.UnwrapSDKContext(ctx).WithGasMeter(meter)
|
||||
}
|
||||
|
||||
func (g GasService) WithBlockGasMeter(ctx context.Context, meter gas.Meter) context.Context {
|
||||
return sdk.UnwrapSDKContext(ctx).WithBlockGasMeter(meter)
|
||||
}
|
||||
Reference in New Issue
Block a user