refactor(staking): remove expected distribution keeper (backport #17261) (#17263)

This commit is contained in:
mergify[bot] 2023-08-02 17:52:31 +02:00 committed by GitHub
parent 397b9ce1a9
commit db64728aff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 65 deletions

View File

@ -352,15 +352,22 @@ The transaction fails if the amount cannot be transferred from the sender to the
```go
func (k Keeper) FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error {
if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, amount); err != nil {
return err
}
if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, amount); err != nil {
return err
}
feePool := k.GetFeePool(ctx)
feePool.CommunityPool = feePool.CommunityPool.Add(sdk.NewDecCoinsFromCoins(amount...)...)
k.SetFeePool(ctx, feePool)
feePool, err := k.FeePool.Get(ctx)
if err != nil {
return err
}
return nil
feePool.CommunityPool = feePool.CommunityPool.Add(sdk.NewDecCoinsFromCoins(amount...)...)
if err := k.FeePool.Set(ctx, feePool); err != nil {
return err
}
return nil
}
```

View File

@ -1,7 +1,7 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: x/gov/testutil/expected_keepers.go
// Package mock_testutil is a generated GoMock package.
// Package testutil is a generated GoMock package.
package testutil
import (

View File

@ -15,57 +15,6 @@ import (
gomock "github.com/golang/mock/gomock"
)
// MockDistributionKeeper is a mock of DistributionKeeper interface.
type MockDistributionKeeper struct {
ctrl *gomock.Controller
recorder *MockDistributionKeeperMockRecorder
}
// MockDistributionKeeperMockRecorder is the mock recorder for MockDistributionKeeper.
type MockDistributionKeeperMockRecorder struct {
mock *MockDistributionKeeper
}
// NewMockDistributionKeeper creates a new mock instance.
func NewMockDistributionKeeper(ctrl *gomock.Controller) *MockDistributionKeeper {
mock := &MockDistributionKeeper{ctrl: ctrl}
mock.recorder = &MockDistributionKeeperMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockDistributionKeeper) EXPECT() *MockDistributionKeeperMockRecorder {
return m.recorder
}
// GetFeePoolCommunityCoins mocks base method.
func (m *MockDistributionKeeper) GetFeePoolCommunityCoins(ctx context.Context) types.DecCoins {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetFeePoolCommunityCoins", ctx)
ret0, _ := ret[0].(types.DecCoins)
return ret0
}
// GetFeePoolCommunityCoins indicates an expected call of GetFeePoolCommunityCoins.
func (mr *MockDistributionKeeperMockRecorder) GetFeePoolCommunityCoins(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetFeePoolCommunityCoins", reflect.TypeOf((*MockDistributionKeeper)(nil).GetFeePoolCommunityCoins), ctx)
}
// GetValidatorOutstandingRewardsCoins mocks base method.
func (m *MockDistributionKeeper) GetValidatorOutstandingRewardsCoins(ctx context.Context, val types.ValAddress) types.DecCoins {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetValidatorOutstandingRewardsCoins", ctx, val)
ret0, _ := ret[0].(types.DecCoins)
return ret0
}
// GetValidatorOutstandingRewardsCoins indicates an expected call of GetValidatorOutstandingRewardsCoins.
func (mr *MockDistributionKeeperMockRecorder) GetValidatorOutstandingRewardsCoins(ctx, val interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorOutstandingRewardsCoins", reflect.TypeOf((*MockDistributionKeeper)(nil).GetValidatorOutstandingRewardsCoins), ctx, val)
}
// MockAccountKeeper is a mock of AccountKeeper interface.
type MockAccountKeeper struct {
ctrl *gomock.Controller

View File

@ -9,12 +9,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// DistributionKeeper expected distribution keeper (noalias)
type DistributionKeeper interface {
GetFeePoolCommunityCoins(ctx context.Context) sdk.DecCoins
GetValidatorOutstandingRewardsCoins(ctx context.Context, val sdk.ValAddress) sdk.DecCoins
}
// AccountKeeper defines the expected account keeper (noalias)
type AccountKeeper interface {
AddressCodec() address.Codec