-
Notifications
You must be signed in to change notification settings - Fork 113
/
expected_keepers.go
70 lines (60 loc) · 2.58 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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/tendermint/tendermint/libs/log"
"github.com/axelarnetwork/axelar-core/utils"
"github.com/axelarnetwork/axelar-core/x/multisig/exported"
nexus "github.com/axelarnetwork/axelar-core/x/nexus/exported"
reward "github.com/axelarnetwork/axelar-core/x/reward/exported"
snapshot "github.com/axelarnetwork/axelar-core/x/snapshot/exported"
)
//go:generate moq -pkg mock -out ./mock/expected_keepers.go . Keeper Snapshotter Staker Slasher Rewarder Nexus KeygenParticipator
// Keeper provides keeper functionality of this module
type Keeper interface {
Logger(ctx sdk.Context) log.Logger
GetParams(ctx sdk.Context) (params Params)
GetCurrentKeyID(ctx sdk.Context, chainName nexus.ChainName) (exported.KeyID, bool)
GetNextKeyID(ctx sdk.Context, chainName nexus.ChainName) (exported.KeyID, bool)
GetKeygenSession(ctx sdk.Context, id exported.KeyID) (KeygenSession, bool)
GetKeygenSessionsByExpiry(ctx sdk.Context, expiry int64) []KeygenSession
GetKey(ctx sdk.Context, keyID exported.KeyID) (exported.Key, bool)
SetKey(ctx sdk.Context, key Key)
DeleteKeygenSession(ctx sdk.Context, id exported.KeyID)
GetSigningSessionsByExpiry(ctx sdk.Context, expiry int64) []SigningSession
DeleteSigningSession(ctx sdk.Context, id uint64)
GetSigRouter() SigRouter
}
// KeygenParticipator can check if a participant opted out of future keygens
type KeygenParticipator interface {
HasOptedOut(ctx sdk.Context, participant sdk.AccAddress) bool
}
// Snapshotter provides snapshot keeper functionality
type Snapshotter interface {
CreateSnapshot(
ctx sdk.Context,
candidates []sdk.ValAddress,
filterFunc func(snapshot.ValidatorI) bool,
weightFunc func(consensusPower sdk.Uint) sdk.Uint,
threshold utils.Threshold,
) (snapshot.Snapshot, error)
GetProxy(ctx sdk.Context, operator sdk.ValAddress) (addr sdk.AccAddress, active bool)
GetOperator(ctx sdk.Context, proxy sdk.AccAddress) sdk.ValAddress
}
// Staker provides staking keeper functionality
type Staker interface {
GetBondedValidatorsByPower(ctx sdk.Context) []stakingTypes.Validator
}
// Slasher provides slashing keeper functionality
type Slasher interface {
IsTombstoned(ctx sdk.Context, consAddr sdk.ConsAddress) bool
}
// Rewarder provides reward keeper functionality
type Rewarder interface {
GetPool(ctx sdk.Context, name string) reward.RewardPool
}
// Nexus provides nexus keeper functionality
type Nexus interface {
GetChain(ctx sdk.Context, chain nexus.ChainName) (nexus.Chain, bool)
GetChains(ctx sdk.Context) []nexus.Chain
}