/
expected_keepers.go
62 lines (51 loc) · 2.78 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
package types
import (
"time"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
pftypes "github.com/kava-labs/kava/x/pricefeed/types"
)
// BankKeeper defines the expected bank keeper for module accounts
type BankKeeper interface {
SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
GetSupply(ctx sdk.Context, denom string) sdk.Coin
GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
}
var _ BankKeeper = (bankkeeper.Keeper)(nil)
// PricefeedKeeper defines the expected interface for the pricefeed
type PricefeedKeeper interface {
GetCurrentPrice(sdk.Context, string) (pftypes.CurrentPrice, error)
GetParams(sdk.Context) pftypes.Params
// These are used for testing TODO replace mockApp with keeper in tests to remove these
SetParams(sdk.Context, pftypes.Params)
SetPrice(sdk.Context, sdk.AccAddress, string, sdk.Dec, time.Time) (pftypes.PostedPrice, error)
SetCurrentPrices(sdk.Context, string) error
}
// AuctionKeeper expected interface for the auction keeper
type AuctionKeeper interface {
StartSurplusAuction(ctx sdk.Context, seller string, lot sdk.Coin, bidDenom string) (uint64, error)
StartDebtAuction(ctx sdk.Context, buyer string, bid sdk.Coin, initialLot sdk.Coin, debt sdk.Coin) (uint64, error)
StartCollateralAuction(ctx sdk.Context, seller string, lot sdk.Coin, maxBid sdk.Coin, lotReturnAddrs []sdk.AccAddress, lotReturnWeights []sdkmath.Int, debt sdk.Coin) (uint64, error)
}
// AccountKeeper expected interface for the account keeper
type AccountKeeper interface {
GetModuleAddress(name string) sdk.AccAddress
GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI
// TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862
SetModuleAccount(sdk.Context, authtypes.ModuleAccountI)
IterateAccounts(ctx sdk.Context, cb func(account authtypes.AccountI) (stop bool))
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
}
// CDPHooks event hooks for other keepers to run code in response to CDP modifications
type CDPHooks interface {
AfterCDPCreated(ctx sdk.Context, cdp CDP)
BeforeCDPModified(ctx sdk.Context, cdp CDP)
}