-
Notifications
You must be signed in to change notification settings - Fork 4
/
expected_keepers.go
87 lines (77 loc) · 3.41 KB
/
expected_keepers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package types
import (
"context"
"time"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/authz"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
)
// AccountKeeper defines the expected account keeper.
type AccountKeeper interface {
GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI
GetModuleAddress(name string) sdk.AccAddress
SetModuleAccount(context.Context, sdk.ModuleAccountI)
}
// BankKeeper defines the expected bank keeper.
type BankKeeper interface {
GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins
SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error
SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
}
// StakingKeeper defines the expected staking keeper.
type StakingKeeper interface {
ValidatorByConsAddr(context.Context, sdk.ConsAddress) (stakingtypes.ValidatorI, error)
IterateBondedValidatorsByPower(
ctx context.Context,
fn func(index int64, validator stakingtypes.ValidatorI) (stop bool),
) error
Validator(ctx context.Context, address sdk.ValAddress) (stakingtypes.ValidatorI, error)
}
// DistrKeeper defines the expected distribution keeper.
type DistrKeeper interface {
GetCommunityTax(ctx context.Context) (percent math.LegacyDec, err error)
AllocateTokensToValidator(ctx context.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins) error
FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error
DistributeFromFeePool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error
}
// ChannelKeeper defines the expected IBC channel keeper
type ChannelKeeper interface {
SendPacket(
ctx sdk.Context,
chanCap *capabilitytypes.Capability,
sourcePort string,
sourceChannel string,
timeoutHeight ibcclienttypes.Height,
timeoutTimestamp uint64,
data []byte,
) (sequence uint64, err error)
}
// PortKeeper defines the expected IBC port keeper
type PortKeeper interface {
BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability
}
// AuthzKeeper defines the expected authz keeper. for query and testing only don't use to create/remove grant on deliver tx
type AuthzKeeper interface {
DispatchActions(ctx context.Context, grantee sdk.AccAddress, msgs []sdk.Msg) ([][]byte, error)
GetAuthorization(
ctx context.Context,
grantee sdk.AccAddress,
granter sdk.AccAddress,
msgType string,
) (authz.Authorization, *time.Time)
GetAuthorizations(ctx context.Context, grantee sdk.AccAddress, granter sdk.AccAddress) ([]authz.Authorization, error)
SaveGrant(
ctx context.Context,
grantee, granter sdk.AccAddress,
authorization authz.Authorization,
expiration *time.Time,
) error
DeleteGrant(ctx context.Context, grantee sdk.AccAddress, granter sdk.AccAddress, msgType string) error
GranterGrants(c context.Context, req *authz.QueryGranterGrantsRequest) (*authz.QueryGranterGrantsResponse, error)
}