github.com/Finschia/finschia-sdk@v0.48.1/x/slashing/types/expected_keepers.go (about) 1 // noalias 2 // DONTCOVER 3 package types 4 5 import ( 6 sdk "github.com/Finschia/finschia-sdk/types" 7 auth "github.com/Finschia/finschia-sdk/x/auth/types" 8 paramtypes "github.com/Finschia/finschia-sdk/x/params/types" 9 stakingtypes "github.com/Finschia/finschia-sdk/x/staking/types" 10 ) 11 12 // AccountKeeper expected account keeper 13 type AccountKeeper interface { 14 GetAccount(ctx sdk.Context, addr sdk.AccAddress) auth.AccountI 15 IterateAccounts(ctx sdk.Context, process func(auth.AccountI) (stop bool)) 16 } 17 18 // BankKeeper defines the expected interface needed to retrieve account balances. 19 type BankKeeper interface { 20 GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins 21 GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin 22 LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins 23 SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins 24 } 25 26 // ParamSubspace defines the expected Subspace interfacace 27 type ParamSubspace interface { 28 HasKeyTable() bool 29 WithKeyTable(table paramtypes.KeyTable) paramtypes.Subspace 30 Get(ctx sdk.Context, key []byte, ptr interface{}) 31 GetParamSet(ctx sdk.Context, ps paramtypes.ParamSet) 32 SetParamSet(ctx sdk.Context, ps paramtypes.ParamSet) 33 } 34 35 // StakingKeeper expected staking keeper 36 type StakingKeeper interface { 37 // iterate through validators by operator address, execute func for each validator 38 IterateValidators(sdk.Context, 39 func(index int64, validator stakingtypes.ValidatorI) (stop bool)) 40 41 Validator(sdk.Context, sdk.ValAddress) stakingtypes.ValidatorI // get a particular validator by operator address 42 ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingtypes.ValidatorI // get a particular validator by consensus address 43 44 // slash the validator and delegators of the validator, specifying offence height, offence power, and slash fraction 45 Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec) 46 Jail(sdk.Context, sdk.ConsAddress) // jail a validator 47 Unjail(sdk.Context, sdk.ConsAddress) // unjail a validator 48 49 // Delegation allows for getting a particular delegation for a given validator 50 // and delegator outside the scope of the staking module. 51 Delegation(sdk.Context, sdk.AccAddress, sdk.ValAddress) stakingtypes.DelegationI 52 53 // MaxValidators returns the maximum amount of bonded validators 54 MaxValidators(sdk.Context) uint32 55 } 56 57 // StakingHooks event hooks for staking validator object (noalias) 58 type StakingHooks interface { 59 AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) // Must be called when a validator is created 60 AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator is deleted 61 62 AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator is bonded 63 }