Skip to content

Commit

Permalink
fix: fixed doing wrap twice
Browse files Browse the repository at this point in the history
  • Loading branch information
da1suk8 committed Apr 21, 2023
1 parent 7aac26f commit 714f7d4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions x/wasmplus/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"strings"

"github.com/gogo/protobuf/proto"

sdk "github.com/line/lbm-sdk/types"

"github.com/line/wasmd/x/wasm"
Expand All @@ -18,18 +17,21 @@ func NewHandler(k wasmtypes.ContractOpsKeeper) sdk.Handler {
wasmHandler := wasm.NewHandler(k)

return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
var (
res proto.Message
err error
)
res, err = wasmHandler(ctx, msg)
res, err := wasmHandler(ctx, msg)
if err != nil && strings.Contains(err.Error(), "MsgStoreCodeAndInstantiateContract") {
// handle wasmplus service
msg2, ok := msg.(*types.MsgStoreCodeAndInstantiateContract)
if ok {
var (
res proto.Message
err error
)
res, err = msgServer.StoreCodeAndInstantiateContract(sdk.WrapSDKContext(ctx), msg2)
return sdk.WrapServiceResult(ctx, res, err)
} else {
return nil, err
}
}
return sdk.WrapServiceResult(ctx, res, err)
return res, err
}
}

0 comments on commit 714f7d4

Please sign in to comment.