2018-08-12 00:33:48 -07:00
|
|
|
package slashing
|
|
|
|
|
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/stake/types"
|
|
|
|
)
|
|
|
|
|
2018-08-31 02:03:43 -07:00
|
|
|
// GenesisState - all slashing state that must be provided at genesis
|
|
|
|
type GenesisState struct {
|
|
|
|
Params Params
|
|
|
|
}
|
|
|
|
|
|
|
|
// HubDefaultGenesisState - default GenesisState used by Cosmos Hub
|
2018-09-10 04:59:05 -07:00
|
|
|
func DefaultGenesisState() GenesisState {
|
2018-08-31 02:03:43 -07:00
|
|
|
return GenesisState{
|
2018-09-10 04:59:05 -07:00
|
|
|
Params: DefaultParams(),
|
2018-08-31 02:03:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// InitGenesis initialize default parameters
|
|
|
|
// and the keeper's address to pubkey map
|
2018-09-10 05:10:06 -07:00
|
|
|
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState, sdata types.GenesisState) {
|
2018-08-31 02:03:43 -07:00
|
|
|
for _, validator := range sdata.Validators {
|
2018-09-26 12:07:22 -07:00
|
|
|
keeper.addPubkey(ctx, validator.GetConsPubKey())
|
2018-08-12 00:33:48 -07:00
|
|
|
}
|
2018-08-31 02:03:43 -07:00
|
|
|
|
2018-10-10 13:01:30 -07:00
|
|
|
keeper.paramspace.SetParamSet(ctx, &data.Params)
|
2018-08-12 00:33:48 -07:00
|
|
|
}
|