Skip to content

Commit

Permalink
fix: Wrap relayer address in GMPHandler object
Browse files Browse the repository at this point in the history
  • Loading branch information
rbajollari committed Dec 29, 2023
1 parent 87b359a commit 671e789
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ func New(
ibcRouter := ibcporttypes.NewRouter()
ibcStack = gmpmiddleware.NewIBCMiddleware(
ibcStack,
gmpmiddleware.NewGmpHandler(app.GmpKeeper),
gmpmiddleware.NewGmpHandler(app.GmpKeeper, authtypes.NewModuleAddress(gmptypes.ModuleName).String()),
)
ibcRouter.AddRoute(ibctransfertypes.ModuleName, ibcStack)
app.IBCKeeper.SetRouter(ibcRouter)
Expand Down
16 changes: 8 additions & 8 deletions app/gmpmiddleware/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import (
"context"

sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/ojo-network/ojo/x/gmp/types"
oracletypes "github.com/ojo-network/ojo/x/oracle/types"
)

type GmpKeeper interface {
Expand All @@ -18,14 +16,16 @@ type GmpKeeper interface {
}

type GmpHandler struct {
gmp GmpKeeper
gmp GmpKeeper
relayer string
}

var relayer = authtypes.NewModuleAddress(oracletypes.ModuleName).String()
// var relayer = authtypes.NewModuleAddress(oracletypes.ModuleName).String()

func NewGmpHandler(k GmpKeeper) *GmpHandler {
func NewGmpHandler(k GmpKeeper, relayer string) *GmpHandler {
return &GmpHandler{
gmp: k,
gmp: k,
relayer: relayer,
}
}

Expand Down Expand Up @@ -58,7 +58,7 @@ func (h GmpHandler) HandleGeneralMessage(
}
ctx.Logger().Info("HandleGeneralMessage GMP Decoder", "msg", msg)
tx := &types.MsgRelayPrice{
Relayer: relayer,
Relayer: h.relayer,
DestinationChain: srcChain,
ClientContractAddress: msg.ContractAddress.Hex(),
OjoContractAddress: srcAddress,
Expand Down Expand Up @@ -106,7 +106,7 @@ func (h GmpHandler) HandleGeneralMessageWithToken(
}
ctx.Logger().Info("HandleGeneralMessageWithToken GMP Decoder", "msg", msg)
tx := &types.MsgRelayPrice{
Relayer: relayer,
Relayer: h.relayer,
DestinationChain: srcChain,
ClientContractAddress: msg.ContractAddress.Hex(),
OjoContractAddress: srcAddress,
Expand Down

0 comments on commit 671e789

Please sign in to comment.