github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/ibc-go/testing/simapp/adapter/staking/module.go (about)

     1  package staking
     2  
     3  import (
     4  	"encoding/json"
     5  
     6  	sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types"
     7  	types2 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/staking/types"
     8  	"github.com/fibonacci-chain/fbc/libs/ibc-go/testing/simapp/adapter"
     9  	abci "github.com/fibonacci-chain/fbc/libs/tendermint/abci/types"
    10  	"github.com/fibonacci-chain/fbc/x/staking"
    11  	"github.com/fibonacci-chain/fbc/x/staking/types"
    12  )
    13  
    14  type StakingModule struct {
    15  	staking.AppModule
    16  
    17  	keeper       staking.Keeper
    18  	accKeeper    types.AccountKeeper
    19  	supplyKeeper types.SupplyKeeper
    20  }
    21  
    22  func TNewStakingModule(keeper staking.Keeper, accKeeper types.AccountKeeper,
    23  	supplyKeeper types.SupplyKeeper) StakingModule {
    24  
    25  	s := staking.NewAppModule(keeper, accKeeper, supplyKeeper)
    26  
    27  	return StakingModule{
    28  		s,
    29  		keeper,
    30  		accKeeper,
    31  		supplyKeeper,
    32  	}
    33  }
    34  
    35  func (s StakingModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate {
    36  	var genesisState staking.GenesisState
    37  	adapter.ModuleCdc.MustUnmarshalJSON(data, &genesisState)
    38  	genesisState.Params = types.DefaultParams()
    39  	genesisState.Params.UnbondingTime = types2.DefaultUnbondingTime
    40  
    41  	return staking.InitGenesis(ctx, s.keeper, s.accKeeper, s.supplyKeeper, genesisState)
    42  }