Skip to content

Commit 1f9138f

Browse files
authored
Merge pull request #795 from rsksmart/feat/financial_api_2.3
Feat/financial api 2.3 -> flyover-2.3.0
2 parents fc083ed + 6ee3a4e commit 1f9138f

File tree

73 files changed

+6725
-60
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+6725
-60
lines changed

.mockery.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,17 @@ packages:
3838
DefaultCredentialsProvider:
3939
github.com/rsksmart/liquidity-provider-server/internal/adapters/entrypoints/rest/handlers:
4040
interfaces:
41+
GetAssetsReportUseCase:
4142
PeginStatusUseCase:
4243
PegoutStatusUseCase:
4344
SetGeneralConfigUseCase:
4445
github.com/rsksmart/liquidity-provider-server/internal/entities/liquidity_provider:
4546
interfaces:
4647
LiquidityProviderRepository:
4748
TrustedAccountRepository:
49+
github.com/rsksmart/liquidity-provider-server/internal/entities/penalization:
50+
interfaces:
51+
PenalizedEventRepository:
4852
github.com/rsksmart/liquidity-provider-server/internal/entities/quote:
4953
interfaces:
5054
PeginQuoteRepository:

OpenApi.yml

Lines changed: 252 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,40 @@ components:
156156
- quote
157157
- quoteHash
158158
type: object
159+
GetTransactionsItem:
160+
properties:
161+
amount:
162+
$ref: '#/components/schemas/Wei'
163+
callFee:
164+
$ref: '#/components/schemas/Wei'
165+
gasFee:
166+
$ref: '#/components/schemas/Wei'
167+
quoteHash:
168+
type: string
169+
status:
170+
type: string
171+
type: object
172+
GetTransactionsResponse:
173+
properties:
174+
data:
175+
items:
176+
properties:
177+
amount:
178+
$ref: '#/components/schemas/Wei'
179+
callFee:
180+
$ref: '#/components/schemas/Wei'
181+
gasFee:
182+
$ref: '#/components/schemas/Wei'
183+
quoteHash:
184+
type: string
185+
status:
186+
type: string
187+
type: object
188+
type: array
189+
pagination:
190+
$ref: '#/components/schemas/PaginationMetadata'
191+
type: object
192+
type: object
159193
HealthResponse:
160194
properties:
161195
services:
@@ -207,6 +241,17 @@ components:
207241
- status
208242
- providerType
209243
type: object
244+
PaginationMetadata:
245+
properties:
246+
page:
247+
type: integer
248+
perPage:
249+
type: integer
250+
total:
251+
type: integer
252+
totalPages:
253+
type: integer
254+
type: object
210255
PeginConfigurationDTO:
211256
properties:
212257
callTime:
@@ -295,8 +340,8 @@ components:
295340
description: The RSK address of the LP
296341
type: string
297342
nonce:
298-
$ref: '#/components/schemas/'
299343
description: A nonce that uniquely identifies this quote
344+
type: integer
300345
penaltyFee:
301346
$ref: '#/components/schemas/'
302347
description: The penalty fee that the LP pays if it fails to deliver the
@@ -455,7 +500,7 @@ components:
455500
lpBtcAddr:
456501
type: string
457502
nonce:
458-
$ref: '#/components/schemas/'
503+
type: integer
459504
penaltyFee:
460505
$ref: '#/components/schemas/'
461506
productFeeAmount:
@@ -529,8 +574,8 @@ components:
529574
ProviderDetail:
530575
properties:
531576
fee:
532-
deprecated: true
533577
$ref: '#/components/schemas/'
578+
deprecated: true
534579
feePercentage:
535580
type: number
536581
fixedFee:
@@ -693,6 +738,36 @@ components:
693738
rsk:
694739
type: string
695740
type: object
741+
SummaryDataDTO:
742+
properties:
743+
acceptedQuotesCount:
744+
type: integer
745+
lpEarnings:
746+
$ref: '#/components/schemas/'
747+
paidQuotesAmount:
748+
$ref: '#/components/schemas/'
749+
paidQuotesCount:
750+
type: integer
751+
refundedQuotesCount:
752+
type: integer
753+
totalAcceptedQuotedAmount:
754+
$ref: '#/components/schemas/'
755+
totalFeesCollected:
756+
$ref: '#/components/schemas/'
757+
totalPenaltyAmount:
758+
$ref: '#/components/schemas/'
759+
totalQuotesCount:
760+
type: integer
761+
type: object
762+
SummaryResultDTO:
763+
properties:
764+
peginSummary:
765+
$ref: '#/components/schemas/SummaryDataDTO'
766+
type: object
767+
pegoutSummary:
768+
$ref: '#/components/schemas/SummaryDataDTO'
769+
type: object
770+
type: object
696771
TrustedAccountRequest:
697772
properties:
698773
address:
@@ -704,6 +779,8 @@ components:
704779
rbtcLockingCap:
705780
$ref: '#/components/schemas/'
706781
type: object
782+
Wei: {}
783+
entities.Wei: {}
707784
pkg.AcceptAuthenticatedQuoteRequest:
708785
properties:
709786
quoteHash:
@@ -1185,6 +1262,178 @@ paths:
11851262
"204":
11861263
description: ""
11871264
summary: Withdraw PegIn Collateral
1265+
/reports/assets:
1266+
get:
1267+
description: ' Get the asset information for the LPS.'
1268+
responses:
1269+
"200":
1270+
description: ""
1271+
summary: Get asset Reports
1272+
/reports/pegin:
1273+
get:
1274+
description: ' Get the last pegins on the API. Included in the management API.'
1275+
parameters:
1276+
- description: Start date for the report. Supports YYYY-MM-DD (expands to full
1277+
day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1278+
in: query
1279+
name: startDate
1280+
required: true
1281+
schema:
1282+
description: Start date for the report. Supports YYYY-MM-DD (expands to
1283+
full day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1284+
format: string
1285+
type: string
1286+
- description: End date for the report. Supports YYYY-MM-DD (expands to end
1287+
of day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1288+
in: query
1289+
name: endDate
1290+
required: true
1291+
schema:
1292+
description: End date for the report. Supports YYYY-MM-DD (expands to end
1293+
of day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1294+
format: string
1295+
type: string
1296+
responses:
1297+
"200":
1298+
description: ""
1299+
summary: Get Pegin Reports
1300+
/reports/pegout:
1301+
get:
1302+
description: ' Get the last pegouts on the API. Included in the management API.'
1303+
parameters:
1304+
- description: Start date for the report. Supports YYYY-MM-DD (expands to full
1305+
day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1306+
in: query
1307+
name: startDate
1308+
required: true
1309+
schema:
1310+
description: Start date for the report. Supports YYYY-MM-DD (expands to
1311+
full day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1312+
format: string
1313+
type: string
1314+
- description: End date for the report. Supports YYYY-MM-DD (expands to end
1315+
of day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1316+
in: query
1317+
name: endDate
1318+
required: true
1319+
schema:
1320+
description: End date for the report. Supports YYYY-MM-DD (expands to end
1321+
of day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1322+
format: string
1323+
type: string
1324+
responses:
1325+
"200":
1326+
description: ""
1327+
summary: Get Pegout Reports
1328+
/reports/revenue:
1329+
get:
1330+
description: ' Get the revenue for the specified period.'
1331+
parameters:
1332+
- description: Start date for the report. Supports YYYY-MM-DD (expands to full
1333+
day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1334+
in: query
1335+
name: startDate
1336+
required: true
1337+
schema:
1338+
description: Start date for the report. Supports YYYY-MM-DD (expands to
1339+
full day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1340+
format: string
1341+
type: string
1342+
- description: End date for the report. Supports YYYY-MM-DD (expands to end
1343+
of day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1344+
in: query
1345+
name: endDate
1346+
required: true
1347+
schema:
1348+
description: End date for the report. Supports YYYY-MM-DD (expands to end
1349+
of day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1350+
format: string
1351+
type: string
1352+
responses:
1353+
"200":
1354+
description: ""
1355+
summary: Get revenue Reports
1356+
/reports/summaries:
1357+
get:
1358+
description: ' Returns financial data for a given period'
1359+
parameters:
1360+
- description: Start date in YYYY-MM-DD format
1361+
in: query
1362+
name: startDate
1363+
required: true
1364+
schema:
1365+
description: Start date in YYYY-MM-DD format
1366+
format: string
1367+
type: string
1368+
- description: End date in YYYY-MM-DD format
1369+
in: query
1370+
name: endDate
1371+
required: true
1372+
schema:
1373+
description: End date in YYYY-MM-DD format
1374+
format: string
1375+
type: string
1376+
responses:
1377+
"200":
1378+
content:
1379+
application/json:
1380+
schema:
1381+
$ref: '#/components/schemas/SummaryResultDTO'
1382+
description: Financial data for the given period
1383+
summary: Summaries
1384+
/reports/transactions:
1385+
get:
1386+
description: ' Get a paginated list of individual transactions of a specific
1387+
type processed by the liquidity provider within a specified time period'
1388+
parameters:
1389+
- description: 'Transaction type filter: ''pegin'' or ''pegout'''
1390+
in: query
1391+
name: type
1392+
required: true
1393+
schema:
1394+
description: 'Transaction type filter: ''pegin'' or ''pegout'''
1395+
format: string
1396+
type: string
1397+
- description: Start date for the report. Supports YYYY-MM-DD (expands to full
1398+
day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1399+
in: query
1400+
name: startDate
1401+
schema:
1402+
description: Start date for the report. Supports YYYY-MM-DD (expands to
1403+
full day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1404+
format: string
1405+
type: string
1406+
- description: End date for the report. Supports YYYY-MM-DD (expands to end
1407+
of day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1408+
in: query
1409+
name: endDate
1410+
schema:
1411+
description: End date for the report. Supports YYYY-MM-DD (expands to end
1412+
of day) or ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ)
1413+
format: string
1414+
type: string
1415+
- description: 'Page number to retrieve (1-indexed, default: 1)'
1416+
in: query
1417+
name: page
1418+
schema:
1419+
description: 'Page number to retrieve (1-indexed, default: 1)'
1420+
format: int64
1421+
type: integer
1422+
- description: 'Number of transactions per page (max: 100, default: 10)'
1423+
in: query
1424+
name: perPage
1425+
schema:
1426+
description: 'Number of transactions per page (max: 100, default: 10)'
1427+
format: int64
1428+
type: integer
1429+
responses:
1430+
"200":
1431+
content:
1432+
application/json:
1433+
schema:
1434+
$ref: '#/components/schemas/GetTransactionsResponse'
1435+
description: Paginated list of transactions with metadata
1436+
summary: Get Transaction Reports
11881437
/userQuotes:
11891438
get:
11901439
description: ' Returns user quotes for address.'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,4 @@ The service can be configured to monitor other addresses by modifying the `MONIT
195195

196196
If you're looking forward to integrate with Flyover Protocol then you can check the [Flyover SDK repository](https://github.com/rsksmart/flyover-sdk/blob/main/README.md).
197197

198-
If you're interested in becoming a liquidity provider then you can read the [Liquidity Provider Management](https://github.com/rsksmart/liquidity-provider-server/blob/master/docs/LP-Management.md) file.
198+
If you're interested in becoming a liquidity provider then you can read the [Liquidity Provider Management](https://github.com/rsksmart/liquidity-provider-server/blob/master/docs/LP-Management.md) file.

docker-compose/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ docker-compose --env-file .env.testnet up -d
3030

3131
:::danger[Troubleshooting]
3232
Encountering difficulties with the Docker setup or Flyover issues? Join the [Rootstock Discord community](http://discord.gg/rootstock) for expert support and assistance. Our dedicated team is ready to help you resolve any problems you may encounter.
33-
:::
33+
:::

docs/DESIGN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ _Figure 2 - Fast bridge interactions when the call on behalf of the user is unsu
3535

3636
![Flyover Sequence Diagram](https://raw.githubusercontent.com/rsksmart/liquidity-provider-server/master/docs/diagrams/flyover-ad-no-call.png)
3737

38-
_Figure 3 - Fast bridge interactions when the LP fails to call the LBC on behalf of the user. The LBC slashes the LP's collateral and refunds the user on the refund RSK address._
38+
_Figure 3 - Fast bridge interactions when the LP fails to call the LBC on behalf of the user. The LBC slashes the LP's collateral and refunds the user on the refund RSK address._

docs/LP-Management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,4 @@ In this option, the LPS will get the secrets from AWS Secrets Manager service, w
139139
Encountering difficulties with the SDK setup, LPS configuration, or specific Flyover issues? Join the [Rootstock Discord community](http://discord.gg/rootstock) for expert support and assistance. Our dedicated team is ready to help you resolve any problems you may encounter.
140140
:::
141141

142-
---
142+
---

internal/adapters/dataproviders/database/mongo/common.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ package mongo
22

33
import (
44
"context"
5-
log "github.com/sirupsen/logrus"
65
"time"
6+
7+
log "github.com/sirupsen/logrus"
78
)
89

910
const (
10-
DbName = "flyover"
11+
DbName = "flyover"
12+
SortAscending = 1
1113
)
1214

1315
type DbInteraction string

internal/adapters/dataproviders/database/mongo/liquidity_provider.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import (
1111
"go.mongodb.org/mongo-driver/mongo/options"
1212
)
1313

14-
const LiquidityProviderCollection = "liquidityProvider"
14+
const (
15+
LiquidityProviderCollection = "liquidityProvider"
16+
)
1517

1618
type ConfigurationName string
1719

0 commit comments

Comments
 (0)