From 279efa9e2a05999d4b6ebdd219be9ca29be70fee Mon Sep 17 00:00:00 2001 From: Alex Peters Date: Wed, 3 Mar 2021 14:29:26 +0100 Subject: [PATCH] Use label from contract msg --- x/wasm/internal/keeper/handler_plugin.go | 9 +++------ x/wasm/internal/keeper/handler_plugin_test.go | 9 ++++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/x/wasm/internal/keeper/handler_plugin.go b/x/wasm/internal/keeper/handler_plugin.go index e2270e8524..b5f237d647 100644 --- a/x/wasm/internal/keeper/handler_plugin.go +++ b/x/wasm/internal/keeper/handler_plugin.go @@ -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" @@ -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, } diff --git a/x/wasm/internal/keeper/handler_plugin_test.go b/x/wasm/internal/keeper/handler_plugin_test.go index 4eefbb9da2..62f3429a28 100644 --- a/x/wasm/internal/keeper/handler_plugin_test.go +++ b/x/wasm/internal/keeper/handler_plugin_test.go @@ -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" @@ -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)), },