-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathquery.proto
313 lines (238 loc) · 10.6 KB
/
query.proto
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
syntax = "proto3";
package squad.liquidity.v1beta1;
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "squad/liquidity/v1beta1/liquidity.proto";
option go_package = "github.com/cosmosquad-labs/squad/x/liquidity/types";
// Query defines the gRPC querier service.
service Query {
// Params returns parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/params";
}
// Pools returns all liquidity pools.
rpc Pools(QueryPoolsRequest) returns (QueryPoolsResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pools";
}
// Pool returns the specific liquidity pool.
rpc Pool(QueryPoolRequest) returns (QueryPoolResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pools/{pool_id}";
}
// PoolByReserveAddress returns all pools that correspond to the reserve account.
rpc PoolByReserveAddress(QueryPoolByReserveAddressRequest) returns (QueryPoolResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pools/reserve_address/{reserve_address}";
}
// PoolByPoolCoinDenom returns all pools that correspond to the pool coin denom.
rpc PoolByPoolCoinDenom(QueryPoolByPoolCoinDenomRequest) returns (QueryPoolResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pools/pool_coin_denom/{pool_coin_denom}";
}
// Pairs returns all liquidity pairs.
rpc Pairs(QueryPairsRequest) returns (QueryPairsResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pairs";
}
// Pair returns the specific pair.
rpc Pair(QueryPairRequest) returns (QueryPairResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pairs/{pair_id}";
}
// DepositRequests returns all deposit requests.
rpc DepositRequests(QueryDepositRequestsRequest) returns (QueryDepositRequestsResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pools/{pool_id}/deposit_requests";
}
// DepositRequest returns the specific deposit request.
rpc DepositRequest(QueryDepositRequestRequest) returns (QueryDepositRequestResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pools/{pool_id}/deposit_requests/{id}";
}
// WithdrawRequests returns all withdraw requests.
rpc WithdrawRequests(QueryWithdrawRequestsRequest) returns (QueryWithdrawRequestsResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pools/{pool_id}/withdraw_requests";
}
// WithdrawRequest returns the specific withdraw request.
rpc WithdrawRequest(QueryWithdrawRequestRequest) returns (QueryWithdrawRequestResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pools/{pool_id}/withdraw_requests/{id}";
}
// Orders returns all orders within the pair.
rpc Orders(QueryOrdersRequest) returns (QueryOrdersResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pairs/{pair_id}/orders";
}
// Order returns the specific order.
rpc Order(QueryOrderRequest) returns (QueryOrderResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/pairs/{pair_id}/orders/{id}";
}
// OrdersByOrderer returns orders made by an orderer.
rpc OrdersByOrderer(QueryOrdersByOrdererRequest) returns (QueryOrdersResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/orders/{orderer}";
}
rpc OrderBooks(QueryOrderBooksRequest) returns (QueryOrderBooksResponse) {
option (google.api.http).get = "/squad/liquidity/v1beta1/order_books";
}
}
// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}
// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
Params params = 1 [(gogoproto.nullable) = false];
}
// QueryPoolsRequest is request type for the Query/Pools RPC method.
message QueryPoolsRequest {
uint64 pair_id = 1;
string disabled = 2;
cosmos.base.query.v1beta1.PageRequest pagination = 3;
}
// QueryPoolsResponse is response type for the Query/Pools RPC method.
message QueryPoolsResponse {
repeated PoolResponse pools = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryPoolRequest is request type for the Query/Pool RPC method.
message QueryPoolRequest {
uint64 pool_id = 1;
}
// QueryPoolResponse is response type for the Query/Pool RPC method.
message QueryPoolResponse {
PoolResponse pool = 1 [(gogoproto.nullable) = false];
}
// QueryPoolByReserveAddressRequest is request type for the Query/PoolByReserveAddress RPC method.
message QueryPoolByReserveAddressRequest {
string reserve_address = 1;
}
// QueryPoolByPoolCoinDenomRequest is request type for the Query/PoolByPoolCoinDenom RPC method.
message QueryPoolByPoolCoinDenomRequest {
string pool_coin_denom = 1;
}
// QueryPairsRequest is request type for the Query/Pairs RPC method.
message QueryPairsRequest {
repeated string denoms = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryPairsResponse is response type for the Query/Pairs RPC method.
message QueryPairsResponse {
repeated Pair pairs = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryPairRequest is request type for the Query/Pair RPC method.
message QueryPairRequest {
uint64 pair_id = 1;
}
// QueryPairResponse is response type for the Query/Pair RPC method.
message QueryPairResponse {
Pair pair = 1 [(gogoproto.nullable) = false];
}
// QueryDepositRequestsRequest is request type for the Query/DepositRequests RPC method.
message QueryDepositRequestsRequest {
uint64 pool_id = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryDepositRequestsResponse is response type for the Query/DepositRequests RPC method.
message QueryDepositRequestsResponse {
repeated DepositRequest deposit_requests = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryDepositRequestRequest is request type for the Query/DepositRequest RPC method.
message QueryDepositRequestRequest {
uint64 pool_id = 1;
uint64 id = 2;
}
// QueryDepositRequestResponse is response type for the Query/DepositRequest RPC method.
message QueryDepositRequestResponse {
DepositRequest deposit_request = 1 [(gogoproto.nullable) = false];
}
// QueryWithdrawRequestsRequest is request type for the Query/WithdrawRequests RPC method.
message QueryWithdrawRequestsRequest {
uint64 pool_id = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryWithdrawRequestsResponse is response type for the Query/WithdrawRequests RPC method.
message QueryWithdrawRequestsResponse {
repeated WithdrawRequest withdraw_requests = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryWithdrawRequestRequest is request type for the Query/WithdrawRequest RPC method.
message QueryWithdrawRequestRequest {
uint64 pool_id = 1;
uint64 id = 2;
}
// QueryWithdrawRequestResponse is response type for the Query/WithdrawRequest RPC method.
message QueryWithdrawRequestResponse {
WithdrawRequest withdraw_request = 1 [(gogoproto.nullable) = false];
}
// QueryOrdersRequest is request type for the Query/Orders RPC method.
message QueryOrdersRequest {
uint64 pair_id = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryOrdersResponse is response type for the Query/Orders RPC method.
message QueryOrdersResponse {
repeated Order orders = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryOrderRequest is request type for the Query/Order RPC method.
message QueryOrderRequest {
uint64 pair_id = 1;
uint64 id = 2;
}
// QueryOrderResponse is response type for the Query/Order RPC method.
message QueryOrderResponse {
Order order = 1 [(gogoproto.nullable) = false];
}
// QueryOrdersByOrdererRequest is request type for the Query/OrdersByOrderer RPC method.
message QueryOrdersByOrdererRequest {
string orderer = 1;
uint64 pair_id = 2;
cosmos.base.query.v1beta1.PageRequest pagination = 3;
}
// QueryOrderBooksRequest is request type for the Query/OrderBooks RPC method.
message QueryOrderBooksRequest {
repeated uint64 pair_ids = 1;
repeated uint32 price_unit_powers = 2;
uint32 num_ticks = 3;
}
// QueryOrderBooksResponse is response type for Query/OrderBooks RPC method.
message QueryOrderBooksResponse {
repeated OrderBookPairResponse pairs = 2 [(gogoproto.nullable) = false];
}
//
// Custom response messages
//
// PoolResponse defines a custom pool response message.
message PoolResponse {
PoolType type = 1;
uint64 id = 2;
uint64 pair_id = 3;
string creator = 4;
string reserve_address = 5;
string pool_coin_denom = 6;
string pool_coin_supply = 7
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
string min_price = 8 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"];
string max_price = 9 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"];
string price = 10 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"];
PoolBalances balances = 11 [(gogoproto.nullable) = false];
uint64 last_deposit_request_id = 12;
uint64 last_withdraw_request_id = 13;
bool disabled = 14;
}
message PoolBalances {
cosmos.base.v1beta1.Coin base_coin = 1 [(gogoproto.nullable) = false];
cosmos.base.v1beta1.Coin quote_coin = 2 [(gogoproto.nullable) = false];
}
message OrderBookPairResponse {
uint64 pair_id = 1;
string base_price = 2
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
repeated OrderBookResponse order_books = 3 [(gogoproto.nullable) = false];
}
message OrderBookResponse {
string price_unit = 1
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
repeated OrderBookTickResponse sells = 2 [(gogoproto.nullable) = false];
repeated OrderBookTickResponse buys = 3 [(gogoproto.nullable) = false];
}
message OrderBookTickResponse {
string price = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
string user_order_amount = 2
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
string pool_order_amount = 3
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
}