github.com/cosmos/cosmos-sdk@v0.50.10/x/distribution/types/expected_keepers.go (about)

     1  package types
     2  
     3  import (
     4  	context "context"
     5  
     6  	"cosmossdk.io/core/address"
     7  
     8  	sdk "github.com/cosmos/cosmos-sdk/types"
     9  	stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
    10  )
    11  
    12  // AccountKeeper defines the expected account keeper used for simulations (noalias)
    13  type AccountKeeper interface {
    14  	AddressCodec() address.Codec
    15  	GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
    16  	GetModuleAddress(name string) sdk.AccAddress
    17  	GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI
    18  	// TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862
    19  	SetModuleAccount(context.Context, sdk.ModuleAccountI)
    20  }
    21  
    22  // BankKeeper defines the expected interface needed to retrieve account balances.
    23  type BankKeeper interface {
    24  	GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins
    25  
    26  	SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins
    27  
    28  	SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error
    29  	SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
    30  	SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
    31  
    32  	BlockedAddr(addr sdk.AccAddress) bool
    33  }
    34  
    35  // StakingKeeper expected staking keeper (noalias)
    36  type StakingKeeper interface {
    37  	ValidatorAddressCodec() address.Codec
    38  	ConsensusAddressCodec() address.Codec
    39  	// iterate through validators by operator address, execute func for each validator
    40  	IterateValidators(context.Context,
    41  		func(index int64, validator stakingtypes.ValidatorI) (stop bool)) error
    42  
    43  	Validator(context.Context, sdk.ValAddress) (stakingtypes.ValidatorI, error)            // get a particular validator by operator address
    44  	ValidatorByConsAddr(context.Context, sdk.ConsAddress) (stakingtypes.ValidatorI, error) // get a particular validator by consensus address
    45  
    46  	// Delegation allows for getting a particular delegation for a given validator
    47  	// and delegator outside the scope of the staking module.
    48  	Delegation(context.Context, sdk.AccAddress, sdk.ValAddress) (stakingtypes.DelegationI, error)
    49  
    50  	IterateDelegations(ctx context.Context, delegator sdk.AccAddress,
    51  		fn func(index int64, delegation stakingtypes.DelegationI) (stop bool)) error
    52  
    53  	GetAllSDKDelegations(ctx context.Context) ([]stakingtypes.Delegation, error)
    54  	GetAllValidators(ctx context.Context) ([]stakingtypes.Validator, error)
    55  	GetAllDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress) ([]stakingtypes.Delegation, error)
    56  }
    57  
    58  // StakingHooks event hooks for staking validator object (noalias)
    59  type StakingHooks interface {
    60  	AfterValidatorCreated(ctx context.Context, valAddr sdk.ValAddress) error // Must be called when a validator is created
    61  	AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
    62  }