2019-08-08 12:51:18 -07:00
|
|
|
package types
|
2019-02-13 15:01:50 -08:00
|
|
|
|
2019-06-04 15:06:58 -07:00
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2019-10-23 02:14:45 -07:00
|
|
|
authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
|
2019-06-28 13:11:27 -07:00
|
|
|
stakingexported "github.com/cosmos/cosmos-sdk/x/staking/exported"
|
|
|
|
supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported"
|
2019-06-04 15:06:58 -07:00
|
|
|
)
|
2019-02-13 15:01:50 -08:00
|
|
|
|
2019-08-08 12:51:18 -07:00
|
|
|
// ParamSubspace defines the expected Subspace interface for parameters (noalias)
|
|
|
|
type ParamSubspace interface {
|
|
|
|
Get(ctx sdk.Context, key []byte, ptr interface{})
|
|
|
|
Set(ctx sdk.Context, key []byte, param interface{})
|
|
|
|
}
|
|
|
|
|
|
|
|
// SupplyKeeper defines the expected supply keeper for module accounts (noalias)
|
2019-06-28 13:11:27 -07:00
|
|
|
type SupplyKeeper interface {
|
|
|
|
GetModuleAddress(name string) sdk.AccAddress
|
|
|
|
GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI
|
2019-02-13 15:01:50 -08:00
|
|
|
|
2019-06-28 13:11:27 -07:00
|
|
|
// TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862
|
|
|
|
SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI)
|
|
|
|
|
2019-12-27 09:57:54 -08:00
|
|
|
SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
|
|
|
|
SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
|
|
|
|
BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error
|
2019-02-13 15:01:50 -08:00
|
|
|
}
|
2019-06-04 15:06:58 -07:00
|
|
|
|
2019-08-08 12:51:18 -07:00
|
|
|
// StakingKeeper expected staking keeper (Validator and Delegator sets) (noalias)
|
2019-06-04 15:06:58 -07:00
|
|
|
type StakingKeeper interface {
|
|
|
|
// iterate through bonded validators by operator address, execute func for each validator
|
2019-12-27 09:57:54 -08:00
|
|
|
IterateBondedValidatorsByPower(
|
|
|
|
sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool),
|
|
|
|
)
|
2019-06-04 15:06:58 -07:00
|
|
|
|
|
|
|
TotalBondedTokens(sdk.Context) sdk.Int // total bonded tokens within the validator set
|
2019-12-27 09:57:54 -08:00
|
|
|
IterateDelegations(
|
|
|
|
ctx sdk.Context, delegator sdk.AccAddress,
|
|
|
|
fn func(index int64, delegation stakingexported.DelegationI) (stop bool),
|
|
|
|
)
|
2019-06-04 15:06:58 -07:00
|
|
|
}
|
2019-10-23 02:14:45 -07:00
|
|
|
|
|
|
|
// AccountKeeper defines the expected account keeper (noalias)
|
|
|
|
type AccountKeeper interface {
|
|
|
|
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
|
|
|
|
}
|
2020-01-30 13:31:16 -08:00
|
|
|
|
|
|
|
// BankKeeper defines the expected interface needed to retrieve account balances.
|
|
|
|
type BankKeeper interface {
|
|
|
|
GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
|
|
|
|
GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
|
|
|
|
SetBalances(ctx sdk.Context, addr sdk.AccAddress, balances sdk.Coins) error
|
|
|
|
LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
|
|
|
|
SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
|
|
|
|
}
|