-
Notifications
You must be signed in to change notification settings - Fork 99
/
mem_clob_keeper.go
102 lines (99 loc) · 2.25 KB
/
mem_clob_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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package types
import (
"math/big"
"time"
"github.com/cometbft/cometbft/libs/log"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/dydxprotocol/v4-chain/protocol/indexer/indexer_manager"
satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types"
)
type MemClobKeeper interface {
GetOrderFillAmount(
ctx sdk.Context,
orderId OrderId,
) (
exists bool,
fillAmount satypes.BaseQuantums,
prunableBlockHeight uint32,
)
ProcessSingleMatch(
ctx sdk.Context,
matchWithOrders *MatchWithOrders,
) (
success bool,
takerUpdateResult satypes.UpdateResult,
makerUpdateResult satypes.UpdateResult,
offchainUpdates *OffchainUpdates,
err error,
)
AddOrderToOrderbookCollatCheck(
ctx sdk.Context,
clobPairId ClobPairId,
subaccountOpenOrders map[satypes.SubaccountId][]PendingOpenOrder,
) (
success bool,
successPerUpdate map[satypes.SubaccountId]satypes.UpdateResult,
)
CanDeleverageSubaccount(
ctx sdk.Context,
subaccountId satypes.SubaccountId,
) (bool, error)
GetStatePosition(
ctx sdk.Context,
subaccountId satypes.SubaccountId,
clobPairId ClobPairId,
) (
positionSizeQuantums *big.Int,
)
ReplayPlaceOrder(
ctx sdk.Context,
msg *MsgPlaceOrder,
) (
orderSizeOptimisticallyFilledFromMatchingQuantums satypes.BaseQuantums,
orderStatus OrderStatus,
offchainUpdates *OffchainUpdates,
err error,
)
CancelShortTermOrder(
ctx sdk.Context,
msgCancelOrder *MsgCancelOrder,
) error
GetLongTermOrderPlacement(
ctx sdk.Context,
orderId OrderId,
) (val LongTermOrderPlacement, found bool)
SetLongTermOrderPlacement(
ctx sdk.Context,
order Order,
blockHeight uint32,
)
MustAddOrderToStatefulOrdersTimeSlice(
ctx sdk.Context,
goodTilBlockTime time.Time,
orderId OrderId,
)
OffsetSubaccountPerpetualPosition(
ctx sdk.Context,
liquidatedSubaccountId satypes.SubaccountId,
perpetualId uint32,
deltaQuantumsTotal *big.Int,
) (
fills []MatchPerpetualDeleveraging_Fill,
deltaQuantumsRemaining *big.Int,
)
GetIndexerEventManager() indexer_manager.IndexerEventManager
IsLiquidatable(
ctx sdk.Context,
subaccountId satypes.SubaccountId,
) (
bool,
error,
)
ValidateSubaccountEquityTierLimitForNewOrder(
ctx sdk.Context,
order Order,
) error
Logger(
ctx sdk.Context,
) log.Logger
}