-
Notifications
You must be signed in to change notification settings - Fork 2
/
expected_keeper.go
84 lines (75 loc) · 3.81 KB
/
expected_keeper.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
package keeper
import (
"time"
sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types"
"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/supply/exported"
"github.com/fibonacci-chain/fbc/x/dex/types"
ordertypes "github.com/fibonacci-chain/fbc/x/order/types"
"github.com/fibonacci-chain/fbc/x/params"
)
// SupplyKeeper defines the expected supply Keeper
type SupplyKeeper interface {
SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress,
recipientModule string, amt sdk.Coins) sdk.Error
SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string,
recipientAddr sdk.AccAddress, amt sdk.Coins) sdk.Error
GetModuleAccount(ctx sdk.Context, moduleName string) exported.ModuleAccountI
GetModuleAddress(moduleName string) sdk.AccAddress
MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) sdk.Error
}
// TokenKeeper defines the expected token Keeper
type TokenKeeper interface {
TokenExist(ctx sdk.Context, symbol string) bool
}
// IKeeper defines the expected dex Keeper
type IKeeper interface {
GetTokenPair(ctx sdk.Context, product string) *types.TokenPair
GetTokenPairs(ctx sdk.Context) []*types.TokenPair
GetUserTokenPairs(ctx sdk.Context, owner sdk.AccAddress) []*types.TokenPair
GetTokenPairsOrdered(ctx sdk.Context) types.TokenPairs
SaveTokenPair(ctx sdk.Context, tokenPair *types.TokenPair) error
DeleteTokenPairByName(ctx sdk.Context, owner sdk.AccAddress, tokenPairName string)
Deposit(ctx sdk.Context, product string, from sdk.AccAddress, amount sdk.SysCoin) sdk.Error
Withdraw(ctx sdk.Context, product string, to sdk.AccAddress, amount sdk.SysCoin) sdk.Error
GetSupplyKeeper() SupplyKeeper
GetTokenKeeper() TokenKeeper
GetBankKeeper() BankKeeper
GetParamSubspace() params.Subspace
GetParams(ctx sdk.Context) (params types.Params)
SetParams(ctx sdk.Context, params types.Params)
GetFeeCollector() string
LockTokenPair(ctx sdk.Context, product string, lock *ordertypes.ProductLock)
LoadProductLocks(ctx sdk.Context) *ordertypes.ProductLockMap
SetWithdrawInfo(ctx sdk.Context, withdrawInfo types.WithdrawInfo)
SetWithdrawCompleteTimeAddress(ctx sdk.Context, completeTime time.Time, addr sdk.AccAddress)
IterateWithdrawAddress(ctx sdk.Context, currentTime time.Time, fn func(index int64, key []byte) (stop bool))
CompleteWithdraw(ctx sdk.Context, addr sdk.AccAddress) error
IterateWithdrawInfo(ctx sdk.Context, fn func(index int64, withdrawInfo types.WithdrawInfo) (stop bool))
DeleteWithdrawCompleteTimeAddress(ctx sdk.Context, timestamp time.Time, delAddr sdk.AccAddress)
SetOperator(ctx sdk.Context, operator types.DEXOperator)
GetOperator(ctx sdk.Context, addr sdk.AccAddress) (operator types.DEXOperator, isExist bool)
IterateOperators(ctx sdk.Context, cb func(operator types.DEXOperator) (stop bool))
GetMaxTokenPairID(ctx sdk.Context) (tokenPairMaxID uint64)
SetMaxTokenPairID(ctx sdk.Context, tokenPairMaxID uint64)
GetConfirmOwnership(ctx sdk.Context, product string) (confirmOwnership *types.ConfirmOwnership, exist bool)
SetConfirmOwnership(ctx sdk.Context, confirmOwnership *types.ConfirmOwnership)
DeleteConfirmOwnership(ctx sdk.Context, product string)
UpdateUserTokenPair(ctx sdk.Context, product string, owner, to sdk.AccAddress)
UpdateTokenPair(ctx sdk.Context, product string, tokenPair *types.TokenPair)
}
// StakingKeeper defines the expected staking Keeper (noalias)
type StakingKeeper interface {
IsValidator(ctx sdk.Context, addr sdk.AccAddress) bool
}
// BankKeeper defines the expected bank Keeper
type BankKeeper interface {
GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
}
// GovKeeper defines the expected gov Keeper
type GovKeeper interface {
RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)
}
type StreamKeeper interface {
OnAddNewTokenPair(ctx sdk.Context, tokenPair *types.TokenPair)
OnTokenPairUpdated(ctx sdk.Context)
}