github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/infura/module.go (about)

     1  package infura
     2  
     3  import (
     4  	"encoding/json"
     5  
     6  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/client/context"
     7  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec"
     8  	sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types"
     9  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types/module"
    10  	abci "github.com/fibonacci-chain/fbc/libs/tendermint/abci/types"
    11  	"github.com/gorilla/mux"
    12  	"github.com/spf13/cobra"
    13  )
    14  
    15  // type check to ensure the interface is properly implemented
    16  var (
    17  	_ module.AppModule      = AppModule{}
    18  	_ module.AppModuleBasic = AppModuleBasic{}
    19  )
    20  
    21  // app module Basics object
    22  type AppModuleBasic struct{}
    23  
    24  func (AppModuleBasic) Name() string {
    25  	return ModuleName
    26  }
    27  
    28  func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) {
    29  }
    30  
    31  func (AppModuleBasic) DefaultGenesis() json.RawMessage {
    32  	return nil
    33  }
    34  
    35  // Validation check of the Genesis
    36  func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error {
    37  	return nil
    38  }
    39  
    40  // Register rest routes
    41  func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router) {
    42  }
    43  
    44  // Get the root query command of this module
    45  func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command {
    46  	return nil
    47  }
    48  
    49  // Get the root tx command of this module
    50  func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command {
    51  	return nil
    52  }
    53  
    54  type AppModule struct {
    55  	AppModuleBasic
    56  	keeper Keeper
    57  }
    58  
    59  // NewAppModule creates a new AppModule Object
    60  func NewAppModule(k Keeper) AppModule {
    61  	return AppModule{
    62  		AppModuleBasic: AppModuleBasic{},
    63  		keeper:         k,
    64  	}
    65  }
    66  
    67  func (AppModule) Name() string {
    68  	return ModuleName
    69  }
    70  
    71  func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {}
    72  
    73  func (am AppModule) Route() string {
    74  	return RouterKey
    75  }
    76  
    77  func (am AppModule) NewHandler() sdk.Handler {
    78  	return nil
    79  }
    80  func (am AppModule) QuerierRoute() string {
    81  	return QuerierRoute
    82  }
    83  
    84  func (am AppModule) NewQuerierHandler() sdk.Querier {
    85  	return func(ctx sdk.Context, path []string, req abci.RequestQuery) (res []byte, err sdk.Error) {
    86  		return nil, nil
    87  	}
    88  }
    89  
    90  func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
    91  	BeginBlocker(ctx, am.keeper)
    92  }
    93  
    94  func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
    95  	EndBlocker(ctx, am.keeper)
    96  	return nil
    97  }
    98  
    99  func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate {
   100  	return nil
   101  }
   102  
   103  func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage {
   104  	return nil
   105  }