0g-chain/x/bep3/simulation/params.go
Denali Marsh 09a75bd7c6
[R4R] optional bep3 config params (#546)
* add minAmount, maxAmount

* update kava-3 params for compile

* fix migration script

* update to mainnet params

* remove height span validation for incoming swaps

* update to sdk.Int, set lock to 220

* update lock range to [220, 270]

* update bep3 module docs

* update MsgClaim's ValidateBasic

* update test comments
2020-06-04 16:03:14 -07:00

66 lines
1.9 KiB
Go

package simulation
import (
"fmt"
"math/rand"
"github.com/cosmos/cosmos-sdk/x/simulation"
"github.com/kava-labs/kava/x/bep3/types"
)
const (
keyBnbDeputyAddress = "BnbDeputyAddress"
keyBnbDeputyFixedFee = "BnbDeputyFixedFee"
keyMinAmount = "MinAmount"
keyMaxAmount = "MaxAmount"
keyMinBlockLock = "MinBlockLock"
keyMaxBlockLock = "MaxBlockLock"
keySupportedAssets = "SupportedAssets"
)
// ParamChanges defines the parameters that can be modified by param change proposals
func ParamChanges(r *rand.Rand) []simulation.ParamChange {
// We generate MinBlockLock first because the result is required by GenMaxBlockLock()
minBlockLockVal := GenMinBlockLock(r)
minAmount := GenMinAmount(r)
return []simulation.ParamChange{
simulation.NewSimParamChange(types.ModuleName, keyBnbDeputyAddress,
func(r *rand.Rand) string {
return fmt.Sprintf("\"%s\"", GenRandBnbDeputy(r).Address)
},
),
simulation.NewSimParamChange(types.ModuleName, keyBnbDeputyFixedFee,
func(r *rand.Rand) string {
return fmt.Sprintf("\"%s\"", GenRandBnbDeputyFixedFee(r).String())
},
),
simulation.NewSimParamChange(types.ModuleName, keyMinAmount,
func(r *rand.Rand) string {
return fmt.Sprintf("\"%s\"", minAmount.String())
},
),
simulation.NewSimParamChange(types.ModuleName, keyMaxAmount,
func(r *rand.Rand) string {
return fmt.Sprintf("\"%s\"", GenMaxAmount(r, minAmount).String())
},
),
simulation.NewSimParamChange(types.ModuleName, keyMinBlockLock,
func(r *rand.Rand) string {
return fmt.Sprintf("\"%d\"", minBlockLockVal)
},
),
simulation.NewSimParamChange(types.ModuleName, keyMaxBlockLock,
func(r *rand.Rand) string {
return fmt.Sprintf("\"%d\"", GenMaxBlockLock(r, minBlockLockVal))
},
),
simulation.NewSimParamChange(types.ModuleName, keySupportedAssets,
func(r *rand.Rand) string {
return fmt.Sprintf("\"%v\"", GenSupportedAssets(r))
},
),
}
}