diff --git a/x/stablecoin/handler.go b/x/stablecoin/handler.go deleted file mode 100644 index 08c2303af..000000000 --- a/x/stablecoin/handler.go +++ /dev/null @@ -1,49 +0,0 @@ -package stablecoin - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/types/errors" - - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/NibiruChain/nibiru/x/stablecoin/keeper" - "github.com/NibiruChain/nibiru/x/stablecoin/types" -) - -/* -NewHandler returns an sdk.Handler for "x/stablecoin" messages. -A handler defines the core state transition functions of an application. -First, the handler performs stateful checks to make sure each 'msg' is valid. -At this stage, the 'msg.ValidateBasic()' method has already been called, meaning -stateless checks on the message (like making sure parameters are correctly -formatted) have already been performed. -*/ -func NewHandler(k keeper.Keeper) sdk.Handler { - msgServer := keeper.NewMsgServerImpl(k) - - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - goCtx := sdk.WrapSDKContext(ctx) - - switch msg := msg.(type) { - case *types.MsgMintStable: - res, err := msgServer.MintStable(goCtx, msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgBurnStable: - res, err := msgServer.BurnStable(goCtx, msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgRecollateralize: - res, err := msgServer.Recollateralize(goCtx, msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgBuyback: - res, err := msgServer.Buyback(goCtx, msg) - return sdk.WrapServiceResult(ctx, res, err) - default: - errMsg := fmt.Sprintf( - "unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(errors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/x/stablecoin/module.go b/x/stablecoin/module.go index b1e3e0d21..394e5269b 100644 --- a/x/stablecoin/module.go +++ b/x/stablecoin/module.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -48,12 +47,8 @@ func (AppModuleBasic) RegisterInterfaces(interfaceRegistry codectypes.InterfaceR types.RegisterInterfaces(interfaceRegistry) } -func (AppModuleBasic) RegisterCodec(aminoCodec *codec.LegacyAmino) { - types.RegisterCodec(aminoCodec) -} - func (AppModuleBasic) RegisterLegacyAminoCodec(aminoCodec *codec.LegacyAmino) { - types.RegisterCodec(aminoCodec) + types.RegisterLegacyAminoCodec(aminoCodec) } // DefaultGenesis returns default genesis state as raw bytes for the erc20 @@ -73,10 +68,6 @@ func (AppModuleBasic) ValidateGenesis( return genState.Validate() } -// RegisterRESTRoutes registers the capability module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { -} - // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. func (AppModuleBasic) RegisterGRPCGatewayRoutes( clientCtx client.Context, mux *runtime.ServeMux, @@ -131,9 +122,6 @@ func (am AppModule) Name() string { return am.AppModuleBasic.Name() } -// QuerierRoute returns the capability module's query routing key. -func (AppModule) QuerierRoute() string { return types.QuerierRoute } - // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { diff --git a/x/stablecoin/types/codec.go b/x/stablecoin/types/codec.go index 5057f13d0..6b73f9f9f 100644 --- a/x/stablecoin/types/codec.go +++ b/x/stablecoin/types/codec.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterCodec(cdc *codec.LegacyAmino) { +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgMintStable{}, "stablecoin/MintStable", nil) cdc.RegisterConcrete(&MsgBurnStable{}, "stablecoin/BurnStable", nil) } @@ -22,6 +22,5 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { } var ( - Amino = codec.NewLegacyAmino() ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) )