@dhedge/backend-flatcoin-core 0.1.28 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/enum.d.ts +8 -0
- package/dist/constants/enum.js +10 -1
- package/dist/contracts/abi/flatcoin-errors.js +0 -71
- package/dist/service/error.handler.d.ts +10 -0
- package/dist/service/error.handler.js +55 -0
- package/dist/service/graph-query.service.d.ts +16 -0
- package/dist/service/graph-query.service.js +117 -0
- package/dist/service/index.d.ts +3 -0
- package/dist/service/index.js +3 -0
- package/dist/service/notification.service.d.ts +7 -0
- package/dist/service/notification.service.js +41 -0
- package/dist/utils/shared-types.d.ts +36 -7
- package/dist/utils/shared-types.js +0 -4
- package/package.json +3 -2
package/dist/constants/enum.d.ts
CHANGED
|
@@ -17,3 +17,11 @@ export declare enum LeveragePositionStatus {
|
|
|
17
17
|
CLOSED = "CLOSED",
|
|
18
18
|
LIQUIDATED = "LIQUIDATED"
|
|
19
19
|
}
|
|
20
|
+
export declare enum OrderType {
|
|
21
|
+
NONE = 0,
|
|
22
|
+
STABLE_DEPOSIT = 1,
|
|
23
|
+
STABLE_WITHDRAW = 2,
|
|
24
|
+
LEVERAGE_OPEN = 3,
|
|
25
|
+
LEVERAGE_CLOSE = 4,
|
|
26
|
+
LEVERAGE_ADJUST = 5
|
|
27
|
+
}
|
package/dist/constants/enum.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LeveragePositionStatus = exports.getChartPeriod = exports.HistoricalPeriod = exports.PERIOD_IN_SECONDS = void 0;
|
|
3
|
+
exports.OrderType = exports.LeveragePositionStatus = exports.getChartPeriod = exports.HistoricalPeriod = exports.PERIOD_IN_SECONDS = void 0;
|
|
4
4
|
var HistoricalPeriod;
|
|
5
5
|
(function (HistoricalPeriod) {
|
|
6
6
|
HistoricalPeriod["ONE_DAY"] = "1d";
|
|
@@ -30,3 +30,12 @@ var LeveragePositionStatus;
|
|
|
30
30
|
LeveragePositionStatus["CLOSED"] = "CLOSED";
|
|
31
31
|
LeveragePositionStatus["LIQUIDATED"] = "LIQUIDATED";
|
|
32
32
|
})(LeveragePositionStatus || (exports.LeveragePositionStatus = LeveragePositionStatus = {}));
|
|
33
|
+
var OrderType;
|
|
34
|
+
(function (OrderType) {
|
|
35
|
+
OrderType[OrderType["NONE"] = 0] = "NONE";
|
|
36
|
+
OrderType[OrderType["STABLE_DEPOSIT"] = 1] = "STABLE_DEPOSIT";
|
|
37
|
+
OrderType[OrderType["STABLE_WITHDRAW"] = 2] = "STABLE_WITHDRAW";
|
|
38
|
+
OrderType[OrderType["LEVERAGE_OPEN"] = 3] = "LEVERAGE_OPEN";
|
|
39
|
+
OrderType[OrderType["LEVERAGE_CLOSE"] = 4] = "LEVERAGE_CLOSE";
|
|
40
|
+
OrderType[OrderType["LEVERAGE_ADJUST"] = 5] = "LEVERAGE_ADJUST";
|
|
41
|
+
})(OrderType || (exports.OrderType = OrderType = {}));
|
|
@@ -436,17 +436,6 @@ exports.FlatcoinErrors = [
|
|
|
436
436
|
name: 'PriceImpactDuringWithdraw',
|
|
437
437
|
type: 'error',
|
|
438
438
|
},
|
|
439
|
-
{
|
|
440
|
-
inputs: [
|
|
441
|
-
{
|
|
442
|
-
internalType: 'uint256',
|
|
443
|
-
name: 'executableTime',
|
|
444
|
-
type: 'uint256',
|
|
445
|
-
},
|
|
446
|
-
],
|
|
447
|
-
name: 'ExecutableTimeNotReached',
|
|
448
|
-
type: 'error',
|
|
449
|
-
},
|
|
450
439
|
{
|
|
451
440
|
inputs: [
|
|
452
441
|
{
|
|
@@ -463,17 +452,6 @@ exports.FlatcoinErrors = [
|
|
|
463
452
|
name: 'InvalidThresholds',
|
|
464
453
|
type: 'error',
|
|
465
454
|
},
|
|
466
|
-
{
|
|
467
|
-
inputs: [
|
|
468
|
-
{
|
|
469
|
-
internalType: 'string',
|
|
470
|
-
name: 'variableName',
|
|
471
|
-
type: 'string',
|
|
472
|
-
},
|
|
473
|
-
],
|
|
474
|
-
name: 'InvariantViolation',
|
|
475
|
-
type: 'error',
|
|
476
|
-
},
|
|
477
455
|
{
|
|
478
456
|
inputs: [
|
|
479
457
|
{
|
|
@@ -511,53 +489,4 @@ exports.FlatcoinErrors = [
|
|
|
511
489
|
name: 'ModuleKeyEmpty',
|
|
512
490
|
type: 'error',
|
|
513
491
|
},
|
|
514
|
-
{
|
|
515
|
-
inputs: [
|
|
516
|
-
{
|
|
517
|
-
internalType: 'uint256',
|
|
518
|
-
name: 'tokenId',
|
|
519
|
-
type: 'uint256',
|
|
520
|
-
},
|
|
521
|
-
{
|
|
522
|
-
internalType: 'address',
|
|
523
|
-
name: 'msgSender',
|
|
524
|
-
type: 'address',
|
|
525
|
-
},
|
|
526
|
-
],
|
|
527
|
-
name: 'NotTokenOwner',
|
|
528
|
-
type: 'error',
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
inputs: [
|
|
532
|
-
{
|
|
533
|
-
internalType: 'address',
|
|
534
|
-
name: 'msgSender',
|
|
535
|
-
type: 'address',
|
|
536
|
-
},
|
|
537
|
-
],
|
|
538
|
-
name: 'OnlyAuthorizedModule',
|
|
539
|
-
type: 'error',
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
inputs: [
|
|
543
|
-
{
|
|
544
|
-
internalType: 'address',
|
|
545
|
-
name: 'msgSender',
|
|
546
|
-
type: 'address',
|
|
547
|
-
},
|
|
548
|
-
],
|
|
549
|
-
name: 'OnlyOwner',
|
|
550
|
-
type: 'error',
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
inputs: [
|
|
554
|
-
{
|
|
555
|
-
internalType: 'string',
|
|
556
|
-
name: 'variableName',
|
|
557
|
-
type: 'string',
|
|
558
|
-
},
|
|
559
|
-
],
|
|
560
|
-
name: 'ZeroAddress',
|
|
561
|
-
type: 'error',
|
|
562
|
-
},
|
|
563
492
|
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
2
|
+
import { NotificationService } from './notification.service';
|
|
3
|
+
export declare class ErrorHandler {
|
|
4
|
+
private readonly notificationService;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
private readonly errorInterface;
|
|
7
|
+
constructor(notificationService: NotificationService, logger: Logger);
|
|
8
|
+
handleError(message: string, error: any): Promise<void>;
|
|
9
|
+
getGasEstimateErrorName(gasEstimateError: string): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ErrorHandler = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const notification_service_1 = require("./notification.service");
|
|
15
|
+
const ethers_1 = require("ethers");
|
|
16
|
+
const contracts_1 = require("../contracts");
|
|
17
|
+
let ErrorHandler = class ErrorHandler {
|
|
18
|
+
constructor(notificationService, logger) {
|
|
19
|
+
this.notificationService = notificationService;
|
|
20
|
+
this.logger = logger;
|
|
21
|
+
this.errorInterface = new ethers_1.ethers.utils.Interface(contracts_1.FlatcoinErrors);
|
|
22
|
+
}
|
|
23
|
+
async handleError(message, error) {
|
|
24
|
+
const messageToSlack = `${message}, error ${error?.message}`;
|
|
25
|
+
this.logger.error(messageToSlack, error);
|
|
26
|
+
this.logger.error(error.stack);
|
|
27
|
+
if (process.env.SLACK_NOTIFICATIONS_ENABLED === 'true') {
|
|
28
|
+
await this.notificationService.sendNotification(messageToSlack);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
getGasEstimateErrorName(gasEstimateError) {
|
|
32
|
+
if (!gasEstimateError)
|
|
33
|
+
return '';
|
|
34
|
+
try {
|
|
35
|
+
const jsonStartIndex = gasEstimateError.toString().indexOf('error=') + 6;
|
|
36
|
+
const jsonEndIndex = gasEstimateError.toString().indexOf(', code=');
|
|
37
|
+
if (jsonStartIndex > 0) {
|
|
38
|
+
const errorJSON = JSON.parse(gasEstimateError.toString().slice(jsonStartIndex, jsonEndIndex));
|
|
39
|
+
return this.errorInterface.parseError(errorJSON.error.data).name;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return gasEstimateError;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
this.logger.error("can't get gas estimate error", error);
|
|
47
|
+
return '';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.ErrorHandler = ErrorHandler;
|
|
52
|
+
exports.ErrorHandler = ErrorHandler = __decorate([
|
|
53
|
+
(0, common_1.Injectable)(),
|
|
54
|
+
__metadata("design:paramtypes", [notification_service_1.NotificationService, common_1.Logger])
|
|
55
|
+
], ErrorHandler);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
2
|
+
import { AnnouncedOrder, LeveragePositionEvent } from '../utils';
|
|
3
|
+
import { GraphQLClient } from 'graphql-request';
|
|
4
|
+
export declare class GraphQueryService {
|
|
5
|
+
private readonly graphQLClient;
|
|
6
|
+
private readonly logger;
|
|
7
|
+
constructor(graphQLClient: GraphQLClient, logger: Logger);
|
|
8
|
+
getAnnouncedOrders(timestampFrom: number): Promise<AnnouncedOrder[]>;
|
|
9
|
+
getLeverageOpens(blockFrom: number): Promise<LeveragePositionEvent[]>;
|
|
10
|
+
getLeverageCloses(blockFrom: number): Promise<LeveragePositionEvent[]>;
|
|
11
|
+
getPositionLiquidateds(blockFrom: number): Promise<LeveragePositionEvent[]>;
|
|
12
|
+
}
|
|
13
|
+
export declare const getAnnouncedOrdersQuery: string;
|
|
14
|
+
export declare const getLeverageOpensQuery: string;
|
|
15
|
+
export declare const getLeverageClosesQuery: string;
|
|
16
|
+
export declare const getPositionLiquidatedsQuery: string;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getPositionLiquidatedsQuery = exports.getLeverageClosesQuery = exports.getLeverageOpensQuery = exports.getAnnouncedOrdersQuery = exports.GraphQueryService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const graphql_request_1 = require("graphql-request");
|
|
15
|
+
const constants_1 = require("../constants");
|
|
16
|
+
let GraphQueryService = class GraphQueryService {
|
|
17
|
+
constructor(graphQLClient, logger) {
|
|
18
|
+
this.graphQLClient = graphQLClient;
|
|
19
|
+
this.logger = logger;
|
|
20
|
+
}
|
|
21
|
+
async getAnnouncedOrders(timestampFrom) {
|
|
22
|
+
const variables = { timestamp: timestampFrom.toString() };
|
|
23
|
+
try {
|
|
24
|
+
const response = await this.graphQLClient.request(exports.getAnnouncedOrdersQuery, variables);
|
|
25
|
+
this.logger.log(`Fetched ${response.orderAnnounceds.length} orderAnnounceds events from the graph`);
|
|
26
|
+
return response.orderAnnounceds;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
this.logger.error('Error fetching announced orders from the graph:', error);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async getLeverageOpens(blockFrom) {
|
|
34
|
+
const variables = { fromBlock: blockFrom };
|
|
35
|
+
try {
|
|
36
|
+
const response = await this.graphQLClient.request(exports.getLeverageOpensQuery, variables);
|
|
37
|
+
this.logger.log(`Fetched ${response.leverageOpens.length} leverageOpens events from the graph`);
|
|
38
|
+
response.leverageOpens.forEach((events) => (events.eventType = constants_1.LeveragePositionStatus.OPEN));
|
|
39
|
+
return response.leverageOpens;
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
this.logger.error('Error fetching leverageOpens events from the graph:', error);
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async getLeverageCloses(blockFrom) {
|
|
47
|
+
const variables = { fromBlock: blockFrom };
|
|
48
|
+
try {
|
|
49
|
+
const response = await this.graphQLClient.request(exports.getLeverageClosesQuery, variables);
|
|
50
|
+
this.logger.log(`Fetched ${response.leverageCloses.length} leverageCloses events from the graph`);
|
|
51
|
+
response.leverageCloses.forEach((events) => (events.eventType = constants_1.LeveragePositionStatus.CLOSED));
|
|
52
|
+
return response.leverageCloses;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
this.logger.error('Error fetching leverageCloses events from the graph:', error);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async getPositionLiquidateds(blockFrom) {
|
|
60
|
+
const variables = { fromBlock: blockFrom };
|
|
61
|
+
try {
|
|
62
|
+
const response = await this.graphQLClient.request(exports.getPositionLiquidatedsQuery, variables);
|
|
63
|
+
this.logger.log(`Fetched ${response.positionLiquidateds.length} positionLiquidateds events from the graph`);
|
|
64
|
+
response.positionLiquidateds.forEach((events) => (events.eventType = constants_1.LeveragePositionStatus.LIQUIDATED));
|
|
65
|
+
return response.positionLiquidateds;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
this.logger.error('Error fetching positionLiquidateds events from the graph:', error);
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.GraphQueryService = GraphQueryService;
|
|
74
|
+
exports.GraphQueryService = GraphQueryService = __decorate([
|
|
75
|
+
(0, common_1.Injectable)(),
|
|
76
|
+
__metadata("design:paramtypes", [graphql_request_1.GraphQLClient, common_1.Logger])
|
|
77
|
+
], GraphQueryService);
|
|
78
|
+
exports.getAnnouncedOrdersQuery = (0, graphql_request_1.gql) `
|
|
79
|
+
query GetAnnouncedOrders($timestamp: String) {
|
|
80
|
+
orderAnnounceds(where: { blockTimestamp_gte: $timestamp }) {
|
|
81
|
+
blockNumber
|
|
82
|
+
transactionHash
|
|
83
|
+
orderType
|
|
84
|
+
account
|
|
85
|
+
blockTimestamp
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
exports.getLeverageOpensQuery = (0, graphql_request_1.gql) `
|
|
90
|
+
query GetLeverageOpens($fromBlock: Int) {
|
|
91
|
+
leverageOpens(where: { blockNumber_gt: $fromBlock }) {
|
|
92
|
+
blockNumber
|
|
93
|
+
blockTimestamp
|
|
94
|
+
tokenId
|
|
95
|
+
account
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
exports.getLeverageClosesQuery = (0, graphql_request_1.gql) `
|
|
100
|
+
query GetLeverageCloses($fromBlock: Int) {
|
|
101
|
+
leverageCloses(where: { blockNumber_gt: $fromBlock }) {
|
|
102
|
+
blockNumber
|
|
103
|
+
blockTimestamp
|
|
104
|
+
tokenId
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
exports.getPositionLiquidatedsQuery = (0, graphql_request_1.gql) `
|
|
109
|
+
query GetPositionLiquidateds($fromBlock: Int) {
|
|
110
|
+
positionLiquidateds(where: { blockNumber_gt: $fromBlock }) {
|
|
111
|
+
blockNumber
|
|
112
|
+
blockTimestamp
|
|
113
|
+
tokenId
|
|
114
|
+
liquidator
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
`;
|
package/dist/service/index.d.ts
CHANGED
package/dist/service/index.js
CHANGED
|
@@ -15,3 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./app-price.service"), exports);
|
|
18
|
+
__exportStar(require("./graph-query.service"), exports);
|
|
19
|
+
__exportStar(require("./error.handler"), exports);
|
|
20
|
+
__exportStar(require("./notification.service"), exports);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.NotificationService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
|
18
|
+
let NotificationService = class NotificationService {
|
|
19
|
+
constructor(logger) {
|
|
20
|
+
this.logger = logger;
|
|
21
|
+
if (process.env.SLACK_CHANNEL) {
|
|
22
|
+
this.slackUri = process.env.SLACK_CHANNEL;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
throw new Error('NotificationService -> env property SLACK_CHANNEL is not provided');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async sendNotification(message) {
|
|
29
|
+
try {
|
|
30
|
+
await axios_1.default.post(this.slackUri, { text: message });
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
this.logger.error(`Error sending notification '${message}' to slack channel ${process.env.SLACK_CHANNEL}`, error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.NotificationService = NotificationService;
|
|
38
|
+
exports.NotificationService = NotificationService = __decorate([
|
|
39
|
+
(0, common_1.Injectable)(),
|
|
40
|
+
__metadata("design:paramtypes", [common_1.Logger])
|
|
41
|
+
], NotificationService);
|
|
@@ -5,20 +5,49 @@ export interface DepositEvent {
|
|
|
5
5
|
depositAmount: string;
|
|
6
6
|
mintedAmount: string;
|
|
7
7
|
}
|
|
8
|
-
export interface Deposits {
|
|
9
|
-
deposits: DepositEvent[];
|
|
10
|
-
}
|
|
11
8
|
export interface WithdrawEvent {
|
|
12
9
|
blockNumber: string;
|
|
13
10
|
withdrawer: string;
|
|
14
11
|
withdrawAmount: string;
|
|
15
12
|
burnedAmount: string;
|
|
16
13
|
}
|
|
17
|
-
export interface
|
|
18
|
-
withdraws: WithdrawEvent[];
|
|
19
|
-
}
|
|
20
|
-
export declare class DepositWithdrawAction {
|
|
14
|
+
export interface DepositWithdrawAction {
|
|
21
15
|
isDeposit: boolean;
|
|
22
16
|
blockNumber: number;
|
|
23
17
|
unitAmount: BigNumber;
|
|
24
18
|
}
|
|
19
|
+
export interface AnnouncedOrder {
|
|
20
|
+
blockNumber: number;
|
|
21
|
+
transactionHash: string;
|
|
22
|
+
orderType: string;
|
|
23
|
+
account: string;
|
|
24
|
+
blockTimestamp: number;
|
|
25
|
+
executeInTime: number;
|
|
26
|
+
expirationTime: number;
|
|
27
|
+
}
|
|
28
|
+
export interface LeveragePositionEvent {
|
|
29
|
+
blockNumber: number;
|
|
30
|
+
blockTimestamp: number;
|
|
31
|
+
tokenId: number;
|
|
32
|
+
account: string;
|
|
33
|
+
liquidator: string;
|
|
34
|
+
eventType: string;
|
|
35
|
+
}
|
|
36
|
+
export interface DepositsEventsData {
|
|
37
|
+
deposits: DepositEvent[];
|
|
38
|
+
}
|
|
39
|
+
export interface WithdrawEventsData {
|
|
40
|
+
withdraws: WithdrawEvent[];
|
|
41
|
+
}
|
|
42
|
+
export interface LeverageClosesData {
|
|
43
|
+
leverageCloses: LeveragePositionEvent[];
|
|
44
|
+
}
|
|
45
|
+
export interface LeverageOpensData {
|
|
46
|
+
leverageOpens: LeveragePositionEvent[];
|
|
47
|
+
}
|
|
48
|
+
export interface PositionLiquidatedsData {
|
|
49
|
+
positionLiquidateds: LeveragePositionEvent[];
|
|
50
|
+
}
|
|
51
|
+
export interface AnnouncedOrderData {
|
|
52
|
+
orderAnnounceds: AnnouncedOrder[];
|
|
53
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhedge/backend-flatcoin-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"description": "Backend Flatcoin Core",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"ethers": "5.7.2",
|
|
24
24
|
"nest-winston": "1.9.3",
|
|
25
25
|
"typeorm": "^0.3.17",
|
|
26
|
-
"winston": "3.10.0"
|
|
26
|
+
"winston": "3.10.0",
|
|
27
|
+
"graphql-request": "6.1.0"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@nestjs/testing": "^9.4.3",
|