Skip to content

Commit

Permalink
fix: lint, test and build
Browse files Browse the repository at this point in the history
emidev98 committed Aug 16, 2023
1 parent 307b519 commit 76f624d
Showing 7 changed files with 253 additions and 241 deletions.
226 changes: 0 additions & 226 deletions x/auth/vesting/handler_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions x/auth/vesting/module.go
Original file line number Diff line number Diff line change
@@ -152,7 +152,7 @@ type VestingInputs struct {

AccountKeeper keeper.AccountKeeper
BankKeeper types.BankKeeper
DistrKeeper types.DistrKeeper
// DistrKeeper types.DistrKeeper
StakingKeeper types.StakingKeeper
}

@@ -163,7 +163,7 @@ type VestingOutputs struct {
}

func ProvideModule(in VestingInputs) VestingOutputs {
m := NewAppModule(in.AccountKeeper, in.BankKeeper, in.DistrKeeper, in.StakingKeeper)
m := NewAppModule(in.AccountKeeper, in.BankKeeper, nil, in.StakingKeeper)

return VestingOutputs{Module: m}
}
8 changes: 0 additions & 8 deletions x/auth/vesting/msg_server.go
Original file line number Diff line number Diff line change
@@ -276,13 +276,5 @@ func (s msgServer) DonateAllVestingTokens(goCtx context.Context, msg *types.MsgD
return nil, err
}

ctx.EventManager().EmitEvent(
sdk.NewEvent(
sdk.EventTypeMessage,
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
sdk.NewAttribute(sdk.AttributeKeyAmount, vestingCoins.String()),
),
)

return &types.MsgDonateAllVestingTokensResponse{}, nil
}
6 changes: 5 additions & 1 deletion x/auth/vesting/msg_server_test.go
Original file line number Diff line number Diff line change
@@ -34,6 +34,8 @@ type VestingTestSuite struct {
ctx sdk.Context
accountKeeper authkeeper.AccountKeeper
bankKeeper *vestingtestutil.MockBankKeeper
distrKeeper *vestingtestutil.MockDistrKeeper
stakingKeeper *vestingtestutil.MockStakingKeeper
msgServer vestingtypes.MsgServer
}

@@ -47,6 +49,8 @@ func (s *VestingTestSuite) SetupTest() {

ctrl := gomock.NewController(s.T())
s.bankKeeper = vestingtestutil.NewMockBankKeeper(ctrl)
s.distrKeeper = vestingtestutil.NewMockDistrKeeper(ctrl)
s.stakingKeeper = vestingtestutil.NewMockStakingKeeper(ctrl)
s.accountKeeper = authkeeper.NewAccountKeeper(
encCfg.Codec,
key,
@@ -58,7 +62,7 @@ func (s *VestingTestSuite) SetupTest() {

vestingtypes.RegisterInterfaces(encCfg.InterfaceRegistry)
authtypes.RegisterInterfaces(encCfg.InterfaceRegistry)
s.msgServer = vesting.NewMsgServerImpl(s.accountKeeper, s.bankKeeper)
s.msgServer = vesting.NewMsgServerImpl(s.accountKeeper, s.bankKeeper, s.distrKeeper, s.stakingKeeper)
}

func (s *VestingTestSuite) TestCreateVestingAccount() {
241 changes: 238 additions & 3 deletions x/auth/vesting/testutil/expected_keepers_mocks.go
7 changes: 7 additions & 0 deletions x/auth/vesting/types/expected_keepers.go
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ package types

import (
"cosmossdk.io/math"
"github.com/cometbft/cometbft/libs/log"
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)
@@ -16,6 +17,12 @@ type BankKeeper interface {

// DistrKeeper defines the expected interface for distribution keeper
type DistrKeeper interface {
GetAuthority() string
Logger(ctx sdk.Context) log.Logger
SetWithdrawAddr(ctx sdk.Context, delegatorAddr sdk.AccAddress, withdrawAddr sdk.AccAddress) error
WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error)
WithdrawValidatorCommission(ctx sdk.Context, valAddr sdk.ValAddress) (sdk.Coins, error)
GetTotalRewards(ctx sdk.Context) (totalRewards sdk.DecCoins)
FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error
}

2 changes: 1 addition & 1 deletion x/auth/vesting/types/msgs.go
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ const TypeMsgCreatePermanentLockedAccount = "msg_create_permanent_locked_account
const TypeMsgCreatePeriodicVestingAccount = "msg_create_periodic_vesting_account"

// TypeMsgDonateAllVestingTokens defines the type value for a MsgDonateAllVestingTokens.
const TypeMsgDonateAllVestingTokens = "msg_donate_all_vesting_tokens"
const TypeMsgDonateAllVestingTokens = "msg_donate_all_vesting_tokens" //nolint: gosec

var _ sdk.Msg = &MsgCreateVestingAccount{}

0 comments on commit 76f624d

Please sign in to comment.