Skip to content

Commit

Permalink
Add IterateValidators and TotalBondedTokens to expected staking keepe…
Browse files Browse the repository at this point in the history
…r, define corresponding mocks
  • Loading branch information
iverc committed Dec 9, 2024
1 parent cee7583 commit 6ba7603
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions testutil/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,31 @@ func (mr *MockStakingKeeperRecorder) GetValidator(ctx, addr interface{}) *gomock
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidator", reflect.TypeOf((*MockStakingKeeper)(nil).GetValidator), ctx, addr)
}

func (m *MockStakingKeeper) IterateValidators(ctx context.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool)) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IterateValidators", ctx, fn)
ret0, _ := ret[0].(error)
return ret0
}

func (mr *MockStakingKeeperRecorder) IterateValidators(ctx, fn interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateValidators", reflect.TypeOf((*MockStakingKeeper)(nil).IterateValidators), ctx, fn)
}

func (m *MockStakingKeeper) TotalBondedTokens(ctx context.Context) (math.Int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "TotalBondedTokens", ctx)
ret0, _ := ret[0].(math.Int)
ret1, _ := ret[1].(error)
return ret0, ret1
}

func (mr *MockStakingKeeperRecorder) TotalBondedTokens(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TotalBondedTokens", reflect.TypeOf((*MockStakingKeeper)(nil).TotalBondedTokens), ctx)
}

func (m *MockStakingKeeper) Delegate(ctx context.Context, delAddr sdk.AccAddress, bondAmt math.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool) (math.LegacyDec, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Delegate", ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount)
Expand Down
2 changes: 2 additions & 0 deletions x/tier/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ type StakingKeeper interface {
sharesAmount math.LegacyDec) (completionTime time.Time, err error)
BondDenom(ctx context.Context) (string, error)
GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error)
IterateValidators(context.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool)) error
TotalBondedTokens(context.Context) (math.Int, error)
ValidateUnbondAmount(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt math.Int) (
shares math.LegacyDec, err error)
GetUnbondingDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (
Expand Down

0 comments on commit 6ba7603

Please sign in to comment.