-
Notifications
You must be signed in to change notification settings - Fork 55
/
params.go
45 lines (41 loc) 路 1.32 KB
/
params.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
package simulation
import (
"encoding/json"
"fmt"
"math/rand"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
"github.com/crescent-network/crescent/v2/x/liquidity/types"
)
// ParamChanges defines the parameters that can be modified by param change proposals
// on the simulation.
func ParamChanges(r *rand.Rand) []simtypes.ParamChange {
return []simtypes.ParamChange{
simulation.NewSimParamChange(types.ModuleName, string(types.KeyBatchSize),
func(r *rand.Rand) string {
return fmt.Sprintf("%d", GenBatchSize(r))
},
),
simulation.NewSimParamChange(types.ModuleName, string(types.KeyTickPrecision),
func(r *rand.Rand) string {
return fmt.Sprintf("%d", GenTickPrecision(r))
},
),
simulation.NewSimParamChange(types.ModuleName, string(types.KeyMaxPriceLimitRatio),
func(r *rand.Rand) string {
return fmt.Sprintf("\"%s\"", GenMaxPriceRatio(r))
},
),
simulation.NewSimParamChange(types.ModuleName, string(types.KeyWithdrawFeeRate),
func(r *rand.Rand) string {
return fmt.Sprintf("\"%s\"", GenWithdrawFeeRate(r))
},
),
simulation.NewSimParamChange(types.ModuleName, string(types.KeyMaxOrderLifespan),
func(r *rand.Rand) string {
bz, _ := json.Marshal(GenMaxOrderLifespan(r))
return fmt.Sprintf("\"%s\"", bz)
},
),
}
}