-
Notifications
You must be signed in to change notification settings - Fork 41
/
expected_keepers.go
77 lines (67 loc) · 2.93 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
package types
import (
"context"
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/authz"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
)
// AccountKeeper defines the expected account keeper.
type AccountKeeper interface {
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI
}
// BankKeeper defines the expected bank keeper.
type BankKeeper interface {
GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
}
// StakingKeeper defines the expected staking keeper.
type StakingKeeper interface {
ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingtypes.ValidatorI
IterateBondedValidatorsByPower(
ctx sdk.Context,
fn func(index int64, validator stakingtypes.ValidatorI) (stop bool),
)
Validator(ctx sdk.Context, address sdk.ValAddress) stakingtypes.ValidatorI
}
// DistrKeeper defines the expected distribution keeper.
type DistrKeeper interface {
GetCommunityTax(ctx sdk.Context) (percent sdk.Dec)
GetFeePool(ctx sdk.Context) (feePool distrtypes.FeePool)
SetFeePool(ctx sdk.Context, feePool distrtypes.FeePool)
AllocateTokensToValidator(ctx sdk.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins)
}
// ChannelKeeper defines the expected IBC channel keeper
type ChannelKeeper interface {
GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) 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 {
GetCleanAuthorization(
ctx sdk.Context,
grantee sdk.AccAddress,
granter sdk.AccAddress,
msgType string,
) (cap authz.Authorization, expiration time.Time)
SaveGrant(
ctx sdk.Context,
grantee, granter sdk.AccAddress,
authorization authz.Authorization,
expiration time.Time,
) error
DeleteGrant(ctx sdk.Context, grantee sdk.AccAddress, granter sdk.AccAddress, msgType string) error
GranterGrants(c context.Context, req *authz.QueryGranterGrantsRequest) (*authz.QueryGranterGrantsResponse, error)
}