-
Notifications
You must be signed in to change notification settings - Fork 589
/
genesis.go
49 lines (41 loc) · 1.19 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
package simulation
// DONTCOVER
import (
"encoding/json"
"fmt"
"math/rand"
"time"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/osmosis-labs/osmosis/v6/x/incentives/types"
)
// Simulation parameter constants
const (
ParamsDistrEpochIdentifier = "distr_epoch_identifier"
)
// RandomizedGenState generates a random GenesisState for gov
func RandomizedGenState(simState *module.SimulationState) {
// Parameter for how often rewards get distributed
var distrEpochIdentifier string
simState.AppParams.GetOrGenerate(
simState.Cdc, ParamsDistrEpochIdentifier, &distrEpochIdentifier, simState.Rand,
func(r *rand.Rand) { distrEpochIdentifier = GenParamsDistrEpochIdentifier(r) },
)
incentivesGenesis := types.GenesisState{
Params: types.Params{
DistrEpochIdentifier: distrEpochIdentifier,
},
// Gauges: gauges,
LockableDurations: []time.Duration{
time.Second,
time.Hour,
time.Hour * 3,
time.Hour * 7,
},
}
bz, err := json.MarshalIndent(&incentivesGenesis, "", " ")
if err != nil {
panic(err)
}
fmt.Printf("Selected randomly generated incentives parameters:\n%s\n", bz)
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&incentivesGenesis)
}