forked from terra-money/classic-core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
genesis.go
41 lines (34 loc) · 1.11 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 budget
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// GenesisState - all distribution state that must be provided at genesis
type GenesisState struct {
Params Params `json:"params"` // budget params
}
func NewGenesisState(params Params) GenesisState {
return GenesisState{
Params: params,
}
}
// get raw genesis raw message for testing
func DefaultGenesisState() GenesisState {
return GenesisState{
Params: DefaultParams(),
}
}
// new oracle genesis
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState) {
keeper.SetParams(ctx, data.Params)
}
// ExportGenesis returns a GenesisState for a given context and keeper. The
// GenesisState will contain the pool, and validator/delegator distribution info's
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState {
params := keeper.GetParams(ctx)
return NewGenesisState(params)
}
// ValidateGenesis validates the provided oracle genesis state to ensure the
// expected invariants holds. (i.e. params in correct bounds, no duplicate validators)
func ValidateGenesis(data GenesisState) error {
return validateParams(data.Params)
}