-
Notifications
You must be signed in to change notification settings - Fork 83
/
expected_keepers.go
167 lines (156 loc) · 3.71 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
package types
import (
"math/big"
"math/rand"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/types"
assettypes "github.com/dydxprotocol/v4-chain/protocol/x/assets/types"
blocktimetypes "github.com/dydxprotocol/v4-chain/protocol/x/blocktime/types"
perpetualsmoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals/types"
pricestypes "github.com/dydxprotocol/v4-chain/protocol/x/prices/types"
satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types"
)
type SubaccountsKeeper interface {
CanUpdateSubaccounts(
ctx sdk.Context,
updates []satypes.Update,
) (
success bool,
successPerUpdate []satypes.UpdateResult,
err error,
)
GetNetCollateralAndMarginRequirements(
ctx sdk.Context,
update satypes.Update,
) (
bigNetCollateral *big.Int,
bigInitialMargin *big.Int,
bigMaintenanceMargin *big.Int,
err error,
)
GetSubaccount(
ctx sdk.Context,
id satypes.SubaccountId,
) (
val satypes.Subaccount,
)
GetAllSubaccount(
ctx sdk.Context,
) (
list []satypes.Subaccount,
)
ForEachSubaccountRandomStart(
ctx sdk.Context,
callback func(satypes.Subaccount) (finished bool),
rand *rand.Rand,
)
GetRandomSubaccount(
ctx sdk.Context,
rand *rand.Rand,
) (
satypes.Subaccount,
error,
)
UpdateSubaccounts(
ctx sdk.Context,
updates []satypes.Update,
) (
success bool,
successPerUpdate []satypes.UpdateResult,
err error,
)
TransferFeesToFeeCollectorModule(
ctx sdk.Context,
assetId uint32,
amount *big.Int,
) error
TransferInsuranceFundPayments(
ctx sdk.Context,
amount *big.Int,
) error
}
type AssetsKeeper interface {
GetAsset(ctx sdk.Context, id uint32) (val assettypes.Asset, err error)
}
type BlockTimeKeeper interface {
GetPreviousBlockInfo(ctx sdk.Context) blocktimetypes.BlockInfo
}
type FeeTiersKeeper interface {
GetPerpetualFeePpm(ctx sdk.Context, address string, isTaker bool) int32
}
type PerpetualsKeeper interface {
GetNetNotional(
ctx sdk.Context,
id uint32,
bigQuantums *big.Int,
) (
bigNetNotionalQuoteQuantums *big.Int,
err error,
)
GetNotionalInBaseQuantums(
ctx sdk.Context,
id uint32,
bigQuoteQuantums *big.Int,
) (
bigBaseQuantums *big.Int,
err error,
)
GetNetCollateral(
ctx sdk.Context,
id uint32,
bigQuantums *big.Int,
) (
bigNetCollateralQuoteQuantums *big.Int,
err error,
)
GetMarginRequirements(
ctx sdk.Context,
id uint32,
bigQuantums *big.Int,
) (
bigInitialMarginQuoteQuantums *big.Int,
bigMaintenanceMarginQuoteQuantums *big.Int,
err error,
)
GetPerpetual(
ctx sdk.Context,
id uint32,
) (val perpetualsmoduletypes.Perpetual, err error)
GetPerpetualAndMarketPrice(
ctx sdk.Context,
perpetualId uint32,
) (perpetualsmoduletypes.Perpetual, pricestypes.MarketPrice, error)
GetSettlement(
ctx sdk.Context,
perpetualId uint32,
quantums *big.Int,
index *big.Int,
) (
bigNetSettlement *big.Int,
newFundingIndex *big.Int,
err error,
)
MaybeProcessNewFundingTickEpoch(ctx sdk.Context)
}
type StatsKeeper interface {
RecordFill(ctx sdk.Context, takerAddress string, makerAddress string, notional *big.Int)
}
// AccountKeeper defines the expected account keeper used for simulations.
type AccountKeeper interface {
GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI
}
// BankKeeper defines the expected bank keeper used for simulations.
type BankKeeper interface {
GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
}
type RewardsKeeper interface {
AddRewardSharesForFill(
ctx sdk.Context,
takerAddress string,
makerAddress string,
bigFillQuoteQuantums *big.Int,
bigTakerFeeQuoteQuantums *big.Int,
bigMakerFeeQuoteQuantums *big.Int,
)
}