Use label from contract msg

This commit is contained in:
Alex Peters
2021-03-03 14:29:26 +01:00
parent 6bdac24f6e
commit 279efa9e2a
2 changed files with 7 additions and 11 deletions

View File

@@ -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,
}

View File

@@ -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)),
},