2018-04-23 09:17:21 -07:00
|
|
|
package stake
|
|
|
|
|
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// keeper to view information & slash validators
|
|
|
|
// will be used by governance module
|
|
|
|
type ViewSlashKeeper struct {
|
|
|
|
keeper Keeper
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewViewSlashKeeper creates a keeper restricted to
|
|
|
|
// viewing information & slashing validators
|
|
|
|
func NewViewSlashKeeper(k Keeper) ViewSlashKeeper {
|
|
|
|
return ViewSlashKeeper{k}
|
|
|
|
}
|
|
|
|
|
|
|
|
// load a delegator bond
|
2018-05-09 18:39:14 -07:00
|
|
|
func (v ViewSlashKeeper) GetDelegation(ctx sdk.Context,
|
2018-05-26 14:21:29 -07:00
|
|
|
delegatorAddr sdk.Address, validatorAddr sdk.Address) (bond Delegation, found bool) {
|
2018-05-09 21:01:58 -07:00
|
|
|
return v.keeper.GetDelegation(ctx, delegatorAddr, validatorAddr)
|
2018-04-23 09:17:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// load n delegator bonds
|
2018-05-09 18:39:14 -07:00
|
|
|
func (v ViewSlashKeeper) GetDelegations(ctx sdk.Context,
|
|
|
|
delegator sdk.Address, maxRetrieve int16) (bonds []Delegation) {
|
|
|
|
return v.keeper.GetDelegations(ctx, delegator, maxRetrieve)
|
2018-04-23 09:17:21 -07:00
|
|
|
}
|