@dhedge/backend-flatcoin-core 0.2.71 → 0.2.73
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.
|
@@ -3,8 +3,8 @@ export declare class ProtocolMetrics {
|
|
|
3
3
|
id: number;
|
|
4
4
|
unitDepositsVolume: BigNumber;
|
|
5
5
|
unitWithdrawalsVolume: BigNumber;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
leverageTotalVolumeUsd: number;
|
|
7
|
+
leverageWeekVolumeUsd: number;
|
|
8
|
+
leverageMonthVolumeUsd: number;
|
|
9
9
|
blockSynced: number;
|
|
10
10
|
}
|
|
@@ -29,17 +29,35 @@ __decorate([
|
|
|
29
29
|
__metadata("design:type", ethers_1.BigNumber)
|
|
30
30
|
], ProtocolMetrics.prototype, "unitWithdrawalsVolume", void 0);
|
|
31
31
|
__decorate([
|
|
32
|
-
(0, typeorm_1.Column)({
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
(0, typeorm_1.Column)({
|
|
33
|
+
name: 'leverage_total_volume_usd',
|
|
34
|
+
type: 'decimal',
|
|
35
|
+
precision: 30,
|
|
36
|
+
scale: 2,
|
|
37
|
+
transformer: utils_1.numericTransformer,
|
|
38
|
+
}),
|
|
39
|
+
__metadata("design:type", Number)
|
|
40
|
+
], ProtocolMetrics.prototype, "leverageTotalVolumeUsd", void 0);
|
|
35
41
|
__decorate([
|
|
36
|
-
(0, typeorm_1.Column)({
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
(0, typeorm_1.Column)({
|
|
43
|
+
name: 'leverage_week_volume_usd',
|
|
44
|
+
type: 'decimal',
|
|
45
|
+
precision: 30,
|
|
46
|
+
scale: 2,
|
|
47
|
+
transformer: utils_1.numericTransformer,
|
|
48
|
+
}),
|
|
49
|
+
__metadata("design:type", Number)
|
|
50
|
+
], ProtocolMetrics.prototype, "leverageWeekVolumeUsd", void 0);
|
|
39
51
|
__decorate([
|
|
40
|
-
(0, typeorm_1.Column)({
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
(0, typeorm_1.Column)({
|
|
53
|
+
name: 'leverage_month_volume_usd',
|
|
54
|
+
type: 'decimal',
|
|
55
|
+
precision: 30,
|
|
56
|
+
scale: 2,
|
|
57
|
+
transformer: utils_1.numericTransformer,
|
|
58
|
+
}),
|
|
59
|
+
__metadata("design:type", Number)
|
|
60
|
+
], ProtocolMetrics.prototype, "leverageMonthVolumeUsd", void 0);
|
|
43
61
|
__decorate([
|
|
44
62
|
(0, typeorm_1.Column)({ name: 'block_synced', type: 'numeric', precision: 25, transformer: utils_1.numericTransformer }),
|
|
45
63
|
__metadata("design:type", Number)
|
|
@@ -25,7 +25,7 @@ let ProtocolMetricsRepository = class ProtocolMetricsRepository {
|
|
|
25
25
|
return this.repository.save(protocolMetrics);
|
|
26
26
|
}
|
|
27
27
|
async getLatestRecord() {
|
|
28
|
-
return this.repository.createQueryBuilder().
|
|
28
|
+
return this.repository.createQueryBuilder().limit(1).getOne();
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
exports.ProtocolMetricsRepository = ProtocolMetricsRepository;
|
|
@@ -2,8 +2,10 @@ import { Logger } from '@nestjs/common';
|
|
|
2
2
|
export declare class NotificationService {
|
|
3
3
|
private readonly logger;
|
|
4
4
|
private readonly slackUri;
|
|
5
|
+
private readonly slackEmergencyUri;
|
|
5
6
|
private readonly telegramUri;
|
|
6
7
|
constructor(logger: Logger);
|
|
7
8
|
sendSlackNotification(message: string, slackUri?: string): Promise<void>;
|
|
9
|
+
sendSlackEmergencyNotification(message: string, slackUri?: string): Promise<void>;
|
|
8
10
|
sendTelegramNotification(message: string): Promise<void>;
|
|
9
11
|
}
|
|
@@ -29,6 +29,11 @@ let NotificationService = class NotificationService {
|
|
|
29
29
|
}
|
|
30
30
|
else
|
|
31
31
|
this.logger.warn('NotificationService -> env property TELEGRAM_CHANNEL is not provided');
|
|
32
|
+
if (process.env.SLACK_EMERGENCY_CHANNEL) {
|
|
33
|
+
this.slackEmergencyUri = process.env.SLACK_EMERGENCY_CHANNEL;
|
|
34
|
+
}
|
|
35
|
+
else
|
|
36
|
+
this.logger.warn('NotificationService -> env property SLACK_EMERGENCY_CHANNEL is not provided');
|
|
32
37
|
}
|
|
33
38
|
async sendSlackNotification(message, slackUri = this.slackUri) {
|
|
34
39
|
try {
|
|
@@ -38,6 +43,14 @@ let NotificationService = class NotificationService {
|
|
|
38
43
|
this.logger.error(`Error sending notification '${message}' to slack channel ${process.env.SLACK_CHANNEL}`, error);
|
|
39
44
|
}
|
|
40
45
|
}
|
|
46
|
+
async sendSlackEmergencyNotification(message, slackUri = this.slackEmergencyUri) {
|
|
47
|
+
try {
|
|
48
|
+
await axios_1.default.post(slackUri, { text: message });
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
this.logger.error(`Error sending notification '${message}' to slack channel ${process.env.SLACK_EMERGENCY_CHANNEL}`, error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
41
54
|
async sendTelegramNotification(message) {
|
|
42
55
|
if (this.telegramUri) {
|
|
43
56
|
try {
|