-
Notifications
You must be signed in to change notification settings - Fork 3
/
genesis.go
38 lines (32 loc) · 1.02 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
package simulation
// DONTCOVER
import (
"encoding/json"
"fmt"
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmosquad-labs/squad/v2/x/mint/types"
)
// RandomizedGenState generates a random GenesisState for mint
func RandomizedGenState(simState *module.SimulationState) {
mintGenesis := types.DefaultGenesisState()
mintGenesis.Params.InflationSchedules = []types.InflationSchedule{
{
StartTime: simState.GenTimestamp,
EndTime: simState.GenTimestamp.Add(time.Hour * 24 * 365), // 1 year
Amount: sdk.NewInt(300000000000000),
},
{
StartTime: simState.GenTimestamp.Add(time.Hour * 24 * 365),
EndTime: simState.GenTimestamp.Add(time.Hour * 24 * 365 * 2),
Amount: sdk.NewInt(200000000000000),
},
}
bz, err := json.MarshalIndent(&mintGenesis, "", " ")
if err != nil {
panic(err)
}
fmt.Printf("Selected randomly generated mint parameters:\n%s\n", bz)
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(mintGenesis)
}