-
Notifications
You must be signed in to change notification settings - Fork 3
/
helpers.go
40 lines (32 loc) · 1.31 KB
/
helpers.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
package testutil
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/testutil"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmosquad-labs/squad/v3/x/liquidfarming/client/cli"
)
var commonArgs = []string{
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 10)).String()),
}
func MsgLiquidFarmExec(clientCtx client.Context, from, poolId string, amount sdk.Coin, extraArgs ...string) (testutil.BufferWriter, error) {
args := append(append([]string{
poolId,
amount.String(),
fmt.Sprintf("--%s=%s", flags.FlagFrom, from),
}, commonArgs...), extraArgs...)
return clitestutil.ExecTestCLICmd(clientCtx, cli.NewLiquidFarmCmd(), args)
}
func MsgPlaceBidExec(clientCtx client.Context, from, auctionId, poolId string, amount sdk.Coin, extraArgs ...string) (testutil.BufferWriter, error) {
args := append(append([]string{
auctionId,
poolId,
amount.String(),
fmt.Sprintf("--%s=%s", flags.FlagFrom, from),
}, commonArgs...), extraArgs...)
return clitestutil.ExecTestCLICmd(clientCtx, cli.NewPlaceBidCmd(), args)
}