Merge pull request #201 from CosmWasm/polish_handler

Polish types in message handler
This commit is contained in:
Ethan Frey 2020-07-20 10:58:24 +02:00 committed by GitHub
commit 45ef2f331e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 19 deletions

View File

@ -16,34 +16,16 @@ func NewHandler(k Keeper) sdk.Handler {
switch msg := msg.(type) { switch msg := msg.(type) {
case MsgStoreCode: case MsgStoreCode:
return handleStoreCode(ctx, k, &msg) return handleStoreCode(ctx, k, &msg)
case *MsgStoreCode:
return handleStoreCode(ctx, k, msg)
case MsgInstantiateContract: case MsgInstantiateContract:
return handleInstantiate(ctx, k, &msg) return handleInstantiate(ctx, k, &msg)
case *MsgInstantiateContract:
return handleInstantiate(ctx, k, msg)
case MsgExecuteContract: case MsgExecuteContract:
return handleExecute(ctx, k, &msg) return handleExecute(ctx, k, &msg)
case *MsgExecuteContract:
return handleExecute(ctx, k, msg)
case *MsgMigrateContract:
return handleMigration(ctx, k, msg)
case MsgMigrateContract: case MsgMigrateContract:
return handleMigration(ctx, k, &msg) return handleMigration(ctx, k, &msg)
case *MsgUpdateAdmin:
return handleUpdateContractAdmin(ctx, k, msg)
case MsgUpdateAdmin: case MsgUpdateAdmin:
return handleUpdateContractAdmin(ctx, k, &msg) return handleUpdateContractAdmin(ctx, k, &msg)
case *MsgClearAdmin:
return handleClearContractAdmin(ctx, k, msg)
case MsgClearAdmin: case MsgClearAdmin:
return handleClearContractAdmin(ctx, k, &msg) return handleClearContractAdmin(ctx, k, &msg)
default: default:
errMsg := fmt.Sprintf("unrecognized wasm message type: %T", msg) errMsg := fmt.Sprintf("unrecognized wasm message type: %T", msg)
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)

View File

@ -325,7 +325,7 @@ func TestHandleExecuteEscrow(t *testing.T) {
Sender: creator, Sender: creator,
WASMByteCode: testContract, WASMByteCode: testContract,
} }
res, err := h(data.ctx, &msg) res, err := h(data.ctx, msg)
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, res.Data, []byte("1")) require.Equal(t, res.Data, []byte("1"))