Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cosmwasmpool's create pool cli generic #6388

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#6256](https://github.com/osmosis-labs/osmosis/pull/6256) Refactor CalcPriceToTick to operate on BigDec price to support new price range.
* [#6317](https://github.com/osmosis-labs/osmosis/pull/6317) Remove price return from CL `math.TickToSqrtPrice`

### Client Breaks
* [#6388](https://github.com/osmosis-labs/osmosis/pull/6388) Make cosmwasmpool's create pool cli generic

## v19.0.0

### Features
Expand Down
18 changes: 9 additions & 9 deletions x/cosmwasmpool/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/spf13/pflag"

"github.com/osmosis-labs/osmosis/osmoutils/osmocli"
"github.com/osmosis-labs/osmosis/v19/x/cosmwasmpool/cosmwasm/msg"
"github.com/osmosis-labs/osmosis/v19/x/cosmwasmpool/model"
"github.com/osmosis-labs/osmosis/v19/x/cosmwasmpool/types"
)
Expand All @@ -32,7 +31,7 @@ func NewCreateCWPoolCmd() (*osmocli.TxCliDesc, *model.MsgCreateCosmWasmPool) {
return &osmocli.TxCliDesc{
Use: "create-pool",
Short: "create a cosmwasm pool",
Example: "osmosisd tx cosmwasmpool create-pool 1 uion,uosmo --from lo-test1 --keyring-backend test --chain-id localosmosis --fees 875uosmo -b=block",
Example: "osmosisd tx cosmwasmpool create-pool 1 '{\"pool_assets_denom\":[\"uion\",\"uosmo\"]}' --from lo-test1 --keyring-backend test --chain-id localosmosis --fees 875uosmo -b=block",
NumArgs: 2,
ParseAndBuildMsg: BuildCreatePoolMsg,
}, &model.MsgCreateCosmWasmPool{}
Expand All @@ -44,17 +43,18 @@ func BuildCreatePoolMsg(clientCtx client.Context, args []string, flags *pflag.Fl
return nil, err
}

denoms := strings.Split(args[1], ",")
instantiateMsg := args[1]

// Construct instantiate msg
instantiateMsg := &msg.InstantiateMsg{
PoolAssetDenoms: denoms,
}
msgBz, err := json.Marshal(instantiateMsg)
// Check JSON format for instantiateMsg
var jsonCheck map[string]interface{}
err = json.Unmarshal([]byte(instantiateMsg), &jsonCheck)
if err != nil {
return nil, err
return nil, fmt.Errorf("invalid JSON format for instantiateMsg: %v", err)
}

// Turn instantiateMsg to bytes
msgBz := []byte(instantiateMsg)

return &model.MsgCreateCosmWasmPool{
CodeId: codeId,
InstantiateMsg: msgBz,
Expand Down