-
Notifications
You must be signed in to change notification settings - Fork 206
/
genesis.go
56 lines (49 loc) · 1.43 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package simulation
// DONTCOVER
import (
"encoding/json"
"fmt"
"time"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/NibiruChain/nibiru/x/epochs/types"
)
// RandomizedGenState generates a random GenesisState for mint.
func RandomizedGenState(simState *module.SimulationState) {
epochs := []types.EpochInfo{
{
Identifier: "day",
StartTime: time.Time{},
Duration: time.Hour * 24,
CurrentEpoch: 0,
CurrentEpochStartHeight: 0,
CurrentEpochStartTime: time.Time{},
EpochCountingStarted: false,
},
{
Identifier: "hour",
StartTime: time.Time{},
Duration: time.Hour,
CurrentEpoch: 0,
CurrentEpochStartHeight: 0,
CurrentEpochStartTime: time.Time{},
EpochCountingStarted: false,
},
{
Identifier: "second",
StartTime: time.Time{},
Duration: time.Second,
CurrentEpoch: 0,
CurrentEpochStartHeight: 0,
CurrentEpochStartTime: time.Time{},
EpochCountingStarted: false,
},
}
epochGenesis := types.NewGenesisState(epochs)
bz, err := json.MarshalIndent(&epochGenesis, "", " ")
if err != nil {
panic(err)
}
// TODO: Do some randomization later
fmt.Printf("Selected deterministically generated epoch parameters:\n%s\n", bz)
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(epochGenesis)
}