mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-27 00:35:18 +00:00
dd1d248be2
* generate length 32 random bytes * fix test * implement BnbDeputyFixedFee param * clean up for PR * update deputy address * remove impossible check * move comment
53 lines
1.5 KiB
Go
53 lines
1.5 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"
|
|
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)
|
|
|
|
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("\"%d\"", GenRandBnbDeputyFixedFee(r))
|
|
},
|
|
),
|
|
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))
|
|
},
|
|
),
|
|
}
|
|
}
|