This commit is contained in:
parent
bec98b55e3
commit
95d873faeb
|
@ -23,7 +23,6 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
"github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
||||||
"github.com/cosmos/cosmos-sdk/x/distribution/simulation"
|
"github.com/cosmos/cosmos-sdk/x/distribution/simulation"
|
||||||
"github.com/cosmos/cosmos-sdk/x/distribution/types"
|
"github.com/cosmos/cosmos-sdk/x/distribution/types"
|
||||||
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -95,13 +94,13 @@ type AppModule struct {
|
||||||
keeper keeper.Keeper
|
keeper keeper.Keeper
|
||||||
accountKeeper types.AccountKeeper
|
accountKeeper types.AccountKeeper
|
||||||
bankKeeper types.BankKeeper
|
bankKeeper types.BankKeeper
|
||||||
stakingKeeper stakingkeeper.Keeper
|
stakingKeeper types.StakingKeeper
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAppModule creates a new AppModule object
|
// NewAppModule creates a new AppModule object
|
||||||
func NewAppModule(
|
func NewAppModule(
|
||||||
cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper,
|
cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper,
|
||||||
bankKeeper types.BankKeeper, stakingKeeper stakingkeeper.Keeper,
|
bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper,
|
||||||
) AppModule {
|
) AppModule {
|
||||||
return AppModule{
|
return AppModule{
|
||||||
AppModuleBasic: AppModuleBasic{cdc: cdc},
|
AppModuleBasic: AppModuleBasic{cdc: cdc},
|
||||||
|
|
|
@ -24,11 +24,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// WeightedOperations returns all the operations from the module with their respective weights
|
// WeightedOperations returns all the operations from the module with their respective weights
|
||||||
func WeightedOperations(
|
func WeightedOperations(appParams simtypes.AppParams, cdc codec.JSONCodec, ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, sk types.StakingKeeper) simulation.WeightedOperations {
|
||||||
appParams simtypes.AppParams, cdc codec.JSONCodec, ak types.AccountKeeper,
|
|
||||||
bk types.BankKeeper, k keeper.Keeper, sk stakingkeeper.Keeper,
|
|
||||||
) simulation.WeightedOperations {
|
|
||||||
|
|
||||||
var weightMsgSetWithdrawAddress int
|
var weightMsgSetWithdrawAddress int
|
||||||
appParams.GetOrGenerate(cdc, OpWeightMsgSetWithdrawAddress, &weightMsgSetWithdrawAddress, nil,
|
appParams.GetOrGenerate(cdc, OpWeightMsgSetWithdrawAddress, &weightMsgSetWithdrawAddress, nil,
|
||||||
func(_ *rand.Rand) {
|
func(_ *rand.Rand) {
|
||||||
|
@ -57,6 +53,8 @@ func WeightedOperations(
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
stakeKeeper := sk.(stakingkeeper.Keeper)
|
||||||
|
|
||||||
return simulation.WeightedOperations{
|
return simulation.WeightedOperations{
|
||||||
simulation.NewWeightedOperation(
|
simulation.NewWeightedOperation(
|
||||||
weightMsgSetWithdrawAddress,
|
weightMsgSetWithdrawAddress,
|
||||||
|
@ -64,15 +62,15 @@ func WeightedOperations(
|
||||||
),
|
),
|
||||||
simulation.NewWeightedOperation(
|
simulation.NewWeightedOperation(
|
||||||
weightMsgWithdrawDelegationReward,
|
weightMsgWithdrawDelegationReward,
|
||||||
SimulateMsgWithdrawDelegatorReward(ak, bk, k, sk),
|
SimulateMsgWithdrawDelegatorReward(ak, bk, k, stakeKeeper),
|
||||||
),
|
),
|
||||||
simulation.NewWeightedOperation(
|
simulation.NewWeightedOperation(
|
||||||
weightMsgWithdrawValidatorCommission,
|
weightMsgWithdrawValidatorCommission,
|
||||||
SimulateMsgWithdrawValidatorCommission(ak, bk, k, sk),
|
SimulateMsgWithdrawValidatorCommission(ak, bk, k, stakeKeeper),
|
||||||
),
|
),
|
||||||
simulation.NewWeightedOperation(
|
simulation.NewWeightedOperation(
|
||||||
weightMsgFundCommunityPool,
|
weightMsgFundCommunityPool,
|
||||||
SimulateMsgFundCommunityPool(ak, bk, k, sk),
|
SimulateMsgFundCommunityPool(ak, bk, k, stakeKeeper),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
"github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
||||||
"github.com/cosmos/cosmos-sdk/x/slashing/simulation"
|
"github.com/cosmos/cosmos-sdk/x/slashing/simulation"
|
||||||
"github.com/cosmos/cosmos-sdk/x/slashing/types"
|
"github.com/cosmos/cosmos-sdk/x/slashing/types"
|
||||||
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -98,11 +97,11 @@ type AppModule struct {
|
||||||
keeper keeper.Keeper
|
keeper keeper.Keeper
|
||||||
accountKeeper types.AccountKeeper
|
accountKeeper types.AccountKeeper
|
||||||
bankKeeper types.BankKeeper
|
bankKeeper types.BankKeeper
|
||||||
stakingKeeper stakingkeeper.Keeper
|
stakingKeeper types.StakingKeeper
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAppModule creates a new AppModule object
|
// NewAppModule creates a new AppModule object
|
||||||
func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper, sk stakingkeeper.Keeper) AppModule {
|
func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper) AppModule {
|
||||||
return AppModule{
|
return AppModule{
|
||||||
AppModuleBasic: AppModuleBasic{cdc: cdc},
|
AppModuleBasic: AppModuleBasic{cdc: cdc},
|
||||||
keeper: keeper,
|
keeper: keeper,
|
||||||
|
|
|
@ -24,7 +24,7 @@ const (
|
||||||
// WeightedOperations returns all the operations from the module with their respective weights
|
// WeightedOperations returns all the operations from the module with their respective weights
|
||||||
func WeightedOperations(
|
func WeightedOperations(
|
||||||
appParams simtypes.AppParams, cdc codec.JSONCodec, ak types.AccountKeeper,
|
appParams simtypes.AppParams, cdc codec.JSONCodec, ak types.AccountKeeper,
|
||||||
bk types.BankKeeper, k keeper.Keeper, sk stakingkeeper.Keeper,
|
bk types.BankKeeper, k keeper.Keeper, sk types.StakingKeeper,
|
||||||
) simulation.WeightedOperations {
|
) simulation.WeightedOperations {
|
||||||
|
|
||||||
var weightMsgUnjail int
|
var weightMsgUnjail int
|
||||||
|
@ -37,7 +37,7 @@ func WeightedOperations(
|
||||||
return simulation.WeightedOperations{
|
return simulation.WeightedOperations{
|
||||||
simulation.NewWeightedOperation(
|
simulation.NewWeightedOperation(
|
||||||
weightMsgUnjail,
|
weightMsgUnjail,
|
||||||
SimulateMsgUnjail(ak, bk, k, sk),
|
SimulateMsgUnjail(ak, bk, k, sk.(stakingkeeper.Keeper)),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue