2020-09-02 19:41:05 +00:00
|
|
|
package keeper
|
|
|
|
|
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
|
|
|
|
"github.com/cosmos/ethermint/x/evm/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// GetParams returns the total set of evm parameters.
|
|
|
|
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
|
2021-05-25 12:56:36 +00:00
|
|
|
k.paramSpace.GetParamSet(ctx, ¶ms)
|
|
|
|
return params
|
2020-09-02 19:41:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetParams sets the evm parameters to the param space.
|
|
|
|
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
|
2021-05-25 12:56:36 +00:00
|
|
|
k.paramSpace.SetParamSet(ctx, ¶ms)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetChainConfig gets block height from block consensus hash
|
|
|
|
func (k Keeper) GetChainConfig(ctx sdk.Context) (types.ChainConfig, bool) {
|
|
|
|
store := ctx.KVStore(k.storeKey)
|
|
|
|
bz := store.Get(types.KeyPrefixChainConfig)
|
|
|
|
if len(bz) == 0 {
|
|
|
|
return types.ChainConfig{}, false
|
|
|
|
}
|
|
|
|
|
|
|
|
var config types.ChainConfig
|
|
|
|
k.cdc.MustUnmarshalBinaryBare(bz, &config)
|
|
|
|
return config, true
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetChainConfig sets the mapping from block consensus hash to block height
|
|
|
|
func (k Keeper) SetChainConfig(ctx sdk.Context, config types.ChainConfig) {
|
|
|
|
store := ctx.KVStore(k.storeKey)
|
|
|
|
bz := k.cdc.MustMarshalBinaryBare(&config)
|
|
|
|
store.Set(types.KeyPrefixChainConfig, bz)
|
2020-09-02 19:41:05 +00:00
|
|
|
}
|