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 {
|
2018-11-08 16:28:28 -08:00
|
|
|
Pool Pool `json:"pool"`
|
|
|
|
Params Params `json:"params"`
|
|
|
|
LastTotalPower sdk.Int `json:"last_total_power"`
|
2018-11-13 06:08:14 -08:00
|
|
|
LastValidatorPowers []LastValidatorPower `json:"last_validator_powers"`
|
2018-11-08 16:28:28 -08:00
|
|
|
Validators []Validator `json:"validators"`
|
|
|
|
Bonds []Delegation `json:"bonds"`
|
|
|
|
UnbondingDelegations []UnbondingDelegation `json:"unbonding_delegations"`
|
|
|
|
Redelegations []Redelegation `json:"redelegations"`
|
2018-11-13 06:08:14 -08:00
|
|
|
Exported bool `json:"exported"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Last validator power, needed for validator set update logic
|
|
|
|
type LastValidatorPower struct {
|
|
|
|
Address sdk.ValAddress
|
|
|
|
Power sdk.Int
|
2018-06-26 19:00:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewGenesisState(pool Pool, params Params, validators []Validator, bonds []Delegation) GenesisState {
|
|
|
|
return GenesisState{
|
|
|
|
Pool: pool,
|
|
|
|
Params: params,
|
|
|
|
Validators: validators,
|
|
|
|
Bonds: bonds,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// get raw genesis raw message for testing
|
|
|
|
func DefaultGenesisState() GenesisState {
|
|
|
|
return GenesisState{
|
|
|
|
Pool: InitialPool(),
|
|
|
|
Params: DefaultParams(),
|
|
|
|
}
|
|
|
|
}
|