Skip to content

Commit

Permalink
remove staking dep
Browse files Browse the repository at this point in the history
  • Loading branch information
facundomedica committed Sep 25, 2024
1 parent 9d96d02 commit 03b6445
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 61 deletions.
3 changes: 1 addition & 2 deletions x/protocolpool/depinject.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ type ModuleInputs struct {

AccountKeeper types.AccountKeeper
BankKeeper types.BankKeeper
StakingKeeper types.StakingKeeper
}

type ModuleOutputs struct {
Expand All @@ -59,7 +58,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
panic(err)
}

k := keeper.NewKeeper(in.Codec, in.Environment, in.AccountKeeper, in.BankKeeper, in.StakingKeeper, authorityAddr)
k := keeper.NewKeeper(in.Codec, in.Environment, in.AccountKeeper, in.BankKeeper, authorityAddr)
m := NewAppModule(in.Codec, k, in.AccountKeeper, in.BankKeeper)

return ModuleOutputs{
Expand Down
8 changes: 3 additions & 5 deletions x/protocolpool/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ import (
type Keeper struct {
appmodule.Environment

authKeeper types.AccountKeeper
bankKeeper types.BankKeeper
stakingKeeper types.StakingKeeper
authKeeper types.AccountKeeper
bankKeeper types.BankKeeper

cdc codec.BinaryCodec

Expand All @@ -43,7 +42,7 @@ const (
errModuleAccountNotSet = "%s module account has not been set"
)

func NewKeeper(cdc codec.BinaryCodec, env appmodule.Environment, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, authority string,
func NewKeeper(cdc codec.BinaryCodec, env appmodule.Environment, ak types.AccountKeeper, bk types.BankKeeper, authority string,
) Keeper {
// ensure pool module account is set
if addr := ak.GetModuleAddress(types.ModuleName); addr == nil {
Expand All @@ -64,7 +63,6 @@ func NewKeeper(cdc codec.BinaryCodec, env appmodule.Environment, ak types.Accoun
Environment: env,
authKeeper: ak,
bankKeeper: bk,
stakingKeeper: sk,
cdc: cdc,
authority: authority,
BudgetProposal: collections.NewMap(sb, types.BudgetKey, "budget", sdk.AccAddressKey, codec.CollValue[types.Budget](cdc)),
Expand Down
17 changes: 5 additions & 12 deletions x/protocolpool/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ var (
type KeeperTestSuite struct {
suite.Suite

ctx sdk.Context
environment appmodule.Environment
poolKeeper poolkeeper.Keeper
authKeeper *pooltestutil.MockAccountKeeper
bankKeeper *pooltestutil.MockBankKeeper
stakingKeeper *pooltestutil.MockStakingKeeper
ctx sdk.Context
environment appmodule.Environment
poolKeeper poolkeeper.Keeper
authKeeper *pooltestutil.MockAccountKeeper
bankKeeper *pooltestutil.MockBankKeeper

msgServer types.MsgServer
queryServer types.QueryServer
Expand All @@ -66,10 +65,6 @@ func (s *KeeperTestSuite) SetupTest() {
bankKeeper := pooltestutil.NewMockBankKeeper(ctrl)
s.bankKeeper = bankKeeper

stakingKeeper := pooltestutil.NewMockStakingKeeper(ctrl)
stakingKeeper.EXPECT().BondDenom(ctx).Return("stake", nil).AnyTimes()
s.stakingKeeper = stakingKeeper

authority, err := accountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress(types.GovModuleName))
s.Require().NoError(err)

Expand All @@ -78,7 +73,6 @@ func (s *KeeperTestSuite) SetupTest() {
environment,
accountKeeper,
bankKeeper,
stakingKeeper,
authority,
)
s.ctx = ctx
Expand All @@ -101,7 +95,6 @@ func (s *KeeperTestSuite) mockWithdrawContinuousFund() {
distrBal := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000)))
s.bankKeeper.EXPECT().GetAllBalances(gomock.Any(), gomock.Any()).Return(distrBal).AnyTimes()
s.bankKeeper.EXPECT().SendCoinsFromModuleToAccount(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
s.stakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake", nil).AnyTimes()
}

func (s *KeeperTestSuite) mockStreamFunds(distributed math.Int) {
Expand Down
38 changes: 0 additions & 38 deletions x/protocolpool/testutil/expected_keepers_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions x/protocolpool/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,3 @@ type BankKeeper interface {
SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error
}

type StakingKeeper interface {
BondDenom(ctx context.Context) (string, error)
}

0 comments on commit 03b6445

Please sign in to comment.