generated from sambacha/starter-slim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sushiswap.api.yml
457 lines (442 loc) · 13.3 KB
/
sushiswap.api.yml
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
openapi: 3.0.0
info:
version: 0.0.1
title: Order Book API
contact: {}
paths:
/api/v1/orders:
post:
summary: Create a new order.
responses:
'201':
description: Order has been accepted.
content:
application/json:
schema:
$ref: '#/components/schemas/UID'
'400':
description: Error during order validation
content:
application/json:
schema:
$ref: '#/components/schemas/OrderPostError'
'403':
description: 'Forbidden, your account is deny-listed'
'429':
description: Too many order placements
'500':
description: Error adding an order
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OrderCreation'
description: The order to create.
required: true
tags:
- sushiswap
- rpc
parameters:
- name: eth_sendRawTransaction
in: query
required: true
schema:
id: '1'
params: {}
type: string
description: eth_sendRawTransaction
get:
summary: Get existing orders.
description: >
By default all currently valid orders are returned. The set of returned
orders can be
reduced by setting owner, sell token, buy token filters. It can be
increased by disabling
different order validity exclusion criteria.
parameters:
- name: owner
in: query
required: false
description: Ethereum 40 byte address encoded as a hex with `0x` prefix.
schema:
type: string
- name: sellToken
in: query
required: false
description: Ethereum 40 byte address encoded as a hex with `0x` prefix.
schema:
type: string
- name: buyToken
in: query
required: false
description: Ethereum 40 byte address encoded as a hex with `0x` prefix.
schema:
type: string
- name: includeFullyExecuted
in: query
description: Should fully executed orders be returned?
schema:
type: boolean
default: false
- name: includeInvalidated
in: query
description: >-
Should orders that have been invalidated in the smart contract be
returned?
schema:
type: boolean
default: false
- name: includeInsufficientBalance
in: query
description: >-
Should fill or kill orders that are not sufficiently funded be
included?
schema:
type: boolean
default: false
- name: minValidTo
in: query
description: |
Minimum valid_to timestamp for included orders.
The default is the current time.
schema:
type: integer
responses:
'200':
description: existing orders
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Order'
tags:
- sushiswap
callbacks: {}
'/api/v1/orders/{UID}':
get:
summary: Get existing order from UID.
parameters:
- in: path
name: UID
required: true
description: >
Unique identifier for the order: 56 bytes encoded as hex with `0x`
prefix.
Bytes 0 to 32 are the order digest, bytes 30 to 52 the owner address
and bytes 52..56 valid to,
schema:
type: string
responses:
'200':
description: Order
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Order'
'404':
description: Order was not found
tags:
- sushiswap
description: UIDv4
delete:
summary: Cancels order by marking it invalid with a timestamp.
description: >
The successful deletion might not prevent solvers from settling the
order
Authentication must be provided by signing the following message:
parameters:
- in: path
name: UID
required: true
description: >
Unique identifier for the order: 56 bytes encoded as hex with `0x`
prefix.
Bytes 0 to 32 are the order digest, bytes 30 to 52 the owner address
and bytes 52..56 valid to,
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OrderCancellation'
description: Signed OrderCancellation
required: true
responses:
'200':
description: Order deleted
'401':
description: Invalid signature
'404':
description: Order was not found
tags:
- sushiswap
'/api/v1/tokens/{sellToken}/fee':
get:
description: >
The fee that is charged for placing an order.
The fee is described by a minimum fee - in order to cover the gas costs
for onchain settling - and
a feeRatio charged to the users for using the service.
parameters:
- name: sellToken
in: path
required: true
description: Ethereum 40 byte address encoded as a hex with `0x` prefix.
schema:
type: string
responses:
'200':
description: the fee
content:
application/json:
schema:
$ref: '#/components/schemas/FeeInformation'
'404':
description: sellToken not existent
tags:
- sushiswap
summary: Token Fees
/api/v1/trades:
get:
summary: Get existing Trades.
description: |
By default all trades are returned.
Queries can be refined by specifiying owner or order_uid.
parameters:
- name: owner
in: query
required: false
description: Ethereum 40 byte address encoded as a hex with `0x` prefix.
schema:
type: string
- name: orderUid
in: query
required: false
description: >
Unique identifier for the order: 56 bytes encoded as hex with `0x`
prefix.
Bytes 0 to 32 are the order digest, bytes 30 to 52 the owner address
and bytes 52..56 valid to,
schema:
type: string
responses:
'200':
description: all trades
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Trade'
tags:
- sushiswap
/api/v1/solvable_orders:
get:
summary: Get solvable orders.
description: >
The set of orders that solvers should be solving right now. These orders
are determined to
be valid at the time of the request.
responses:
'200':
description: the orders
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Order'
tags:
- sushiswap
parameters: []
x-components: {}
servers:
- url: 'https://sushi.backbonecabal.xyz/'
- url: 'http://sushi.backbonecabal.xyz/'
components:
schemas:
Address:
description: Ethereum 40 byte address encoded as a hex with `0x` prefix.
type: string
example: '0x6810e776880c02933d47db1b9fc05908e5386b96'
BigUint:
description: A big unsigned integer encoded in decimal.
type: string
example: '1234567890'
TokenAmount:
description: Amount of a token. uint256 encoded in decimal.
type: string
example: '1234567890'
FeeInformation:
description: |
Provides the information to calculate the fees.
type: object
properties:
expirationDate:
description: |
Expiration date of the offered fee. Order service might not accept
the fee after this expiration date. Encoded as ISO 8601 UTC.
type: string
example: '2020-12-03T18:35:18.814523Z'
minimalFee:
$ref: '#/components/schemas/TokenAmount'
feeRatio:
description: The fee ratio charged on a sellAmount. Denoted in basis points
example: 10
type: number
format: int32
OrderType:
description: Is this a buy order or sell order?
type: string
enum:
- buy
- sell
OrderCreation:
description: Data a user provides when creating a new order.
type: object
properties:
sellToken:
$ref: '#/components/schemas/Address'
buyToken:
$ref: '#/components/schemas/Address'
sellAmount:
$ref: '#/components/schemas/TokenAmount'
buyAmount:
$ref: '#/components/schemas/TokenAmount'
validTo:
description: Unix timestamp until the order is valid. uint32.
type: integer
appData:
description: >
Arbitrary identifier sent along with the order.
Could be used to track the interface or other meta-aspects of the
order. uint32 encoded
type: integer
feeAmount:
$ref: '#/components/schemas/TokenAmount'
kind:
$ref: '#/components/schemas/OrderType'
partiallyFillable:
description: Is this a fill-or-kill order or a partially fillable order?
type: boolean
Signature:
$ref: '#/components/schemas/Signature'
OrderMetaData:
description: |
Extra order data that is returned to users when querying orders
but not provided by users when creating orders.
type: object
properties:
creationTime:
description: Creation time of the order. Encoded as ISO 8601 UTC.
type: string
example: '2020-12-03T18:35:18.814523Z'
owner:
$ref: '#/components/schemas/Address'
UID:
$ref: '#/components/schemas/UID'
availableBalance:
$ref: '#/components/schemas/TokenAmount'
executedSellAmount:
$ref: '#/components/schemas/BigUint'
executedSellAmountBeforeFees:
$ref: '#/components/schemas/BigUint'
executedBuyAmount:
$ref: '#/components/schemas/BigUint'
executedFeeAmount:
$ref: '#/components/schemas/BigUint'
invalidated:
description: Has this order been invalidated?
type: boolean
Order:
allOf:
- $ref: '#/components/schemas/OrderCreation'
- $ref: '#/components/schemas/OrderMetaData'
OrderCancellation:
description: >
EIP712 signature of struct OrderCancellation { orderUid: bytes } from
the order's owner
type: object
properties:
signature:
$ref: '#/components/schemas/Signature'
Trade:
description: |
Trade data such as executed amounts, fees, order id and block number.
type: object
properties:
blockNumber:
description: Block in which trade occurred.
type: integer
logIndex:
description: Index in which transaction was included in block.
type: integer
orderUid:
$ref: '#/components/schemas/UID'
owner:
$ref: '#/components/schemas/Address'
sellToken:
$ref: '#/components/schemas/Address'
buyToken:
$ref: '#/components/schemas/Address'
sellAmount:
$ref: '#/components/schemas/TokenAmount'
sellAmountBeforeFees:
$ref: '#/components/schemas/BigUint'
buyAmount:
$ref: '#/components/schemas/TokenAmount'
UID:
description: >
Unique identifier for the order: 56 bytes encoded as hex with `0x`
prefix.
Bytes 0 to 32 are the order digest, bytes 30 to 52 the owner address
and bytes 52..56 valid to,
type: string
Signature:
description: 65 bytes encoded as hex with `0x` prefix. r + s + v from the spec.
example: >-
0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
OrderPostError:
type: object
properties:
errorType:
type: string
enum:
- MissingOrderData
- InvalidSignature
- DuplicateOrder
- InsufficientFunds
description:
type: string
OrderCancellationError:
type: object
properties:
errorType:
type: string
enum:
- InvalidSignature
- InvalidOrderUid
description:
type: string
links: {}
callbacks: {}
securitySchemes:
project_id:
type: apiKey
name: api_key
in: header
project_credentials:
type: oauth2
security:
- project_id: []
- project_credentials: []
tags:
- name: sushiswap
description: |
SushiSwap Backbone API
- name: rpc
description: JSON-RPC