-
Notifications
You must be signed in to change notification settings - Fork 352
/
expected_keepers.go
65 lines (56 loc) · 3.07 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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported"
cdptypes "github.com/kava-labs/kava/x/cdp/types"
hardtypes "github.com/kava-labs/kava/x/hard/types"
)
// SupplyKeeper defines the expected supply keeper for module accounts
type SupplyKeeper interface {
GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI
SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
}
// StakingKeeper defines the expected staking keeper for module accounts
type StakingKeeper interface {
GetDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (delegations []stakingtypes.Delegation)
GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) (delegations []stakingtypes.Delegation)
GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool)
TotalBondedTokens(ctx sdk.Context) sdk.Int
}
// CdpKeeper defines the expected cdp keeper for interacting with cdps
type CdpKeeper interface {
GetInterestFactor(ctx sdk.Context, collateralType string) (sdk.Dec, bool)
GetTotalPrincipal(ctx sdk.Context, collateralType string, principalDenom string) (total sdk.Int)
GetCdpByOwnerAndCollateralType(ctx sdk.Context, owner sdk.AccAddress, collateralType string) (cdptypes.CDP, bool)
GetCollateral(ctx sdk.Context, collateralType string) (cdptypes.CollateralParam, bool)
}
// HardKeeper defines the expected hard keeper for interacting with Hard protocol
type HardKeeper interface {
GetDeposit(ctx sdk.Context, depositor sdk.AccAddress) (hardtypes.Deposit, bool)
GetBorrow(ctx sdk.Context, borrower sdk.AccAddress) (hardtypes.Borrow, bool)
GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool)
GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool)
GetBorrowedCoins(ctx sdk.Context) (coins sdk.Coins, found bool)
GetSuppliedCoins(ctx sdk.Context) (coins sdk.Coins, found bool)
}
// AccountKeeper defines the expected keeper interface for interacting with account
type AccountKeeper interface {
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
SetAccount(ctx sdk.Context, acc authexported.Account)
}
// CDPHooks event hooks for other keepers to run code in response to CDP modifications
type CDPHooks interface {
AfterCDPCreated(ctx sdk.Context, cdp cdptypes.CDP)
BeforeCDPModified(ctx sdk.Context, cdp cdptypes.CDP)
}
// HARDHooks event hooks for other keepers to run code in response to HARD modifications
type HARDHooks interface {
AfterDepositCreated(ctx sdk.Context, deposit hardtypes.Deposit)
BeforeDepositModified(ctx sdk.Context, deposit hardtypes.Deposit)
AfterDepositModified(ctx sdk.Context, deposit hardtypes.Deposit)
AfterBorrowCreated(ctx sdk.Context, borrow hardtypes.Borrow)
BeforeBorrowModified(ctx sdk.Context, borrow hardtypes.Borrow)
AfterBorrowModified(ctx sdk.Context, deposit hardtypes.Deposit)
}