@merkl/api 0.19.36 → 0.19.38
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/database/api/.generated/drizzle/schema.d.ts +90 -5
- package/dist/database/api/.generated/drizzle/schema.js +7 -2
- package/dist/database/api/.generated/drizzle/schema.ts +7 -2
- package/dist/database/api/.generated/edge.js +13 -3
- package/dist/database/api/.generated/index-browser.js +10 -0
- package/dist/database/api/.generated/index.d.ts +296 -40
- package/dist/database/api/.generated/index.js +13 -3
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +6 -1
- package/dist/database/api/.generated/wasm.js +10 -0
- package/dist/src/eden/index.d.ts +20 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/factoryFinder.js +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Compound.d.ts +1 -2
- package/dist/src/engine/opportunityMetadata/implementations/Compound.js +1 -4
- package/dist/src/engine/opportunityMetadata/implementations/Morpho.d.ts +7 -1
- package/dist/src/engine/opportunityMetadata/implementations/Morpho.js +5 -2
- package/dist/src/index.d.ts +4 -0
- package/dist/src/jobs/pendings.js +4 -1
- package/dist/src/jobs/reward-breakdowns.js +3 -0
- package/dist/src/modules/v4/apr/apr.model.d.ts +1 -1
- package/dist/src/modules/v4/computedValue/computedValue.controller.d.ts +1 -0
- package/dist/src/modules/v4/computedValue/computedValue.repository.d.ts +1 -0
- package/dist/src/modules/v4/computedValue/computedValue.repository.js +2 -0
- package/dist/src/modules/v4/computedValue/computedValue.service.d.ts +2 -0
- package/dist/src/modules/v4/computedValue/computedValue.service.js +3 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +17 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +2 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +9 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +2 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +8 -6
- package/dist/src/modules/v4/reward/reward.model.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.repository.d.ts +4 -2
- package/dist/src/modules/v4/reward/reward.repository.js +1 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +8 -2
- package/dist/src/modules/v4/reward/reward.service.js +4 -1
- package/dist/src/modules/v4/router.d.ts +4 -0
- package/dist/src/modules/v4/tvl/tvl.model.d.ts +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -74,6 +74,7 @@ model CampaignComputedValue {
|
|
74
74
|
|
75
75
|
model UserComputedValue {
|
76
76
|
id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
|
77
|
+
stringId String @default("")
|
77
78
|
campaignId String
|
78
79
|
Campaign Campaign @relation(fields: [campaignId], references: [id])
|
79
80
|
address String @db.Char(42)
|
@@ -194,6 +195,7 @@ model AprRecord {
|
|
194
195
|
|
195
196
|
model AprBreakdown {
|
196
197
|
id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
|
198
|
+
uuid String @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
197
199
|
identifier String
|
198
200
|
type AprType
|
199
201
|
value Float
|
@@ -218,6 +220,7 @@ model TVLRecord {
|
|
218
220
|
|
219
221
|
model TVLBreakdown {
|
220
222
|
id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
|
223
|
+
uuid String @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
221
224
|
identifier String
|
222
225
|
type TvlType
|
223
226
|
value Float
|
@@ -243,6 +246,7 @@ model DailyRewardsRecord {
|
|
243
246
|
|
244
247
|
model DailyRewardsBreakdown {
|
245
248
|
id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
|
249
|
+
uuid String @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
246
250
|
value Float
|
247
251
|
campaignId String
|
248
252
|
Campaign Campaign @relation(fields: [campaignId], references: [id])
|
@@ -292,7 +296,8 @@ model Reward {
|
|
292
296
|
}
|
293
297
|
|
294
298
|
model RewardBreakdown {
|
295
|
-
id
|
299
|
+
id Int @id @default(autoincrement())
|
300
|
+
stringId String @default("")
|
296
301
|
Protocol Protocol? @relation(fields: [protocolId], references: [id])
|
297
302
|
protocolId String?
|
298
303
|
reason String
|
@@ -158,6 +158,7 @@ exports.Prisma.CampaignComputedValueScalarFieldEnum = {
|
|
158
158
|
|
159
159
|
exports.Prisma.UserComputedValueScalarFieldEnum = {
|
160
160
|
id: 'id',
|
161
|
+
stringId: 'stringId',
|
161
162
|
campaignId: 'campaignId',
|
162
163
|
address: 'address',
|
163
164
|
reason: 'reason',
|
@@ -227,6 +228,7 @@ exports.Prisma.AprRecordScalarFieldEnum = {
|
|
227
228
|
|
228
229
|
exports.Prisma.AprBreakdownScalarFieldEnum = {
|
229
230
|
id: 'id',
|
231
|
+
uuid: 'uuid',
|
230
232
|
identifier: 'identifier',
|
231
233
|
type: 'type',
|
232
234
|
value: 'value',
|
@@ -242,6 +244,7 @@ exports.Prisma.TVLRecordScalarFieldEnum = {
|
|
242
244
|
|
243
245
|
exports.Prisma.TVLBreakdownScalarFieldEnum = {
|
244
246
|
id: 'id',
|
247
|
+
uuid: 'uuid',
|
245
248
|
identifier: 'identifier',
|
246
249
|
type: 'type',
|
247
250
|
value: 'value',
|
@@ -257,6 +260,7 @@ exports.Prisma.DailyRewardsRecordScalarFieldEnum = {
|
|
257
260
|
|
258
261
|
exports.Prisma.DailyRewardsBreakdownScalarFieldEnum = {
|
259
262
|
id: 'id',
|
263
|
+
uuid: 'uuid',
|
260
264
|
value: 'value',
|
261
265
|
campaignId: 'campaignId',
|
262
266
|
dailyRewardsRecordId: 'dailyRewardsRecordId'
|
@@ -287,6 +291,7 @@ exports.Prisma.RewardScalarFieldEnum = {
|
|
287
291
|
|
288
292
|
exports.Prisma.RewardBreakdownScalarFieldEnum = {
|
289
293
|
id: 'id',
|
294
|
+
stringId: 'stringId',
|
290
295
|
protocolId: 'protocolId',
|
291
296
|
reason: 'reason',
|
292
297
|
amount: 'amount',
|
@@ -392,6 +397,7 @@ exports.Prisma.CampaignComputedValueOrderByRelevanceFieldEnum = {
|
|
392
397
|
};
|
393
398
|
|
394
399
|
exports.Prisma.UserComputedValueOrderByRelevanceFieldEnum = {
|
400
|
+
stringId: 'stringId',
|
395
401
|
campaignId: 'campaignId',
|
396
402
|
address: 'address',
|
397
403
|
reason: 'reason'
|
@@ -441,6 +447,7 @@ exports.Prisma.AprRecordOrderByRelevanceFieldEnum = {
|
|
441
447
|
};
|
442
448
|
|
443
449
|
exports.Prisma.AprBreakdownOrderByRelevanceFieldEnum = {
|
450
|
+
uuid: 'uuid',
|
444
451
|
identifier: 'identifier',
|
445
452
|
aprRecordId: 'aprRecordId'
|
446
453
|
};
|
@@ -451,6 +458,7 @@ exports.Prisma.TVLRecordOrderByRelevanceFieldEnum = {
|
|
451
458
|
};
|
452
459
|
|
453
460
|
exports.Prisma.TVLBreakdownOrderByRelevanceFieldEnum = {
|
461
|
+
uuid: 'uuid',
|
454
462
|
identifier: 'identifier',
|
455
463
|
tvlRecordId: 'tvlRecordId'
|
456
464
|
};
|
@@ -461,6 +469,7 @@ exports.Prisma.DailyRewardsRecordOrderByRelevanceFieldEnum = {
|
|
461
469
|
};
|
462
470
|
|
463
471
|
exports.Prisma.DailyRewardsBreakdownOrderByRelevanceFieldEnum = {
|
472
|
+
uuid: 'uuid',
|
464
473
|
campaignId: 'campaignId',
|
465
474
|
dailyRewardsRecordId: 'dailyRewardsRecordId'
|
466
475
|
};
|
@@ -489,6 +498,7 @@ exports.Prisma.RewardOrderByRelevanceFieldEnum = {
|
|
489
498
|
};
|
490
499
|
|
491
500
|
exports.Prisma.RewardBreakdownOrderByRelevanceFieldEnum = {
|
501
|
+
stringId: 'stringId',
|
492
502
|
protocolId: 'protocolId',
|
493
503
|
reason: 'reason',
|
494
504
|
amount: 'amount',
|
package/dist/src/eden/index.d.ts
CHANGED
@@ -495,6 +495,7 @@ declare const eden: {
|
|
495
495
|
breakdowns: {
|
496
496
|
id: number;
|
497
497
|
type: import("@db/api").$Enums.AprType;
|
498
|
+
uuid: string;
|
498
499
|
identifier: string;
|
499
500
|
value: number;
|
500
501
|
aprRecordId: string;
|
@@ -507,6 +508,7 @@ declare const eden: {
|
|
507
508
|
breakdowns: {
|
508
509
|
id: number;
|
509
510
|
type: import("@db/api").$Enums.TvlType;
|
511
|
+
uuid: string;
|
510
512
|
identifier: string;
|
511
513
|
value: number;
|
512
514
|
tvlRecordId: string;
|
@@ -518,6 +520,7 @@ declare const eden: {
|
|
518
520
|
timestamp: bigint;
|
519
521
|
breakdowns: {
|
520
522
|
id: number;
|
523
|
+
uuid: string;
|
521
524
|
value: number;
|
522
525
|
campaignId: string;
|
523
526
|
dailyRewardsRecordId: string;
|
@@ -3664,6 +3667,7 @@ declare const eden: {
|
|
3664
3667
|
id: number;
|
3665
3668
|
reason: string;
|
3666
3669
|
campaignId: string;
|
3670
|
+
stringId: string;
|
3667
3671
|
boost: number | null;
|
3668
3672
|
}[];
|
3669
3673
|
}>>;
|
@@ -4228,6 +4232,7 @@ declare const eden: {
|
|
4228
4232
|
breakdowns: {
|
4229
4233
|
id: number;
|
4230
4234
|
type: import("@db/api").$Enums.AprType;
|
4235
|
+
uuid: string;
|
4231
4236
|
identifier: string;
|
4232
4237
|
value: number;
|
4233
4238
|
aprRecordId: string;
|
@@ -4240,6 +4245,7 @@ declare const eden: {
|
|
4240
4245
|
breakdowns: {
|
4241
4246
|
id: number;
|
4242
4247
|
type: import("@db/api").$Enums.TvlType;
|
4248
|
+
uuid: string;
|
4243
4249
|
identifier: string;
|
4244
4250
|
value: number;
|
4245
4251
|
tvlRecordId: string;
|
@@ -4251,6 +4257,7 @@ declare const eden: {
|
|
4251
4257
|
timestamp: bigint;
|
4252
4258
|
breakdowns: {
|
4253
4259
|
id: number;
|
4260
|
+
uuid: string;
|
4254
4261
|
value: number;
|
4255
4262
|
campaignId: string;
|
4256
4263
|
dailyRewardsRecordId: string;
|
@@ -7397,6 +7404,7 @@ declare const eden: {
|
|
7397
7404
|
id: number;
|
7398
7405
|
reason: string;
|
7399
7406
|
campaignId: string;
|
7407
|
+
stringId: string;
|
7400
7408
|
boost: number | null;
|
7401
7409
|
}[];
|
7402
7410
|
}>>;
|
@@ -8413,6 +8421,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
8413
8421
|
breakdowns: {
|
8414
8422
|
id: number;
|
8415
8423
|
type: import("@db/api").$Enums.AprType;
|
8424
|
+
uuid: string;
|
8416
8425
|
identifier: string;
|
8417
8426
|
value: number;
|
8418
8427
|
aprRecordId: string;
|
@@ -8425,6 +8434,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
8425
8434
|
breakdowns: {
|
8426
8435
|
id: number;
|
8427
8436
|
type: import("@db/api").$Enums.TvlType;
|
8437
|
+
uuid: string;
|
8428
8438
|
identifier: string;
|
8429
8439
|
value: number;
|
8430
8440
|
tvlRecordId: string;
|
@@ -8436,6 +8446,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
8436
8446
|
timestamp: bigint;
|
8437
8447
|
breakdowns: {
|
8438
8448
|
id: number;
|
8449
|
+
uuid: string;
|
8439
8450
|
value: number;
|
8440
8451
|
campaignId: string;
|
8441
8452
|
dailyRewardsRecordId: string;
|
@@ -12698,6 +12709,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
12698
12709
|
id: number;
|
12699
12710
|
reason: string;
|
12700
12711
|
campaignId: string;
|
12712
|
+
stringId: string;
|
12701
12713
|
boost: number | null;
|
12702
12714
|
}[];
|
12703
12715
|
};
|
@@ -14146,6 +14158,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
14146
14158
|
breakdowns: {
|
14147
14159
|
id: number;
|
14148
14160
|
type: import("@db/api").$Enums.AprType;
|
14161
|
+
uuid: string;
|
14149
14162
|
identifier: string;
|
14150
14163
|
value: number;
|
14151
14164
|
aprRecordId: string;
|
@@ -14158,6 +14171,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
14158
14171
|
breakdowns: {
|
14159
14172
|
id: number;
|
14160
14173
|
type: import("@db/api").$Enums.TvlType;
|
14174
|
+
uuid: string;
|
14161
14175
|
identifier: string;
|
14162
14176
|
value: number;
|
14163
14177
|
tvlRecordId: string;
|
@@ -14169,6 +14183,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
14169
14183
|
timestamp: bigint;
|
14170
14184
|
breakdowns: {
|
14171
14185
|
id: number;
|
14186
|
+
uuid: string;
|
14172
14187
|
value: number;
|
14173
14188
|
campaignId: string;
|
14174
14189
|
dailyRewardsRecordId: string;
|
@@ -17315,6 +17330,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
17315
17330
|
id: number;
|
17316
17331
|
reason: string;
|
17317
17332
|
campaignId: string;
|
17333
|
+
stringId: string;
|
17318
17334
|
boost: number | null;
|
17319
17335
|
}[];
|
17320
17336
|
}>>;
|
@@ -17879,6 +17895,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
17879
17895
|
breakdowns: {
|
17880
17896
|
id: number;
|
17881
17897
|
type: import("@db/api").$Enums.AprType;
|
17898
|
+
uuid: string;
|
17882
17899
|
identifier: string;
|
17883
17900
|
value: number;
|
17884
17901
|
aprRecordId: string;
|
@@ -17891,6 +17908,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
17891
17908
|
breakdowns: {
|
17892
17909
|
id: number;
|
17893
17910
|
type: import("@db/api").$Enums.TvlType;
|
17911
|
+
uuid: string;
|
17894
17912
|
identifier: string;
|
17895
17913
|
value: number;
|
17896
17914
|
tvlRecordId: string;
|
@@ -17902,6 +17920,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
17902
17920
|
timestamp: bigint;
|
17903
17921
|
breakdowns: {
|
17904
17922
|
id: number;
|
17923
|
+
uuid: string;
|
17905
17924
|
value: number;
|
17906
17925
|
campaignId: string;
|
17907
17926
|
dailyRewardsRecordId: string;
|
@@ -21048,6 +21067,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
21048
21067
|
id: number;
|
21049
21068
|
reason: string;
|
21050
21069
|
campaignId: string;
|
21070
|
+
stringId: string;
|
21051
21071
|
boost: number | null;
|
21052
21072
|
}[];
|
21053
21073
|
}>>;
|
@@ -19,6 +19,8 @@ const factoryAddresses = {
|
|
19
19
|
"0x35A338522a435D46f77Be32C70E215B813D0e3aC": tokenType.pendleYT, // Pendle YT Factory
|
20
20
|
"0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73": tokenType.pancakeswap, // PancakeSwap Factory BNB
|
21
21
|
"0x70ee0A6DB4F5a2Dc4d9c0b57bE97B9987e75BAFD": tokenType.pendleYT, // Pendle YT Factory
|
22
|
+
"0x0582D93FD9c9d42f26bE5D86a5f75291F92102C2": tokenType.pendleYT, // Pendle Factory
|
23
|
+
"0xFeE31A6eC6eBefa0b5A594Bf5b1139e3c6fAA0fB": tokenType.pendle, // Pendle Factory
|
22
24
|
"0xFD513630F697A9C1731F196185fb9ebA6eAAc20B": tokenType.cpmmGamma, // CPMMGAMMA Factory
|
23
25
|
"0x9Ad6C38BE94206cA50bb0d90783181662f0Cfa10": tokenType.traderJoe, // Trader Joe Factory
|
24
26
|
"0x5Ea9DD3b6f042A34Df818C6c1324BC5A7c61427a": tokenType.curve, // Curve Corn 2crypto Factory
|
@@ -11,8 +11,7 @@ export declare class CompoundMetadata implements MetadataBuilder<campaignType> {
|
|
11
11
|
address: any;
|
12
12
|
}[];
|
13
13
|
mainProtocol: ProtocolId;
|
14
|
-
depositUrl:
|
14
|
+
depositUrl: undefined;
|
15
15
|
}>;
|
16
|
-
static generateUrl(_computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): string;
|
17
16
|
}
|
18
17
|
export {};
|
@@ -16,10 +16,7 @@ export class CompoundMetadata {
|
|
16
16
|
{ chainId: computeChainId, address: params.targetToken },
|
17
17
|
],
|
18
18
|
mainProtocol: camelToKebabCase(CompFork[params.compFork].replace(/\/?(V(\d+_)?\d+)/g, "")),
|
19
|
-
depositUrl:
|
19
|
+
depositUrl: undefined, // TODO, shall depend on compFork
|
20
20
|
};
|
21
21
|
}
|
22
|
-
static generateUrl(_computeChainId, params) {
|
23
|
-
return `https://www.compound.blue/${params.targetToken.toLowerCase()}}`;
|
24
|
-
}
|
25
22
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
|
2
2
|
import { type Campaign as CampaignEnum, type CampaignParameters, type ChainId } from "@sdk";
|
3
|
+
import type { BigNumberish } from "ethers";
|
3
4
|
import type { MetadataBuilder } from "../interface";
|
4
5
|
type campaignType = CampaignEnum.MORPHO;
|
5
6
|
export declare class MorphoMetadata implements MetadataBuilder<campaignType> {
|
@@ -13,6 +14,11 @@ export declare class MorphoMetadata implements MetadataBuilder<campaignType> {
|
|
13
14
|
mainProtocol: ProtocolId;
|
14
15
|
depositUrl: string | undefined;
|
15
16
|
}>;
|
16
|
-
static generateUrl(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"],
|
17
|
+
static generateUrl(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], morphoParams: {
|
18
|
+
nameTargetToken: string;
|
19
|
+
symbolLoanToken: string;
|
20
|
+
symbolBorrowToken: string;
|
21
|
+
LLTV: BigNumberish;
|
22
|
+
}, subType: CampaignParameters<campaignType>["campaignSubType"]): string | undefined;
|
17
23
|
}
|
18
24
|
export {};
|
@@ -16,12 +16,15 @@ export class MorphoMetadata {
|
|
16
16
|
tokens: [{ chainId: computeChainId, address: params.targetToken }],
|
17
17
|
name: subtype.name,
|
18
18
|
mainProtocol: "morpho",
|
19
|
-
depositUrl: MorphoMetadata.generateUrl(computeChainId, params, subType),
|
19
|
+
depositUrl: MorphoMetadata.generateUrl(computeChainId, params, morphoParams, subType),
|
20
20
|
};
|
21
21
|
}
|
22
|
-
static generateUrl(computeChainId, params, subType) {
|
22
|
+
static generateUrl(computeChainId, params, morphoParams, subType) {
|
23
23
|
switch (subType) {
|
24
24
|
case MorphoSubCampaignType.META: {
|
25
|
+
if (morphoParams.nameTargetToken.toLowerCase().includes("compound")) {
|
26
|
+
return `https://www.compound.blue/${params.targetToken?.toLowerCase()}`;
|
27
|
+
}
|
25
28
|
return `https://app.morpho.org/vault?vault=${params.targetToken}&network=${NETWORK_LABELS[computeChainId]?.toLowerCase()}`;
|
26
29
|
}
|
27
30
|
case MorphoSubCampaignType.SUPPLY_BLUE: {
|
package/dist/src/index.d.ts
CHANGED
@@ -284,6 +284,7 @@ declare const app: Elysia<"", false, {
|
|
284
284
|
breakdowns: {
|
285
285
|
id: number;
|
286
286
|
type: import("@db/api").$Enums.AprType;
|
287
|
+
uuid: string;
|
287
288
|
identifier: string;
|
288
289
|
value: number;
|
289
290
|
aprRecordId: string;
|
@@ -296,6 +297,7 @@ declare const app: Elysia<"", false, {
|
|
296
297
|
breakdowns: {
|
297
298
|
id: number;
|
298
299
|
type: import("@db/api").$Enums.TvlType;
|
300
|
+
uuid: string;
|
299
301
|
identifier: string;
|
300
302
|
value: number;
|
301
303
|
tvlRecordId: string;
|
@@ -307,6 +309,7 @@ declare const app: Elysia<"", false, {
|
|
307
309
|
timestamp: bigint;
|
308
310
|
breakdowns: {
|
309
311
|
id: number;
|
312
|
+
uuid: string;
|
310
313
|
value: number;
|
311
314
|
campaignId: string;
|
312
315
|
dailyRewardsRecordId: string;
|
@@ -4569,6 +4572,7 @@ declare const app: Elysia<"", false, {
|
|
4569
4572
|
id: number;
|
4570
4573
|
reason: string;
|
4571
4574
|
campaignId: string;
|
4575
|
+
stringId: string;
|
4572
4576
|
boost: number | null;
|
4573
4577
|
}[];
|
4574
4578
|
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// ─── Pending Rewards Etl ─────────────────────────────────────────────────────
|
2
2
|
if (!process.env.ENV || !process.env.FILENAME)
|
3
3
|
throw new Error("[ENV]: missing variable");
|
4
|
+
import { RewardService } from "@/modules/v4/reward";
|
4
5
|
import { log } from "@/utils/logger";
|
5
6
|
import { apiDbClient } from "@db";
|
6
7
|
import { NETWORK_LABELS, withRetry } from "@sdk";
|
@@ -175,8 +176,10 @@ const updatePendings = async (data) => {
|
|
175
176
|
if (breakdownToCreate.length > 0) {
|
176
177
|
await apiDbClient.rewardBreakdown.createMany({
|
177
178
|
data: breakdownToCreate.map(x => {
|
178
|
-
const rewardId =
|
179
|
+
const rewardId = RewardService.hashId(data.root, x.recipient, rewardTokenId);
|
180
|
+
const rewardBreakdownId = RewardService.hashBreakdownId(rewardId, campaignId, x.reason);
|
179
181
|
return {
|
182
|
+
stringId: rewardBreakdownId,
|
180
183
|
reason: x.reason,
|
181
184
|
amount: "0",
|
182
185
|
pending: x.pending,
|
@@ -2,6 +2,7 @@
|
|
2
2
|
if (!process.env.DATABASE_API_URL || !process.env.ENV || !process.env.CHAIN_ID || !process.env.ROOT)
|
3
3
|
throw new Error("[ENV]: missing variable");
|
4
4
|
import { BucketService } from "@/modules/v4/bucket/bucket.service";
|
5
|
+
import { RewardService } from "@/modules/v4/reward";
|
5
6
|
import { log } from "@/utils/logger";
|
6
7
|
import { apiDbClient } from "@db";
|
7
8
|
import { S3Client } from "bun";
|
@@ -64,7 +65,9 @@ const transform = (rewardBreakdowns) => {
|
|
64
65
|
const rewardTokenId = Bun.hash(`${process.env.CHAIN_ID}${rewardBreakdowns[i].token}`).toString();
|
65
66
|
const rewardId = Bun.hash(`${process.env.ROOT}${rewardBreakdowns[i].recipient}${rewardTokenId}`).toString();
|
66
67
|
const campaignId = Bun.hash(`${process.env.CHAIN_ID}${rewardBreakdowns[i].campaignId}`).toString();
|
68
|
+
const rewardBreakdownId = RewardService.hashBreakdownId(rewardId, campaignId, rewardBreakdowns[i].reason);
|
67
69
|
transformedBreakdowns[i] = {
|
70
|
+
stringId: rewardBreakdownId,
|
68
71
|
rewardId,
|
69
72
|
protocolId: rewardBreakdowns[i].protocolId ? rewardBreakdowns[i].protocolId : undefined,
|
70
73
|
campaignId,
|
@@ -12,7 +12,7 @@ export type AprRecord = Resource<"AprRecord", "id" | "opportunityId", {
|
|
12
12
|
* @description Describes one apr fraction of record
|
13
13
|
* @see {@link Resource}
|
14
14
|
*/
|
15
|
-
export type AprBreakdown = Resource<"AprBreakdown", "id" | "aprRecordId">;
|
15
|
+
export type AprBreakdown = Resource<"AprBreakdown", "id" | "aprRecordId" | "uuid">;
|
16
16
|
export declare const AprBreakdownResourceDto: import("@sinclair/typebox").TObject<{
|
17
17
|
id: import("@sinclair/typebox").TNumber;
|
18
18
|
type: import("@sinclair/typebox").TEnum<{
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { apiDbClient } from "@db";
|
2
2
|
import { UserRepository } from "../user/user.repository";
|
3
|
+
import { ComputedValueService } from "./computedValue.service";
|
3
4
|
export class ComputedValueRepository {
|
4
5
|
static async findCampaignValue(params) {
|
5
6
|
return await apiDbClient.campaignComputedValue.findUnique({
|
@@ -37,6 +38,7 @@ export class ComputedValueRepository {
|
|
37
38
|
},
|
38
39
|
update: { [item.field]: item.value },
|
39
40
|
create: {
|
41
|
+
stringId: ComputedValueService.hashUserComputedValueId(item.campaignId, item.address, item.reason),
|
40
42
|
campaignId: item.campaignId,
|
41
43
|
address: item.address,
|
42
44
|
reason: item.reason,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { GetCampaignComputedValueModel, GetUserComputedValuesModel, UpsertCampaignComputedValueModel, UpsertUserComputedValuesModel } from "./computedValue.model";
|
2
2
|
export declare abstract class ComputedValueService {
|
3
|
+
static hashUserComputedValueId(campaignId: string, address: string, reason: string): string;
|
3
4
|
static findCampaignValue(params: GetCampaignComputedValueModel): Promise<{
|
4
5
|
averageBoost: number | null;
|
5
6
|
totalDistributedInUSD: number | null;
|
@@ -10,6 +11,7 @@ export declare abstract class ComputedValueService {
|
|
10
11
|
id: number;
|
11
12
|
reason: string;
|
12
13
|
campaignId: string;
|
14
|
+
stringId: string;
|
13
15
|
boost: number | null;
|
14
16
|
}[]>;
|
15
17
|
static upsertUserComputedValues(data: UpsertUserComputedValuesModel): Promise<void>;
|
@@ -2,6 +2,9 @@ import { log } from "@/utils/logger";
|
|
2
2
|
import { CampaignService } from "../campaign";
|
3
3
|
import { ComputedValueRepository } from "./computedValue.repository";
|
4
4
|
export class ComputedValueService {
|
5
|
+
static hashUserComputedValueId(campaignId, address, reason) {
|
6
|
+
return Bun.hash(`${campaignId}${address}${reason}`).toString();
|
7
|
+
}
|
5
8
|
static async findCampaignValue(params) {
|
6
9
|
if (params.campaignId.includes("-") && params.campaignId.startsWith("0x")) {
|
7
10
|
const [campaignId, distributionChain] = params.campaignId.split("-");
|
@@ -139,6 +139,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
139
139
|
breakdowns: {
|
140
140
|
id: number;
|
141
141
|
type: import("@db/api").$Enums.AprType;
|
142
|
+
uuid: string;
|
142
143
|
identifier: string;
|
143
144
|
value: number;
|
144
145
|
aprRecordId: string;
|
@@ -151,6 +152,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
151
152
|
breakdowns: {
|
152
153
|
id: number;
|
153
154
|
type: import("@db/api").$Enums.TvlType;
|
155
|
+
uuid: string;
|
154
156
|
identifier: string;
|
155
157
|
value: number;
|
156
158
|
tvlRecordId: string;
|
@@ -162,6 +164,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
162
164
|
timestamp: bigint;
|
163
165
|
breakdowns: {
|
164
166
|
id: number;
|
167
|
+
uuid: string;
|
165
168
|
value: number;
|
166
169
|
campaignId: string;
|
167
170
|
dailyRewardsRecordId: string;
|
@@ -96,6 +96,7 @@ export declare abstract class OpportunityRepository {
|
|
96
96
|
TvlBreakdown: {
|
97
97
|
id: number;
|
98
98
|
type: import("@db/api").$Enums.TvlType;
|
99
|
+
uuid: string;
|
99
100
|
identifier: string;
|
100
101
|
value: number;
|
101
102
|
tvlRecordId: string;
|
@@ -110,6 +111,7 @@ export declare abstract class OpportunityRepository {
|
|
110
111
|
AprBreakdown: {
|
111
112
|
id: number;
|
112
113
|
type: import("@db/api").$Enums.AprType;
|
114
|
+
uuid: string;
|
113
115
|
identifier: string;
|
114
116
|
value: number;
|
115
117
|
aprRecordId: string;
|
@@ -152,6 +154,7 @@ export declare abstract class OpportunityRepository {
|
|
152
154
|
};
|
153
155
|
} & {
|
154
156
|
id: number;
|
157
|
+
uuid: string;
|
155
158
|
value: number;
|
156
159
|
campaignId: string;
|
157
160
|
dailyRewardsRecordId: string;
|
@@ -235,6 +238,7 @@ export declare abstract class OpportunityRepository {
|
|
235
238
|
TvlBreakdown: {
|
236
239
|
id: number;
|
237
240
|
type: import("@db/api").$Enums.TvlType;
|
241
|
+
uuid: string;
|
238
242
|
identifier: string;
|
239
243
|
value: number;
|
240
244
|
tvlRecordId: string;
|
@@ -249,6 +253,7 @@ export declare abstract class OpportunityRepository {
|
|
249
253
|
AprBreakdown: {
|
250
254
|
id: number;
|
251
255
|
type: import("@db/api").$Enums.AprType;
|
256
|
+
uuid: string;
|
252
257
|
identifier: string;
|
253
258
|
value: number;
|
254
259
|
aprRecordId: string;
|
@@ -291,6 +296,7 @@ export declare abstract class OpportunityRepository {
|
|
291
296
|
};
|
292
297
|
} & {
|
293
298
|
id: number;
|
299
|
+
uuid: string;
|
294
300
|
value: number;
|
295
301
|
campaignId: string;
|
296
302
|
dailyRewardsRecordId: string;
|
@@ -432,6 +438,7 @@ export declare abstract class OpportunityRepository {
|
|
432
438
|
TvlBreakdown: {
|
433
439
|
id: number;
|
434
440
|
type: import("@db/api").$Enums.TvlType;
|
441
|
+
uuid: string;
|
435
442
|
identifier: string;
|
436
443
|
value: number;
|
437
444
|
tvlRecordId: string;
|
@@ -446,6 +453,7 @@ export declare abstract class OpportunityRepository {
|
|
446
453
|
AprBreakdown: {
|
447
454
|
id: number;
|
448
455
|
type: import("@db/api").$Enums.AprType;
|
456
|
+
uuid: string;
|
449
457
|
identifier: string;
|
450
458
|
value: number;
|
451
459
|
aprRecordId: string;
|
@@ -488,6 +496,7 @@ export declare abstract class OpportunityRepository {
|
|
488
496
|
};
|
489
497
|
} & {
|
490
498
|
id: number;
|
499
|
+
uuid: string;
|
491
500
|
value: number;
|
492
501
|
campaignId: string;
|
493
502
|
dailyRewardsRecordId: string;
|
@@ -578,6 +587,7 @@ export declare abstract class OpportunityRepository {
|
|
578
587
|
TvlBreakdown: {
|
579
588
|
id: number;
|
580
589
|
type: import("@db/api").$Enums.TvlType;
|
590
|
+
uuid: string;
|
581
591
|
identifier: string;
|
582
592
|
value: number;
|
583
593
|
tvlRecordId: string;
|
@@ -592,6 +602,7 @@ export declare abstract class OpportunityRepository {
|
|
592
602
|
AprBreakdown: {
|
593
603
|
id: number;
|
594
604
|
type: import("@db/api").$Enums.AprType;
|
605
|
+
uuid: string;
|
595
606
|
identifier: string;
|
596
607
|
value: number;
|
597
608
|
aprRecordId: string;
|
@@ -634,6 +645,7 @@ export declare abstract class OpportunityRepository {
|
|
634
645
|
};
|
635
646
|
} & {
|
636
647
|
id: number;
|
648
|
+
uuid: string;
|
637
649
|
value: number;
|
638
650
|
campaignId: string;
|
639
651
|
dailyRewardsRecordId: string;
|
@@ -775,6 +787,7 @@ export declare abstract class OpportunityRepository {
|
|
775
787
|
TvlBreakdown: {
|
776
788
|
id: number;
|
777
789
|
type: import("@db/api").$Enums.TvlType;
|
790
|
+
uuid: string;
|
778
791
|
identifier: string;
|
779
792
|
value: number;
|
780
793
|
tvlRecordId: string;
|
@@ -789,6 +802,7 @@ export declare abstract class OpportunityRepository {
|
|
789
802
|
AprBreakdown: {
|
790
803
|
id: number;
|
791
804
|
type: import("@db/api").$Enums.AprType;
|
805
|
+
uuid: string;
|
792
806
|
identifier: string;
|
793
807
|
value: number;
|
794
808
|
aprRecordId: string;
|
@@ -831,6 +845,7 @@ export declare abstract class OpportunityRepository {
|
|
831
845
|
};
|
832
846
|
} & {
|
833
847
|
id: number;
|
848
|
+
uuid: string;
|
834
849
|
value: number;
|
835
850
|
campaignId: string;
|
836
851
|
dailyRewardsRecordId: string;
|
@@ -878,6 +893,7 @@ export declare abstract class OpportunityRepository {
|
|
878
893
|
TvlBreakdown: {
|
879
894
|
id: number;
|
880
895
|
type: import("@db/api").$Enums.TvlType;
|
896
|
+
uuid: string;
|
881
897
|
identifier: string;
|
882
898
|
value: number;
|
883
899
|
tvlRecordId: string;
|
@@ -891,6 +907,7 @@ export declare abstract class OpportunityRepository {
|
|
891
907
|
dailyRewardsRecord: {
|
892
908
|
DailyRewardsBreakdown: {
|
893
909
|
id: number;
|
910
|
+
uuid: string;
|
894
911
|
value: number;
|
895
912
|
campaignId: string;
|
896
913
|
dailyRewardsRecordId: string;
|