-
Notifications
You must be signed in to change notification settings - Fork 199
/
expected_keepers.go
121 lines (108 loc) · 7.1 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package types
import (
"cosmossdk.io/math"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
v1 "github.com/lavanet/lava/x/downtime/v1"
epochstoragetypes "github.com/lavanet/lava/x/epochstorage/types"
fixationstoretypes "github.com/lavanet/lava/x/fixationstore/types"
planstypes "github.com/lavanet/lava/x/plans/types"
projectstypes "github.com/lavanet/lava/x/projects/types"
spectypes "github.com/lavanet/lava/x/spec/types"
subscriptiontypes "github.com/lavanet/lava/x/subscription/types"
timerstoretypes "github.com/lavanet/lava/x/timerstore/types"
)
type SpecKeeper interface {
// Methods imported from spec should be defined here
IsSpecFoundAndActive(ctx sdk.Context, chainID string) (foundAndActive, found bool, providersType spectypes.Spec_ProvidersTypes)
GetExpandedSpec(ctx sdk.Context, index string) (val spectypes.Spec, err error)
GetSpec(ctx sdk.Context, index string) (val spectypes.Spec, found bool) // this spec is unexpanded don;t use for collections work
GetExpectedServicesForExpandedSpec(expandedSpec spectypes.Spec, mandatory bool) map[epochstoragetypes.EndpointService]struct{}
GetAllChainIDs(ctx sdk.Context) (chainIDs []string)
GetMinStake(ctx sdk.Context, chainID string) sdk.Coin
}
type EpochstorageKeeper interface {
// Methods imported from epochStorage should be defined here
// Methods imported from bank should be defined here
GetParamForBlock(ctx sdk.Context, fixationKey string, block uint64, param any) error
GetEpochStart(ctx sdk.Context) uint64
GetEarliestEpochStart(ctx sdk.Context) uint64
UnstakeHoldBlocks(ctx sdk.Context, block uint64) (res uint64)
UnstakeHoldBlocksStatic(ctx sdk.Context, block uint64) (res uint64)
IsEpochStart(ctx sdk.Context) (res bool)
BlocksToSave(ctx sdk.Context, block uint64) (res uint64, erro error)
BlocksToSaveRaw(ctx sdk.Context) (res uint64)
GetEpochStartForBlock(ctx sdk.Context, block uint64) (epochStart, blockInEpoch uint64, err error)
GetPreviousEpochStartForBlock(ctx sdk.Context, block uint64) (previousEpochStart uint64, erro error)
PopUnstakeEntries(ctx sdk.Context, block uint64) (value []epochstoragetypes.StakeEntry)
AppendUnstakeEntry(ctx sdk.Context, stakeEntry epochstoragetypes.StakeEntry, unstakeHoldBlocks uint64) error
ModifyUnstakeEntry(ctx sdk.Context, stakeEntry epochstoragetypes.StakeEntry, removeIndex uint64)
GetStakeStorageUnstake(ctx sdk.Context) (epochstoragetypes.StakeStorage, bool)
ModifyStakeEntryCurrent(ctx sdk.Context, chainID string, stakeEntry epochstoragetypes.StakeEntry, removeIndex uint64)
AppendStakeEntryCurrent(ctx sdk.Context, chainID string, stakeEntry epochstoragetypes.StakeEntry)
RemoveStakeEntryCurrent(ctx sdk.Context, chainID string, idx uint64) error
GetStakeEntryByAddressCurrent(ctx sdk.Context, chainID string, address sdk.AccAddress) (value epochstoragetypes.StakeEntry, found bool, index uint64)
UnstakeEntryByAddress(ctx sdk.Context, address sdk.AccAddress) (value epochstoragetypes.StakeEntry, found bool, index uint64)
GetStakeStorageCurrent(ctx sdk.Context, chainID string) (epochstoragetypes.StakeStorage, bool)
GetEpochStakeEntries(ctx sdk.Context, block uint64, chainID string) (entries []epochstoragetypes.StakeEntry, found bool, epochHash []byte)
GetStakeEntryByAddressFromStorage(ctx sdk.Context, stakeStorage epochstoragetypes.StakeStorage, address sdk.AccAddress) (value epochstoragetypes.StakeEntry, found bool, index uint64)
GetNextEpoch(ctx sdk.Context, block uint64) (nextEpoch uint64, erro error)
AddFixationRegistry(fixationKey string, getParamFunction func(sdk.Context) any)
GetDeletedEpochs(ctx sdk.Context) []uint64
EpochBlocks(ctx sdk.Context, block uint64) (res uint64, err error)
}
type AccountKeeper interface {
GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI
GetModuleAddress(moduleName string) sdk.AccAddress
// Methods imported from account should be defined here
}
// BankKeeper defines the expected interface needed to retrieve account balances.
type BankKeeper interface {
SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
MintCoins(ctx sdk.Context, moduleName string, amounts sdk.Coins) error
// Methods imported from bank should be defined here
}
type ProjectsKeeper interface {
ChargeComputeUnitsToProject(ctx sdk.Context, project projectstypes.Project, block, cu uint64) (err error)
GetProjectForDeveloper(ctx sdk.Context, developerKey string, blockHeight uint64) (proj projectstypes.Project, errRet error)
GetProjectForBlock(ctx sdk.Context, projectID string, block uint64) (projectstypes.Project, error)
}
type SubscriptionKeeper interface {
GetPlanFromSubscription(ctx sdk.Context, consumer string, block uint64) (planstypes.Plan, error)
ChargeComputeUnitsToSubscription(ctx sdk.Context, subscriptionOwner string, block, cuAmount uint64) (subscriptiontypes.Subscription, error)
GetSubscription(ctx sdk.Context, consumer string) (val subscriptiontypes.Subscription, found bool)
GetAllSubTrackedCuIndices(ctx sdk.Context, sub string) []string
GetTrackedCu(ctx sdk.Context, sub string, provider string, chainID string, block uint64) (cu uint64, found bool, key string)
CalcTotalMonthlyReward(ctx sdk.Context, totalAmount math.Int, trackedCu uint64, totalCuUsedBySub uint64) math.Int
AddTrackedCu(ctx sdk.Context, sub string, provider string, chainID string, cu uint64, block uint64) error
GetAllSubscriptionsIndices(ctx sdk.Context) []string
}
type PlanKeeper interface {
GetAllPlanIndices(ctx sdk.Context) (val []string)
FindPlan(ctx sdk.Context, index string, block uint64) (val planstypes.Plan, found bool)
}
type DowntimeKeeper interface {
GetDowntimeFactor(ctx sdk.Context, epochStartBlock uint64) uint64
GetParams(ctx sdk.Context) (params v1.Params)
}
type DualstakingKeeper interface {
RewardProvidersAndDelegators(ctx sdk.Context, providerAddr sdk.AccAddress, chainID string, totalReward math.Int, senderModule string, calcOnlyProvider bool, calcOnlyDelegators bool, calcOnlyContributer bool) (providerReward math.Int, err error)
DelegateFull(ctx sdk.Context, delegator string, validator string, provider string, chainID string, amount sdk.Coin) error
UnbondFull(ctx sdk.Context, delegator string, validator string, provider string, chainID string, amount sdk.Coin, unstake bool) error
}
type FixationStoreKeeper interface {
NewFixationStore(storeKey storetypes.StoreKey, prefix string) *fixationstoretypes.FixationStore
}
type TimerStoreKeeper interface {
NewTimerStoreBeginBlock(storeKey storetypes.StoreKey, prefix string) *timerstoretypes.TimerStore
}
type StakingKeeper interface {
GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) []stakingtypes.Delegation
GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool)
BondDenom(ctx sdk.Context) string
}