2020-03-30 15:02:43 +00:00
|
|
|
package simulation
|
|
|
|
|
|
|
|
import (
|
2020-04-12 03:54:45 +00:00
|
|
|
"fmt"
|
2020-03-30 15:02:43 +00:00
|
|
|
"math/rand"
|
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/simulation"
|
2020-04-12 03:54:45 +00:00
|
|
|
|
|
|
|
"github.com/kava-labs/kava/x/bep3/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
keyBnbDeputyAddress = "BnbDeputyAddress"
|
|
|
|
keyMinBlockLock = "MinBlockLock"
|
|
|
|
keyMaxBlockLock = "MaxBlockLock"
|
|
|
|
keySupportedAssets = "SupportedAssets"
|
2020-03-30 15:02:43 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// ParamChanges defines the parameters that can be modified by param change proposals
|
|
|
|
func ParamChanges(r *rand.Rand) []simulation.ParamChange {
|
2020-04-12 03:54:45 +00:00
|
|
|
// We generate MinBlockLock first because the result is required by GenMaxBlockLock()
|
|
|
|
minBlockLockVal := GenMinBlockLock(r)
|
|
|
|
|
|
|
|
return []simulation.ParamChange{
|
2020-04-23 16:35:58 +00:00
|
|
|
simulation.NewSimParamChange(types.ModuleName, keyBnbDeputyAddress,
|
2020-04-12 03:54:45 +00:00
|
|
|
func(r *rand.Rand) string {
|
2020-04-23 16:35:58 +00:00
|
|
|
return fmt.Sprintf("\"%s\"", GenRandBnbDeputy(r).Address)
|
2020-04-12 03:54:45 +00:00
|
|
|
},
|
|
|
|
),
|
2020-04-23 16:35:58 +00:00
|
|
|
simulation.NewSimParamChange(types.ModuleName, keyMinBlockLock,
|
2020-04-12 03:54:45 +00:00
|
|
|
func(r *rand.Rand) string {
|
|
|
|
return fmt.Sprintf("\"%d\"", minBlockLockVal)
|
|
|
|
},
|
|
|
|
),
|
2020-04-23 16:35:58 +00:00
|
|
|
simulation.NewSimParamChange(types.ModuleName, keyMaxBlockLock,
|
2020-04-12 03:54:45 +00:00
|
|
|
func(r *rand.Rand) string {
|
|
|
|
return fmt.Sprintf("\"%d\"", GenMaxBlockLock(r, minBlockLockVal))
|
|
|
|
},
|
|
|
|
),
|
2020-04-23 16:35:58 +00:00
|
|
|
simulation.NewSimParamChange(types.ModuleName, keySupportedAssets,
|
2020-04-12 03:54:45 +00:00
|
|
|
func(r *rand.Rand) string {
|
|
|
|
return fmt.Sprintf("\"%v\"", GenSupportedAssets(r))
|
|
|
|
},
|
|
|
|
),
|
|
|
|
}
|
2020-03-30 15:02:43 +00:00
|
|
|
}
|