Skip to content

Commit

Permalink
Merge PR: add more AMM swap usage (#331)
Browse files Browse the repository at this point in the history
* add usage

* add more swap usage

* add more swap usage
  • Loading branch information
zhongqiuwood authored Sep 14, 2020
1 parent 7d194c4 commit 675c17e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
23 changes: 15 additions & 8 deletions x/ammswap/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package cli

import (
"fmt"
"github.com/cosmos/cosmos-sdk/version"
"strings"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/okex/okexchain/x/ammswap/types"
"github.com/spf13/cobra"
"strings"
)

// GetQueryCmd returns the cli query commands for this module
Expand All @@ -37,8 +37,16 @@ func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command {
//GetCmdSwapTokenPair query exchange with token name
func GetCmdSwapTokenPair(queryRoute string, cdc *codec.Codec) *cobra.Command {
return &cobra.Command{
Use: "exchange [token]",
Short: "exchange with token name",
Use: "pool-info [token]",
Short: "Query pool info by token name",
Long: strings.TrimSpace(
fmt.Sprintf(`Query pool info by token name.
Example:
$ okexchaincli query swap pool-info eth-355
`),
),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cliCtx := context.NewCLIContext().WithCodec(cdc)
Expand All @@ -56,16 +64,15 @@ func GetCmdSwapTokenPair(queryRoute string, cdc *codec.Codec) *cobra.Command {
}
}

// GetCmdQueryProposal implements the query proposal command.
func GetCmdQueryParams(queryRoute string, cdc *codec.Codec) *cobra.Command {
return &cobra.Command{
Use: "params",
Short: "Query the parameters of the governance process",
Short: "Query the parameters of the AMM swap system",
Long: strings.TrimSpace(
fmt.Sprintf(`Query the all the parameters for the governance process.
fmt.Sprintf(`Query the parameters of the AMM swap system.
Example:
$ %s query gov params
$ %s query swap params
`,
version.ClientName,
),
Expand Down
8 changes: 4 additions & 4 deletions x/ammswap/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func getCmdRemoveLiquidity(cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`remove liquidity.
Example:
$ okexchaincli tx swap remove-liquidity --max-base-amount 10eth-355 --quote-amount 100okt --min-liquidity 0.001
$ okexchaincli tx swap remove-liquidity --liquidity 1 --min-base-amount 10eth-355 --min-quote-amount 1okt
`),
),
Expand Down Expand Up @@ -145,7 +145,7 @@ func getCmdCreateExchange(cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`create token pair.
Example:
$ okexchaincli tx swap create-pair --max-base-amount 10eth-355 --quote-amount 100okt --min-liquidity 0.001
$ okexchaincli tx swap create-pair --token eth-355 --fees 0.01okt
`),
),
Expand All @@ -159,7 +159,7 @@ $ okexchaincli tx swap create-pair --max-base-amount 10eth-355 --quote-amount 10
},
}

cmd.Flags().StringVarP(&token, "token", "t", "", "Create exchange by token name")
cmd.Flags().StringVarP(&token, "token", "t", "", "Create an AMM swap pair by token name")
return cmd
}

Expand All @@ -176,7 +176,7 @@ func getCmdTokenSwap(cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`swap token.
Example:
$ okexchaincli tx swap token --max-base-amount 10eth-355 --quote-amount 100okt --min-liquidity 0.001
$ okexchaincli tx swap token --sell-amount 1eth-355 --min-buy-amount 60okt
`),
),
Expand Down

0 comments on commit 675c17e

Please sign in to comment.