Skip to content

Commit

Permalink
feat: disable eth module
Browse files Browse the repository at this point in the history
  • Loading branch information
zakir-code committed Oct 31, 2023
1 parent 179c9eb commit 12a2803
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 5 deletions.
7 changes: 4 additions & 3 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import (
"github.com/functionx/fx-core/v6/x/erc20"
erc20keeper "github.com/functionx/fx-core/v6/x/erc20/keeper"
erc20types "github.com/functionx/fx-core/v6/x/erc20/types"
ethkeeper "github.com/functionx/fx-core/v6/x/eth/keeper"
ethtypes "github.com/functionx/fx-core/v6/x/eth/types"
fxevmkeeper "github.com/functionx/fx-core/v6/x/evm/keeper"
fxgovkeeper "github.com/functionx/fx-core/v6/x/gov/keeper"
Expand Down Expand Up @@ -446,7 +447,7 @@ func NewAppKeeper(
AddRoute(bsctypes.ModuleName, crosschainkeeper.NewModuleHandler(appKeepers.BscKeeper)).
AddRoute(polygontypes.ModuleName, crosschainkeeper.NewModuleHandler(appKeepers.PolygonKeeper)).
AddRoute(avalanchetypes.ModuleName, crosschainkeeper.NewModuleHandler(appKeepers.AvalancheKeeper)).
AddRoute(ethtypes.ModuleName, crosschainkeeper.NewModuleHandler(appKeepers.EthKeeper)).
AddRoute(ethtypes.ModuleName, ethkeeper.NewModuleHandler(appKeepers.EthKeeper)).
AddRoute(arbitrumtypes.ModuleName, crosschainkeeper.NewModuleHandler(appKeepers.ArbitrumKeeper)).
AddRoute(optimismtypes.ModuleName, crosschainkeeper.NewModuleHandler(appKeepers.OptimismKeeper)).
AddRoute(layer2types.ModuleName, crosschainkeeper.NewModuleHandler(appKeepers.Layer2Keeper)).
Expand Down Expand Up @@ -493,8 +494,8 @@ func NewAppKeeper(
)

ibcTransferRouter := fxtypes.NewRouter().
AddRoute(gravitytypes.ModuleName, appKeepers.EthKeeper).
AddRoute(ethtypes.ModuleName, appKeepers.EthKeeper).
AddRoute(gravitytypes.ModuleName, appKeepers.Layer2Keeper).
AddRoute(ethtypes.ModuleName, appKeepers.Layer2Keeper).
AddRoute(bsctypes.ModuleName, appKeepers.BscKeeper).
AddRoute(polygontypes.ModuleName, appKeepers.PolygonKeeper).
AddRoute(trontypes.ModuleName, appKeepers.TronKeeper).
Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (appKeepers *AppKeepers) EvmPrecompiled() {

// cross chain precompile
transferRouter := fxtypes.NewRouter().
AddRoute(ethtypes.ModuleName, appKeepers.EthKeeper).
//AddRoute(ethtypes.ModuleName, appKeepers.EthKeeper).
AddRoute(bsctypes.ModuleName, appKeepers.BscKeeper).
AddRoute(polygontypes.ModuleName, appKeepers.PolygonKeeper).
AddRoute(trontypes.ModuleName, appKeepers.TronKeeper).
Expand Down
11 changes: 11 additions & 0 deletions x/eth/keeper/keeper_router.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package keeper

import crosschainkeeper "github.com/functionx/fx-core/v6/x/crosschain/keeper"

func NewModuleHandler(keeper crosschainkeeper.Keeper) *crosschainkeeper.ModuleHandler {
return &crosschainkeeper.ModuleHandler{
QueryServer: keeper,
MsgServer: NewMsgServerImpl(keeper),
ProposalServer: keeper,
}
}
27 changes: 27 additions & 0 deletions x/eth/keeper/msg_server.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package keeper

import (
"context"

"cosmossdk.io/errors"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

crosschainkeeper "github.com/functionx/fx-core/v6/x/crosschain/keeper"
crosschaintypes "github.com/functionx/fx-core/v6/x/crosschain/types"
)

var _ crosschaintypes.MsgServer = MsgServer{}

type MsgServer struct {
crosschainkeeper.MsgServer
}

func NewMsgServerImpl(keeper crosschainkeeper.Keeper) crosschaintypes.MsgServer {
return MsgServer{
MsgServer: crosschainkeeper.MsgServer{Keeper: keeper},
}
}

func (s MsgServer) SendToExternal(c context.Context, msg *crosschaintypes.MsgSendToExternal) (*crosschaintypes.MsgSendToExternalResponse, error) {
return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "not supported")
}
2 changes: 1 addition & 1 deletion x/gravity/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

type msgServer struct {
crosschainkeeper.MsgServer
crosschaintypes.MsgServer
}

func NewMsgServerImpl(keeper crosschainkeeper.Keeper) types.MsgServer {
Expand Down

0 comments on commit 12a2803

Please sign in to comment.