random auction params
This commit is contained in:
parent
d4b13e2859
commit
9ea31b81f5
@ -3,15 +3,24 @@ package simulation
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
|
||||
"github.com/cerc-io/laconicd/x/auction/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// RandomizedGenState generates a random GenesisState
|
||||
func RandomizedGenState(simState *module.SimulationState) {
|
||||
auctionGenesis := types.DefaultGenesisState()
|
||||
auctionParams := types.NewParams(time.Duration(simState.Rand.Intn(1000))*time.Second,
|
||||
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
||||
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
||||
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
||||
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
||||
)
|
||||
|
||||
auctionGenesis := types.NewGenesisState(auctionParams, []*types.Auction{})
|
||||
|
||||
bz, err := json.MarshalIndent(auctionGenesis, "", " ")
|
||||
if err != nil {
|
||||
|
@ -8,3 +8,10 @@ func DefaultGenesisState() *GenesisState {
|
||||
Auctions: []*Auction{},
|
||||
}
|
||||
}
|
||||
|
||||
func NewGenesisState(params Params, auctions []*Auction) *GenesisState {
|
||||
return &GenesisState{
|
||||
Params: params,
|
||||
Auctions: auctions,
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,14 @@ var (
|
||||
|
||||
var _ types.ParamSet = &Params{}
|
||||
|
||||
func NewParams() Params {
|
||||
return DefaultParams()
|
||||
func NewParams(commitsDuration time.Duration, revealsDuration time.Duration, commitFee sdk.Coin, revealFee sdk.Coin, minimumBid sdk.Coin) Params {
|
||||
return Params{
|
||||
CommitsDuration: commitsDuration,
|
||||
RevealsDuration: revealsDuration,
|
||||
CommitFee: commitFee,
|
||||
RevealFee: revealFee,
|
||||
MinimumBid: minimumBid,
|
||||
}
|
||||
}
|
||||
|
||||
// ParamKeyTable - ParamTable for bond module.
|
||||
|
Loading…
Reference in New Issue
Block a user