-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenApi.yml
1003 lines (1003 loc) · 27.7 KB
/
OpenApi.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
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
components:
schemas:
"": {}
AcceptPeginRespose:
properties:
bitcoinDepositAddressHash:
description: Hash of the deposit BTC address
example: "0x0"
type: string
signature:
description: Signature of the quote
example: "0x0"
type: string
required:
- signature
- bitcoinDepositAddressHash
type: object
AcceptPegoutResponse:
properties:
lbcAddress:
description: LBC address to execute depositPegout function
example: "0x0"
type: string
signature:
description: Signature of the quote
example: "0x0"
type: string
required:
- signature
- lbcAddress
type: object
AcceptQuoteRequest:
properties:
quoteHash:
description: QuoteHash
example: "0x0"
type: string
required:
- quoteHash
type: object
AddCollateralRequest:
properties:
amount:
description: Amount to add to the collateral
example: 100000000000
type: integer
required:
- amount
type: object
AddCollateralResponse:
properties:
newCollateralBalance:
description: New Collateral Balance
example: 100000000000
type: integer
type: object
AvailableLiquidityDTO:
properties:
peginLiquidityAmount:
description: Available liquidity for PegIn operations in wei
example: "5000000000000000000"
pegoutLiquidityAmount:
description: Available liquidity for PegOut operations in satoshi
example: "500000000"
required:
- peginLiquidityAmount
- pegoutLiquidityAmount
type: object
ChangeStatusRequest:
properties:
status:
type: boolean
type: object
ConfirmationsPerAmount:
properties:
key:
type: integer
type: object
DepositEventDTO:
properties:
amount:
description: Event Value
example: "10000"
from:
description: From Address
example: "0x0"
type: string
quoteHash:
description: QuoteHash
example: "0x0"
type: string
timestamp:
description: Event Timestamp
example: "10000"
format: date-time
type: string
type: object
GeneralConfiguration:
properties:
btcConfirmations:
$ref: '#/components/schemas/ConfirmationsPerAmount'
type: object
publicLiquidityCheck:
type: boolean
rskConfirmations:
$ref: '#/components/schemas/ConfirmationsPerAmount'
type: object
type: object
GeneralConfigurationRequest:
properties:
configuration:
$ref: '#/components/schemas/GeneralConfiguration'
type: object
type: object
GetCollateralResponse:
properties:
collateral:
type: integer
required:
- collateral
type: object
GetPeginQuoteResponse:
properties:
quote:
$ref: '#/components/schemas/PeginQuoteDTO'
description: Detail of the quote
type: object
quoteHash:
description: This is a 64 digit number that derives from a quote object
type: string
required:
- quote
- quoteHash
type: object
GetPegoutQuoteResponse:
properties:
quote:
$ref: '#/components/schemas/PegoutQuoteDTO'
description: Detail of the quote
type: object
quoteHash:
description: This is a 64 digit number that derives from a quote object
type: string
required:
- quote
- quoteHash
type: object
HealthResponse:
properties:
services:
description: LPS Services Status
example:
btc: ok
db: ok
rsk: ok
type: object
status:
description: Overall LPS Health Status
example: ok
type: string
required:
- status
- services
type: object
LiquidityProvider:
properties:
apiBaseUrl:
description: API base URL
example: https://api.example.com
type: string
id:
description: Provider Id
example: 1
type: integer
name:
description: Provider Name
example: New Provider
type: string
provider:
description: Provider Address
example: "0x0"
type: string
providerType:
description: Provider type
example: pegin
type: string
status:
description: Provider status
example: true
type: boolean
required:
- id
- provider
- name
- apiBaseUrl
- status
- providerType
type: object
PeginConfiguration:
properties:
callFee:
$ref: '#/components/schemas/Wei'
callTime:
type: integer
maxValue:
$ref: '#/components/schemas/Wei'
minValue:
$ref: '#/components/schemas/Wei'
penaltyFee:
$ref: '#/components/schemas/Wei'
timeForDeposit:
type: integer
type: object
PeginConfigurationRequest:
properties:
configuration:
$ref: '#/components/schemas/PeginConfiguration'
type: object
type: object
PeginQuoteDTO:
properties:
agreementTimestamp:
description: The timestamp of the agreement
type: integer
btcRefundAddr:
description: A User BTC refund address
type: string
callFee:
description: The fee charged by the LP
type: integer
callOnRegister:
description: A boolean value indicating whether the callForUser can be called
on registerPegIn
type: boolean
confirmations:
description: The number of confirmations that the LP requires before making
the call
type: integer
contractAddr:
description: The destination address of the peg-in
type: string
data:
description: The arguments to send in the call
type: string
fedBTCAddr:
description: The BTC address of the PowPeg
type: string
gasFee:
description: Fee to pay for the gas of every call done during the pegin
(call on behalf of the user and call to the dao fee collector)
type: integer
gasLimit:
description: The gas limit
type: integer
lbcAddr:
description: The address of the LBC
type: string
lpBTCAddr:
description: The BTC address of the LP
type: string
lpCallTime:
description: The time (in seconds) that the LP has to perform the call on
behalf of the user after the deposit achieves the number of confirmations
type: integer
lpRSKAddr:
description: The RSK address of the LP
type: string
nonce:
description: A nonce that uniquely identifies this quote
type: integer
penaltyFee:
description: The penalty fee that the LP pays if it fails to deliver the
service
type: integer
productFeeAmount:
description: The DAO Fee amount
type: integer
rskRefundAddr:
description: A User RSK refund address
type: string
timeForDeposit:
description: The time (in seconds) that the user has to achieve one confirmation
on the BTC deposit
type: integer
value:
description: The value to transfer in the call
type: integer
required:
- fedBTCAddr
- lbcAddr
- lpRSKAddr
- btcRefundAddr
- rskRefundAddr
- lpBTCAddr
- callFee
- penaltyFee
- contractAddr
- data
- gasLimit
- nonce
- value
- agreementTimestamp
- timeForDeposit
- lpCallTime
- confirmations
- callOnRegister
- gasFee
- productFeeAmount
type: object
PeginQuoteRequest:
properties:
bitcoinRefundAddress:
description: 'User Bitcoin refund address. Note: Must be a legacy address,
segwit addresses are not accepted'
example: "0x0"
type: string
callContractArguments:
description: Contract data
example: "0x0"
type: string
callEoaOrContractAddress:
description: Contract address or EOA address
example: "0x0"
type: string
rskRefundAddress:
description: User RSK refund address
example: "0x0"
type: string
valueToTransfer:
description: Value to send in the call
example: 0
type: integer
required:
- callEoaOrContractAddress
- callContractArguments
- valueToTransfer
- rskRefundAddress
- bitcoinRefundAddress
type: object
PeginQuoteStatusDTO:
properties:
detail:
$ref: '#/components/schemas/PeginQuoteDTO'
description: Agreed specification of the quote
type: object
status:
$ref: '#/components/schemas/RetainedPeginQuoteDTO'
description: Current status of the quote
type: object
required:
- detail
- status
type: object
PegoutConfiguration:
properties:
bridgeTransactionMin:
$ref: '#/components/schemas/Wei'
callFee:
$ref: '#/components/schemas/Wei'
callTime:
type: integer
expireBlocks:
type: integer
maxValue:
$ref: '#/components/schemas/Wei'
minValue:
$ref: '#/components/schemas/Wei'
penaltyFee:
$ref: '#/components/schemas/Wei'
timeForDeposit:
type: integer
type: object
PegoutConfigurationRequest:
properties:
configuration:
$ref: '#/components/schemas/PegoutConfiguration'
type: object
type: object
PegoutQuoteDTO:
properties:
agreementTimestamp:
type: integer
btcRefundAddress:
type: string
callFee:
type: integer
depositAddr:
type: string
depositConfirmations:
type: integer
depositDateLimit:
type: integer
expireBlocks:
type: integer
expireDate:
type: integer
gasFee:
description: Fee to pay for the gas of every call done during the pegout
(call on behalf of the user in Bitcoin network and call to the dao fee
collector in Rootstock)
type: integer
lbcAddress:
type: string
liquidityProviderRskAddress:
type: string
lpBtcAddr:
type: string
nonce:
type: integer
penaltyFee:
type: integer
productFeeAmount:
description: The DAO fee amount
type: integer
rskRefundAddress:
type: string
transferConfirmations:
type: integer
transferTime:
type: integer
value:
type: integer
required:
- lbcAddress
- liquidityProviderRskAddress
- btcRefundAddress
- rskRefundAddress
- lpBtcAddr
- callFee
- penaltyFee
- nonce
- depositAddr
- value
- agreementTimestamp
- depositDateLimit
- depositConfirmations
- transferConfirmations
- transferTime
- expireDate
- expireBlocks
- gasFee
- productFeeAmount
type: object
PegoutQuoteRequest:
properties:
bitcoinRefundAddress:
description: BitcoinRefundAddress
example: "0x0"
type: string
rskRefundAddress:
description: RskRefundAddress
example: "0x0"
type: string
to:
description: Bitcoin address that will receive the BTC amount
type: string
valueToTransfer:
description: ValueToTransfer
example: 10000000000000
type: integer
required:
- to
- valueToTransfer
- rskRefundAddress
- bitcoinRefundAddress
type: object
PegoutQuoteStatusDTO:
properties:
detail:
$ref: '#/components/schemas/PegoutQuoteDTO'
description: Agreed specification of the quote
type: object
status:
$ref: '#/components/schemas/RetainedPegoutQuoteDTO'
description: Current status of the quote
type: object
required:
- detail
- status
type: object
ProviderDetail:
properties:
fee:
type: integer
maxTransactionValue:
type: integer
minTransactionValue:
type: integer
requiredConfirmations:
type: integer
required:
- fee
- minTransactionValue
- maxTransactionValue
- requiredConfirmations
type: object
ProviderDetailResponse:
properties:
liquidityCheckEnabled:
type: boolean
pegin:
$ref: '#/components/schemas/ProviderDetail'
type: object
pegout:
$ref: '#/components/schemas/ProviderDetail'
type: object
siteKey:
type: string
required:
- siteKey
- liquidityCheckEnabled
- pegin
- pegout
type: object
RetainedPeginQuoteDTO:
properties:
callForUserTxHash:
description: The hash of the RSK transaction to the address requested by
the user
type: string
depositAddress:
description: BTC derivation address where the user should send the BTC
type: string
quoteHash:
description: 32-byte long hash of the quote that acts as a unique identifier
type: string
registerPeginTxHash:
description: The hash of the RSK transaction where the LP gets his refund
and fee
type: string
requiredLiquidity:
$ref: '#/components/schemas/'
description: RBTC liquidity that the LP locks to guarantee the service.
It is different from the total amount that the user needs to pay.
signature:
description: Signature of the liquidity provider expressing commitment on
the quote
type: string
state:
description: |-
Current state of the quote. Possible values are:
- WaitingForDeposit
- WaitingForDepositConfirmations
- TimeForDepositElapsed
- CallForUserSucceeded
- CallForUserFailed
- RegisterPegInSucceeded
- RegisterPegInFailed
type: string
userBtcTxHash:
description: The hash of the user's BTC transaction to the derivation address
type: string
required:
- quoteHash
- signature
- depositAddress
- requiredLiquidity
- state
- userBtcTxHash
- callForUserTxHash
- registerPeginTxHash
type: object
RetainedPegoutQuoteDTO:
properties:
bridgeRefundTxHash:
description: The hash of the transaction from the LP to the bridge to convert
the refunded RBTC into BTC
type: string
depositAddress:
description: Address of the smart contract where the user should execute
depositPegout function
type: string
lpBtcTxHash:
description: The hash of the BTC transaction from the LP to the user
type: string
quoteHash:
description: 32-byte long hash of the quote that acts as a unique identifier
type: string
refundPegoutTxHash:
description: The hash of the transaction from the LP to the LBC where the
LP got the refund in RBTC
type: string
requiredLiquidity:
$ref: '#/components/schemas/'
description: BTC liquidity that the LP locks to guarantee the service. It
is different from the total amount that the user needs to pay.
signature:
description: Signature of the liquidity provider expressing commitment on
the quote
type: string
state:
description: |
Current state of the quote. Possible values are:
- WaitingForDeposit
- WaitingForDepositConfirmations
- TimeForDepositElapsed
- SendPegoutSucceeded
- SendPegoutFailed
- RefundPegOutSucceeded
- RefundPegOutFailed
- BridgeTxSucceeded
- BridgeTxFailed
type: string
userRskTxHash:
description: The hash of the depositPegout transaction made by the user
type: string
required:
- quoteHash
- signature
- depositAddress
- requiredLiquidity
- state
- userRskTxHash
- lpBtcTxHash
- refundPegoutTxHash
- bridgeRefundTxHash
type: object
Services:
properties:
btc:
type: string
db:
type: string
rsk:
type: string
type: object
Wei: {}
entities.Wei: {}
pkg.AcceptQuoteRequest:
properties:
quoteHash:
description: QuoteHash
example: "0x0"
type: string
required:
- quoteHash
type: object
pkg.AddCollateralRequest:
properties:
amount:
description: Amount to add to the collateral
example: 100000000000
type: integer
required:
- amount
type: object
pkg.AddCollateralResponse:
properties:
newCollateralBalance:
description: New Collateral Balance
example: 100000000000
type: integer
type: object
pkg.GetCollateralResponse:
properties:
collateral:
type: integer
required:
- collateral
type: object
info:
title: Liquidity Provider Server
version: 1.2.1
openapi: 3.0.0
paths:
/configuration:
get:
description: ' Get all the configurations for the liquidity provider. Included
in the management API.'
responses:
"200":
description: ""
summary: Get configurations
post:
description: ' Set general configurations of the server. Included in the management
API.'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GeneralConfigurationRequest'
required: true
responses:
"204":
description: ""
summary: Set General Config
/getProviders:
get:
description: ' Returns a list of providers.'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/LiquidityProvider'
description: ""
summary: Get Providers
/health:
get:
description: ' Returns server health.'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/HealthResponse'
description: ""
summary: Health
/management:
get:
description: ' Serves the static site for the Management UI'
responses:
"200":
description: ""
summary: Management Interface
/management/credentials:
post:
description: ' Set new credentials to log into the Management API'
responses:
"200":
description: ""
summary: Set Login Credentials
/management/login:
post:
description: ' Authenticate to start a Management API session'
responses:
"200":
description: ""
summary: Management Login
/management/logout:
post:
description: ' Logout from the Management API session'
responses:
"204":
description: ""
summary: Management Logout
/pegin/acceptQuote:
post:
description: ' Accepts Quote'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AcceptQuoteRequest'
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/AcceptPeginRespose'
description: ""
summary: Accept Quote
/pegin/addCollateral:
post:
description: ' Adds PegIn Collateral'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddCollateralRequest'
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/AddCollateralResponse'
description: ""
summary: Add PegIn Collateral
/pegin/collateral:
get:
description: ' Get PegIn Collateral'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/GetCollateralResponse'
description: ""
summary: Get PegIn Collateral
/pegin/configuration:
post:
description: ' Set the configuration for the Pegin service. Included in the
management API.'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PeginConfigurationRequest'
required: true
responses:
"204":
description: ""
summary: Set Pegin Config
/pegin/getQuote:
post:
description: ' Gets Pegin Quote'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PeginQuoteRequest'
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/GetPeginQuoteResponse'
description: ""
summary: Pegin GetQuote
/pegin/status:
get:
description: ' Returns the status of an accepted pegin quote'
parameters:
- description: Hash of the quote
in: query
name: quoteHash
required: true
schema:
description: Hash of the quote
format: string
type: string
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/PeginQuoteStatusDTO'
description: Object containing the quote itself and its status
summary: GetPeginStatus
/pegout/acceptQuote:
post:
description: ' Accepts Quote Pegout'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AcceptQuoteRequest'
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/AcceptPegoutResponse'
description: ""
summary: Accept Quote Pegout
/pegout/addCollateral:
post:
description: ' Adds PegOut Collateral'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddCollateralRequest'
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/AddCollateralResponse'
description: ""
summary: Add PegOut Collateral
/pegout/collateral:
get:
description: ' Get PegOut Collateral'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/GetCollateralResponse'
description: ""
summary: Get PegOut Collateral
/pegout/configuration:
post:
description: ' Set the configuration for the Pegout service. Included in the
management API.'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PegoutConfigurationRequest'
required: true
responses:
"204":
description: ""
summary: Set Pegout Config
/pegout/getQuotes:
post:
description: ' Gets Pegout Quote'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PegoutQuoteRequest'
required: true
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/GetPegoutQuoteResponse'
description: ""
summary: Pegout GetQuote
/pegout/status:
get:
description: ' Returns the status of an accepted pegout quote'
parameters:
- description: Hash of the quote
in: query
name: quoteHash
required: true
schema:
description: Hash of the quote
format: string
type: string
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/PegoutQuoteStatusDTO'
description: Object containing the quote itself and its status
summary: GetPegoutStatus
/providers/changeStatus:
post:
description: ' Changes the status of the provider'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ChangeStatusRequest'
required: true
responses:
"204":
description: ""
summary: Change Provider Status
/providers/details:
get:
description: ' Returns the details of the provider that manages this instance
of LPS'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/ProviderDetailResponse'
description: Detail of the provider that manges this instance
summary: Provider detail
/providers/liquidity:
get:
description: ' Fetches the available liquidity for both PegIn and PegOut operations.'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/AvailableLiquidityDTO'
description: ""
summary: Fetch Available Liquidity
/providers/resignation:
post:
description: ' Provider stops being a liquidity provider'
responses:
"204":
description: ""
summary: Provider resignation
/providers/withdrawCollateral:
post:
description: ' Withdraw PegIn collateral of a resigned LP'
responses:
"204":
description: ""
summary: Withdraw PegIn Collateral
/userQuotes:
get:
description: ' Returns user quotes for address.'
parameters:
- description: User Quote Request Details
in: query
name: address
required: true
schema:
description: User Quote Request Details
format: string
type: string
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/DepositEventDTO'
description: Successfully retrieved the user quotes
summary: GetUserQuotes
servers:
- description: ' Testnet'