2020-04-24 21:55:18 +00:00
|
|
|
package simulation
|
|
|
|
|
|
|
|
import (
|
|
|
|
"math/rand"
|
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/simulation"
|
|
|
|
|
2024-05-01 03:17:24 +00:00
|
|
|
appparams "github.com/0glabs/0g-chain/app/params"
|
|
|
|
"github.com/0glabs/0g-chain/x/incentive/keeper"
|
|
|
|
"github.com/0glabs/0g-chain/x/incentive/types"
|
2020-04-24 21:55:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Simulation operation weights constants
|
|
|
|
const (
|
|
|
|
OpWeightMsgClaimReward = "op_weight_msg_claim_reward"
|
|
|
|
)
|
|
|
|
|
|
|
|
// WeightedOperations returns all the operations from the module with their respective weights
|
|
|
|
func WeightedOperations(
|
|
|
|
appParams simulation.AppParams, cdc *codec.Codec, ak auth.AccountKeeper, sk types.SupplyKeeper, k keeper.Keeper,
|
|
|
|
) simulation.WeightedOperations {
|
|
|
|
var weightMsgClaimReward int
|
|
|
|
|
|
|
|
appParams.GetOrGenerate(cdc, OpWeightMsgClaimReward, &weightMsgClaimReward, nil,
|
|
|
|
func(_ *rand.Rand) {
|
|
|
|
weightMsgClaimReward = appparams.DefaultWeightMsgClaimReward
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
return simulation.WeightedOperations{
|
|
|
|
simulation.NewWeightedOperation(
|
|
|
|
weightMsgClaimReward,
|
|
|
|
SimulateMsgClaimReward(ak, sk, k),
|
|
|
|
),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SimulateMsgClaimReward generates a MsgClaimReward
|
|
|
|
func SimulateMsgClaimReward(ak auth.AccountKeeper, sk types.SupplyKeeper, k keeper.Keeper) simulation.Operation {
|
|
|
|
return func(
|
|
|
|
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, chainID string,
|
|
|
|
) (simulation.OperationMsg, []simulation.FutureOperation, error) {
|
2021-01-18 19:12:37 +00:00
|
|
|
return simulation.NewOperationMsgBasic(types.ModuleName,
|
|
|
|
"no-operation (no accounts currently have fulfillable claims)", "", false, nil), nil, nil
|
2020-04-24 21:55:18 +00:00
|
|
|
}
|
|
|
|
}
|