forked from evmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genesis.go
41 lines (36 loc) · 1.27 KB
/
genesis.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// GenesisState - all staking state that must be provided at genesis
type GenesisState struct {
Pool Pool `json:"pool"`
Params Params `json:"params"`
LastTotalPower sdk.Int `json:"last_total_power"`
LastValidatorPowers []LastValidatorPower `json:"last_validator_powers"`
Validators Validators `json:"validators"`
Delegations Delegations `json:"delegations"`
UnbondingDelegations []UnbondingDelegation `json:"unbonding_delegations"`
Redelegations []Redelegation `json:"redelegations"`
Exported bool `json:"exported"`
}
// Last validator power, needed for validator set update logic
type LastValidatorPower struct {
Address sdk.ValAddress
Power int64
}
func NewGenesisState(pool Pool, params Params, validators []Validator, delegations []Delegation) GenesisState {
return GenesisState{
Pool: pool,
Params: params,
Validators: validators,
Delegations: delegations,
}
}
// get raw genesis raw message for testing
func DefaultGenesisState() GenesisState {
return GenesisState{
Pool: InitialPool(),
Params: DefaultParams(),
}
}