-
Notifications
You must be signed in to change notification settings - Fork 331
/
operations.go
51 lines (42 loc) · 1.6 KB
/
operations.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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"
appparams "github.com/kava-labs/kava/app/params"
"github.com/kava-labs/kava/x/incentive/keeper"
"github.com/kava-labs/kava/x/incentive/types"
)
// 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) {
return simulation.NewOperationMsgBasic(types.ModuleName,
"no-operation (no accounts currently have fulfillable claims)", "", false, nil), nil, nil
}
}