2018-06-26 19:00:12 -07:00
|
|
|
package types
|
|
|
|
|
2018-11-08 16:28:28 -08:00
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
)
|
|
|
|
|
2018-06-26 19:00:12 -07:00
|
|
|
// GenesisState - all staking state that must be provided at genesis
|
|
|
|
type GenesisState struct {
|
2019-07-05 16:25:56 -07:00
|
|
|
Params Params `json:"params" yaml:"params"`
|
|
|
|
LastTotalPower sdk.Int `json:"last_total_power" yaml:"last_total_power"`
|
|
|
|
LastValidatorPowers []LastValidatorPower `json:"last_validator_powers" yaml:"last_validator_powers"`
|
|
|
|
Validators Validators `json:"validators" yaml:"validators"`
|
|
|
|
Delegations Delegations `json:"delegations" yaml:"delegations"`
|
|
|
|
UnbondingDelegations []UnbondingDelegation `json:"unbonding_delegations" yaml:"unbonding_delegations"`
|
|
|
|
Redelegations []Redelegation `json:"redelegations" yaml:"redelegations"`
|
|
|
|
Exported bool `json:"exported" yaml:"exported"`
|
2018-11-13 06:08:14 -08:00
|
|
|
}
|
|
|
|
|
2019-12-06 10:18:00 -08:00
|
|
|
// LastValidatorPower required for validator set update logic
|
2018-11-13 06:08:14 -08:00
|
|
|
type LastValidatorPower struct {
|
|
|
|
Address sdk.ValAddress
|
2019-02-05 21:30:48 -08:00
|
|
|
Power int64
|
2018-06-26 19:00:12 -07:00
|
|
|
}
|
|
|
|
|
2019-12-06 10:18:00 -08:00
|
|
|
// NewGenesisState creates a new GenesisState instanc e
|
2019-06-28 13:11:27 -07:00
|
|
|
func NewGenesisState(params Params, validators []Validator, delegations []Delegation) GenesisState {
|
2018-06-26 19:00:12 -07:00
|
|
|
return GenesisState{
|
2019-02-13 15:01:50 -08:00
|
|
|
Params: params,
|
|
|
|
Validators: validators,
|
|
|
|
Delegations: delegations,
|
2018-06-26 19:00:12 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:18:00 -08:00
|
|
|
// DefaultGenesisState gets the raw genesis raw message for testing
|
2018-06-26 19:00:12 -07:00
|
|
|
func DefaultGenesisState() GenesisState {
|
|
|
|
return GenesisState{
|
|
|
|
Params: DefaultParams(),
|
|
|
|
}
|
|
|
|
}
|