Skip to content

Commit

Permalink
Use label from contract msg
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Mar 4, 2021
1 parent 6bdac24 commit 279efa9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
9 changes: 3 additions & 6 deletions x/wasm/internal/keeper/handler_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package keeper

import (
"encoding/json"
"fmt"

"github.com/CosmWasm/wasmd/x/wasm/internal/types"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -194,10 +192,9 @@ func EncodeWasmMsg(sender sdk.AccAddress, msg *wasmvmtypes.WasmMsg) ([]sdk.Msg,
}

sdkMsg := types.MsgInstantiateContract{
Sender: sender.String(),
CodeID: msg.Instantiate.CodeID,
// TODO: add this to CosmWasm
Label: fmt.Sprintf("Auto-created by %s", sender),
Sender: sender.String(),
CodeID: msg.Instantiate.CodeID,
Label: msg.Instantiate.Label,
InitMsg: msg.Instantiate.Msg,
Funds: coins,
}
Expand Down
9 changes: 4 additions & 5 deletions x/wasm/internal/keeper/handler_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package keeper

import (
"encoding/json"
"fmt"
"github.com/CosmWasm/wasmd/x/wasm/internal/keeper/wasmtesting"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
ibctransfertypes "github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types"
Expand Down Expand Up @@ -147,15 +146,15 @@ func TestEncoding(t *testing.T) {
Send: []wasmvmtypes.Coin{
wasmvmtypes.NewCoin(123, "eth"),
},
Label: "myLabel",
},
},
},
output: []sdk.Msg{
&types.MsgInstantiateContract{
Sender: addr1.String(),
CodeID: 7,
// TODO: fix this
Label: fmt.Sprintf("Auto-created by %s", addr1),
Sender: addr1.String(),
CodeID: 7,
Label: "myLabel",
InitMsg: jsonMsg,
Funds: sdk.NewCoins(sdk.NewInt64Coin("eth", 123)),
},
Expand Down

0 comments on commit 279efa9

Please sign in to comment.