-
Notifications
You must be signed in to change notification settings - Fork 211
Expand file tree
/
Copy pathquery.proto
More file actions
222 lines (185 loc) · 7.9 KB
/
Copy pathquery.proto
File metadata and controls
222 lines (185 loc) · 7.9 KB
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
syntax = "proto3";
package dydxprotocol.clob;
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "dydxprotocol/clob/block_rate_limit_config.proto";
import "dydxprotocol/clob/clob_pair.proto";
import "dydxprotocol/clob/equity_tier_limit_config.proto";
import "dydxprotocol/clob/order.proto";
import "dydxprotocol/clob/matches.proto";
import "dydxprotocol/clob/liquidations_config.proto";
import "dydxprotocol/clob/mev.proto";
import "dydxprotocol/indexer/off_chain_updates/off_chain_updates.proto";
option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/clob/types";
// Query defines the gRPC querier service.
service Query {
// Queries a ClobPair by id.
rpc ClobPair(QueryGetClobPairRequest) returns (QueryClobPairResponse) {
option (google.api.http).get = "/dydxprotocol/clob/clob_pair/{id}";
}
// Queries a list of ClobPair items.
rpc ClobPairAll(QueryAllClobPairRequest) returns (QueryClobPairAllResponse) {
option (google.api.http).get = "/dydxprotocol/clob/clob_pair";
}
// Runs the MEV node <> node calculation with the provided parameters.
rpc MevNodeToNodeCalculation(MevNodeToNodeCalculationRequest)
returns (MevNodeToNodeCalculationResponse) {
option (google.api.http) = {
post : "/dydxprotocol/clob/mev_node_to_node_calculation"
body : "*"
};
}
// Queries EquityTierLimitConfiguration.
rpc EquityTierLimitConfiguration(QueryEquityTierLimitConfigurationRequest)
returns (QueryEquityTierLimitConfigurationResponse) {
option (google.api.http).get = "/dydxprotocol/clob/equity_tier";
}
// Queries BlockRateLimitConfiguration.
rpc BlockRateLimitConfiguration(QueryBlockRateLimitConfigurationRequest)
returns (QueryBlockRateLimitConfigurationResponse) {
option (google.api.http).get = "/dydxprotocol/clob/block_rate";
}
// Queries LiquidationsConfiguration.
rpc LiquidationsConfiguration(QueryLiquidationsConfigurationRequest)
returns (QueryLiquidationsConfigurationResponse) {
option (google.api.http).get = "/dydxprotocol/clob/liquidations_config";
}
// Queries the stateful order for a given order id.
rpc StatefulOrder(QueryStatefulOrderRequest)
returns (QueryStatefulOrderResponse) {}
// GRPC Streams
// Streams orderbook updates. Updates contain orderbook data
// such as order placements, updates, and fills.
rpc StreamOrderbookUpdates(StreamOrderbookUpdatesRequest)
returns (stream StreamOrderbookUpdatesResponse);
}
// QueryGetClobPairRequest is request type for the ClobPair method.
message QueryGetClobPairRequest { uint32 id = 1; }
// QueryClobPairResponse is response type for the ClobPair method.
message QueryClobPairResponse {
ClobPair clob_pair = 1 [ (gogoproto.nullable) = false ];
}
// QueryAllClobPairRequest is request type for the ClobPairAll method.
message QueryAllClobPairRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
// QueryClobPairAllResponse is response type for the ClobPairAll method.
message QueryClobPairAllResponse {
repeated ClobPair clob_pair = 1 [ (gogoproto.nullable) = false ];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// MevNodeToNodeCalculationRequest is a request message used to run the
// MEV node <> node calculation.
message MevNodeToNodeCalculationRequest {
// Represents the matches on the "block proposer". Note that this field
// does not need to be the actual block proposer's matches for a block, since
// the MEV calculation logic is run with this nodes matches as the "block
// proposer" matches.
dydxprotocol.clob.ValidatorMevMatches block_proposer_matches = 1;
// Represents the matches and mid-prices on the validator.
dydxprotocol.clob.MevNodeToNodeMetrics validator_mev_metrics = 2;
}
// MevNodeToNodeCalculationResponse is a response message that contains the
// MEV node <> node calculation result.
message MevNodeToNodeCalculationResponse {
// MevAndVolumePerClob contains information about the MEV and volume per CLOB.
message MevAndVolumePerClob {
uint32 clob_pair_id = 1;
float mev = 2;
uint64 volume = 3;
}
repeated MevAndVolumePerClob results = 1 [ (gogoproto.nullable) = false ];
}
// QueryEquityTierLimitConfigurationRequest is a request message for
// EquityTierLimitConfiguration.
message QueryEquityTierLimitConfigurationRequest {}
// QueryEquityTierLimitConfigurationResponse is a response message that contains
// the EquityTierLimitConfiguration.
message QueryEquityTierLimitConfigurationResponse {
EquityTierLimitConfiguration equity_tier_limit_config = 1
[ (gogoproto.nullable) = false ];
}
// QueryBlockRateLimitConfigurationRequest is a request message for
// BlockRateLimitConfiguration.
message QueryBlockRateLimitConfigurationRequest {}
// QueryBlockRateLimitConfigurationResponse is a response message that contains
// the BlockRateLimitConfiguration.
message QueryBlockRateLimitConfigurationResponse {
BlockRateLimitConfiguration block_rate_limit_config = 1
[ (gogoproto.nullable) = false ];
}
// QueryStatefulOrderRequest is a request message for StatefulOrder.
message QueryStatefulOrderRequest {
// Order id to query.
OrderId order_id = 1 [ (gogoproto.nullable) = false ];
}
// QueryStatefulOrderResponse is a response message that contains the stateful
// order.
message QueryStatefulOrderResponse {
// Stateful order placement.
LongTermOrderPlacement order_placement = 1 [ (gogoproto.nullable) = false ];
// Fill amounts.
uint64 fill_amount = 2;
// Triggered status.
bool triggered = 3;
}
// QueryLiquidationsConfigurationRequest is a request message for
// LiquidationsConfiguration.
message QueryLiquidationsConfigurationRequest {}
// QueryLiquidationsConfigurationResponse is a response message that contains
// the LiquidationsConfiguration.
message QueryLiquidationsConfigurationResponse {
LiquidationsConfig liquidations_config = 1 [ (gogoproto.nullable) = false ];
}
// StreamOrderbookUpdatesRequest is a request message for the
// StreamOrderbookUpdates method.
message StreamOrderbookUpdatesRequest {
// Clob pair ids to stream orderbook updates for.
repeated uint32 clob_pair_id = 1;
}
// StreamOrderbookUpdatesResponse is a response message for the
// StreamOrderbookUpdates method.
message StreamOrderbookUpdatesResponse {
// Batch of updates for the clob pair.
repeated StreamUpdate updates = 1 [ (gogoproto.nullable) = false ];
}
// StreamUpdate is an update that will be pushed through the
// GRPC stream.
message StreamUpdate {
// Contains one of an StreamOrderbookUpdate,
// StreamOrderbookFill.
oneof update_message {
StreamOrderbookUpdate orderbook_update = 1;
StreamOrderbookFill order_fill = 2;
}
// Block height of the update.
uint32 block_height = 3;
// Exec mode of the update.
uint32 exec_mode = 4;
}
// StreamOrderbookUpdate provides information on an orderbook update. Used in
// the full node GRPC stream.
message StreamOrderbookUpdate {
// Orderbook updates for the clob pair. Can contain order place, removals,
// or updates.
repeated dydxprotocol.indexer.off_chain_updates.OffChainUpdateV1 updates = 1
[ (gogoproto.nullable) = false ];
// Snapshot indicates if the response is from a snapshot of the orderbook.
// All updates should be ignored until snapshot is recieved.
// If the snapshot is true, then all previous entries should be
// discarded and the orderbook should be resynced.
bool snapshot = 2;
}
// StreamOrderbookFill provides information on an orderbook fill. Used in
// the full node GRPC stream.
message StreamOrderbookFill {
// Clob match. Provides information on which orders were matched
// and the type of order.
ClobMatch clob_match = 1;
// All orders involved in the specified clob match. Used to look up
// price of a match through a given maker order id.
repeated Order orders = 2 [ (gogoproto.nullable) = false ];
// Resulting fill amounts for each order in the orders array.
repeated uint64 fill_amounts = 3;
}