2020-02-25 15:11:09 +00:00
|
|
|
package simulation
|
|
|
|
|
|
|
|
import (
|
2020-04-13 16:01:54 +00:00
|
|
|
"fmt"
|
2020-02-25 15:11:09 +00:00
|
|
|
"math/rand"
|
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/simulation"
|
2020-04-13 16:01:54 +00:00
|
|
|
|
|
|
|
"github.com/kava-labs/kava/x/auction/types"
|
2020-02-25 15:11:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// ParamChanges defines the parameters that can be modified by param change proposals
|
|
|
|
// on the simulation
|
|
|
|
func ParamChanges(r *rand.Rand) []simulation.ParamChange {
|
2020-04-13 16:01:54 +00:00
|
|
|
// Note: params are encoded to JSON before being stored in the param store. These param changes
|
|
|
|
// update the raw values in the store so values need to be JSON. This is why values that are represented
|
|
|
|
// as strings in JSON (such as time.Duration) have the escaped quotes.
|
|
|
|
// TODO should we encode the values properly with ModuleCdc.MustMarshalJSON()?
|
|
|
|
return []simulation.ParamChange{
|
2020-04-23 16:35:58 +00:00
|
|
|
simulation.NewSimParamChange(types.ModuleName, string(types.KeyBidDuration),
|
2020-04-13 16:01:54 +00:00
|
|
|
func(r *rand.Rand) string {
|
2020-04-23 16:35:58 +00:00
|
|
|
return fmt.Sprintf("%d", GenBidDuration(r))
|
2020-04-13 16:01:54 +00:00
|
|
|
},
|
|
|
|
),
|
2020-04-23 16:35:58 +00:00
|
|
|
simulation.NewSimParamChange(types.ModuleName, string(types.KeyMaxAuctionDuration),
|
2020-04-13 16:01:54 +00:00
|
|
|
func(r *rand.Rand) string {
|
2020-04-23 16:35:58 +00:00
|
|
|
return fmt.Sprintf("%d", GenMaxAuctionDuration(r))
|
2020-04-13 16:01:54 +00:00
|
|
|
},
|
|
|
|
),
|
2020-04-23 16:35:58 +00:00
|
|
|
simulation.NewSimParamChange(types.ModuleName, string(types.KeyIncrementCollateral),
|
2020-04-13 16:01:54 +00:00
|
|
|
func(r *rand.Rand) string {
|
2020-04-23 16:35:58 +00:00
|
|
|
return fmt.Sprintf("%d", GenIncrementCollateral(r))
|
2020-04-13 16:01:54 +00:00
|
|
|
},
|
|
|
|
),
|
2020-04-23 16:35:58 +00:00
|
|
|
simulation.NewSimParamChange(types.ModuleName, string(types.KeyIncrementDebt),
|
2020-04-13 16:01:54 +00:00
|
|
|
func(r *rand.Rand) string {
|
2020-04-23 16:35:58 +00:00
|
|
|
return fmt.Sprintf("%d", GenIncrementDebt(r))
|
2020-04-13 16:01:54 +00:00
|
|
|
},
|
|
|
|
),
|
2020-04-23 16:35:58 +00:00
|
|
|
simulation.NewSimParamChange(types.ModuleName, string(types.KeyIncrementSurplus),
|
2020-04-13 16:01:54 +00:00
|
|
|
func(r *rand.Rand) string {
|
2020-04-23 16:35:58 +00:00
|
|
|
return fmt.Sprintf("%d", GenIncrementSurplus(r))
|
2020-04-13 16:01:54 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
}
|
2020-02-25 15:11:09 +00:00
|
|
|
}
|