@merkl/api 0.19.37 → 0.19.39

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.
Files changed (37) hide show
  1. package/dist/database/api/.generated/drizzle/schema.d.ts +124 -5
  2. package/dist/database/api/.generated/drizzle/schema.js +9 -2
  3. package/dist/database/api/.generated/drizzle/schema.ts +9 -2
  4. package/dist/database/api/.generated/edge.js +17 -3
  5. package/dist/database/api/.generated/index-browser.js +14 -0
  6. package/dist/database/api/.generated/index.d.ts +388 -40
  7. package/dist/database/api/.generated/index.js +17 -3
  8. package/dist/database/api/.generated/package.json +1 -1
  9. package/dist/database/api/.generated/schema.prisma +8 -1
  10. package/dist/database/api/.generated/wasm.js +14 -0
  11. package/dist/src/eden/index.d.ts +25 -0
  12. package/dist/src/engine/opportunityMetadata/implementations/Compound.d.ts +1 -2
  13. package/dist/src/engine/opportunityMetadata/implementations/Compound.js +1 -4
  14. package/dist/src/engine/opportunityMetadata/implementations/Morpho.d.ts +7 -1
  15. package/dist/src/engine/opportunityMetadata/implementations/Morpho.js +5 -2
  16. package/dist/src/index.d.ts +5 -0
  17. package/dist/src/jobs/pendings.js +4 -1
  18. package/dist/src/jobs/reward-breakdowns.js +3 -0
  19. package/dist/src/modules/v4/apr/apr.model.d.ts +1 -1
  20. package/dist/src/modules/v4/computedValue/computedValue.controller.d.ts +2 -0
  21. package/dist/src/modules/v4/computedValue/computedValue.repository.d.ts +2 -0
  22. package/dist/src/modules/v4/computedValue/computedValue.repository.js +2 -0
  23. package/dist/src/modules/v4/computedValue/computedValue.service.d.ts +3 -0
  24. package/dist/src/modules/v4/computedValue/computedValue.service.js +3 -0
  25. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +3 -0
  26. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +17 -0
  27. package/dist/src/modules/v4/opportunity/opportunity.repository.js +2 -0
  28. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +9 -0
  29. package/dist/src/modules/v4/reward/reward.model.d.ts +2 -2
  30. package/dist/src/modules/v4/reward/reward.repository.d.ts +6 -2
  31. package/dist/src/modules/v4/reward/reward.repository.js +1 -0
  32. package/dist/src/modules/v4/reward/reward.service.d.ts +10 -2
  33. package/dist/src/modules/v4/reward/reward.service.js +4 -1
  34. package/dist/src/modules/v4/router.d.ts +5 -0
  35. package/dist/src/modules/v4/tvl/tvl.model.d.ts +1 -1
  36. package/dist/tsconfig.package.tsbuildinfo +1 -1
  37. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-bfb98f5208cec52f8b04cad32a5b5193796c78cce9bb16f814276790b6852e52",
2
+ "name": "prisma-client-8468905cbe3c71008929e6c9c29775ccac921661cf57388037e54f0117d7ef9f",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "index-browser.js",
@@ -74,6 +74,8 @@ 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("")
78
+ uuid String @default(dbgenerated("gen_random_uuid()")) @db.Uuid
77
79
  campaignId String
78
80
  Campaign Campaign @relation(fields: [campaignId], references: [id])
79
81
  address String @db.Char(42)
@@ -194,6 +196,7 @@ model AprRecord {
194
196
 
195
197
  model AprBreakdown {
196
198
  id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
199
+ uuid String @default(dbgenerated("gen_random_uuid()")) @db.Uuid
197
200
  identifier String
198
201
  type AprType
199
202
  value Float
@@ -218,6 +221,7 @@ model TVLRecord {
218
221
 
219
222
  model TVLBreakdown {
220
223
  id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
224
+ uuid String @default(dbgenerated("gen_random_uuid()")) @db.Uuid
221
225
  identifier String
222
226
  type TvlType
223
227
  value Float
@@ -243,6 +247,7 @@ model DailyRewardsRecord {
243
247
 
244
248
  model DailyRewardsBreakdown {
245
249
  id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
250
+ uuid String @default(dbgenerated("gen_random_uuid()")) @db.Uuid
246
251
  value Float
247
252
  campaignId String
248
253
  Campaign Campaign @relation(fields: [campaignId], references: [id])
@@ -292,7 +297,9 @@ model Reward {
292
297
  }
293
298
 
294
299
  model RewardBreakdown {
295
- id BigInt @id @default(autoincrement())
300
+ id Int @id @default(autoincrement())
301
+ stringId String @default("")
302
+ uuid String @default(dbgenerated("gen_random_uuid()")) @db.Uuid
296
303
  Protocol Protocol? @relation(fields: [protocolId], references: [id])
297
304
  protocolId String?
298
305
  reason String
@@ -158,6 +158,8 @@ exports.Prisma.CampaignComputedValueScalarFieldEnum = {
158
158
 
159
159
  exports.Prisma.UserComputedValueScalarFieldEnum = {
160
160
  id: 'id',
161
+ stringId: 'stringId',
162
+ uuid: 'uuid',
161
163
  campaignId: 'campaignId',
162
164
  address: 'address',
163
165
  reason: 'reason',
@@ -227,6 +229,7 @@ exports.Prisma.AprRecordScalarFieldEnum = {
227
229
 
228
230
  exports.Prisma.AprBreakdownScalarFieldEnum = {
229
231
  id: 'id',
232
+ uuid: 'uuid',
230
233
  identifier: 'identifier',
231
234
  type: 'type',
232
235
  value: 'value',
@@ -242,6 +245,7 @@ exports.Prisma.TVLRecordScalarFieldEnum = {
242
245
 
243
246
  exports.Prisma.TVLBreakdownScalarFieldEnum = {
244
247
  id: 'id',
248
+ uuid: 'uuid',
245
249
  identifier: 'identifier',
246
250
  type: 'type',
247
251
  value: 'value',
@@ -257,6 +261,7 @@ exports.Prisma.DailyRewardsRecordScalarFieldEnum = {
257
261
 
258
262
  exports.Prisma.DailyRewardsBreakdownScalarFieldEnum = {
259
263
  id: 'id',
264
+ uuid: 'uuid',
260
265
  value: 'value',
261
266
  campaignId: 'campaignId',
262
267
  dailyRewardsRecordId: 'dailyRewardsRecordId'
@@ -287,6 +292,8 @@ exports.Prisma.RewardScalarFieldEnum = {
287
292
 
288
293
  exports.Prisma.RewardBreakdownScalarFieldEnum = {
289
294
  id: 'id',
295
+ stringId: 'stringId',
296
+ uuid: 'uuid',
290
297
  protocolId: 'protocolId',
291
298
  reason: 'reason',
292
299
  amount: 'amount',
@@ -392,6 +399,8 @@ exports.Prisma.CampaignComputedValueOrderByRelevanceFieldEnum = {
392
399
  };
393
400
 
394
401
  exports.Prisma.UserComputedValueOrderByRelevanceFieldEnum = {
402
+ stringId: 'stringId',
403
+ uuid: 'uuid',
395
404
  campaignId: 'campaignId',
396
405
  address: 'address',
397
406
  reason: 'reason'
@@ -441,6 +450,7 @@ exports.Prisma.AprRecordOrderByRelevanceFieldEnum = {
441
450
  };
442
451
 
443
452
  exports.Prisma.AprBreakdownOrderByRelevanceFieldEnum = {
453
+ uuid: 'uuid',
444
454
  identifier: 'identifier',
445
455
  aprRecordId: 'aprRecordId'
446
456
  };
@@ -451,6 +461,7 @@ exports.Prisma.TVLRecordOrderByRelevanceFieldEnum = {
451
461
  };
452
462
 
453
463
  exports.Prisma.TVLBreakdownOrderByRelevanceFieldEnum = {
464
+ uuid: 'uuid',
454
465
  identifier: 'identifier',
455
466
  tvlRecordId: 'tvlRecordId'
456
467
  };
@@ -461,6 +472,7 @@ exports.Prisma.DailyRewardsRecordOrderByRelevanceFieldEnum = {
461
472
  };
462
473
 
463
474
  exports.Prisma.DailyRewardsBreakdownOrderByRelevanceFieldEnum = {
475
+ uuid: 'uuid',
464
476
  campaignId: 'campaignId',
465
477
  dailyRewardsRecordId: 'dailyRewardsRecordId'
466
478
  };
@@ -489,6 +501,8 @@ exports.Prisma.RewardOrderByRelevanceFieldEnum = {
489
501
  };
490
502
 
491
503
  exports.Prisma.RewardBreakdownOrderByRelevanceFieldEnum = {
504
+ stringId: 'stringId',
505
+ uuid: 'uuid',
492
506
  protocolId: 'protocolId',
493
507
  reason: 'reason',
494
508
  amount: 'amount',
@@ -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;
@@ -3663,7 +3666,9 @@ declare const eden: {
3663
3666
  200: {
3664
3667
  id: number;
3665
3668
  reason: string;
3669
+ uuid: string;
3666
3670
  campaignId: string;
3671
+ stringId: string;
3667
3672
  boost: number | null;
3668
3673
  }[];
3669
3674
  }>>;
@@ -4228,6 +4233,7 @@ declare const eden: {
4228
4233
  breakdowns: {
4229
4234
  id: number;
4230
4235
  type: import("@db/api").$Enums.AprType;
4236
+ uuid: string;
4231
4237
  identifier: string;
4232
4238
  value: number;
4233
4239
  aprRecordId: string;
@@ -4240,6 +4246,7 @@ declare const eden: {
4240
4246
  breakdowns: {
4241
4247
  id: number;
4242
4248
  type: import("@db/api").$Enums.TvlType;
4249
+ uuid: string;
4243
4250
  identifier: string;
4244
4251
  value: number;
4245
4252
  tvlRecordId: string;
@@ -4251,6 +4258,7 @@ declare const eden: {
4251
4258
  timestamp: bigint;
4252
4259
  breakdowns: {
4253
4260
  id: number;
4261
+ uuid: string;
4254
4262
  value: number;
4255
4263
  campaignId: string;
4256
4264
  dailyRewardsRecordId: string;
@@ -7396,7 +7404,9 @@ declare const eden: {
7396
7404
  200: {
7397
7405
  id: number;
7398
7406
  reason: string;
7407
+ uuid: string;
7399
7408
  campaignId: string;
7409
+ stringId: string;
7400
7410
  boost: number | null;
7401
7411
  }[];
7402
7412
  }>>;
@@ -8413,6 +8423,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
8413
8423
  breakdowns: {
8414
8424
  id: number;
8415
8425
  type: import("@db/api").$Enums.AprType;
8426
+ uuid: string;
8416
8427
  identifier: string;
8417
8428
  value: number;
8418
8429
  aprRecordId: string;
@@ -8425,6 +8436,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
8425
8436
  breakdowns: {
8426
8437
  id: number;
8427
8438
  type: import("@db/api").$Enums.TvlType;
8439
+ uuid: string;
8428
8440
  identifier: string;
8429
8441
  value: number;
8430
8442
  tvlRecordId: string;
@@ -8436,6 +8448,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
8436
8448
  timestamp: bigint;
8437
8449
  breakdowns: {
8438
8450
  id: number;
8451
+ uuid: string;
8439
8452
  value: number;
8440
8453
  campaignId: string;
8441
8454
  dailyRewardsRecordId: string;
@@ -12697,7 +12710,9 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
12697
12710
  200: {
12698
12711
  id: number;
12699
12712
  reason: string;
12713
+ uuid: string;
12700
12714
  campaignId: string;
12715
+ stringId: string;
12701
12716
  boost: number | null;
12702
12717
  }[];
12703
12718
  };
@@ -14146,6 +14161,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
14146
14161
  breakdowns: {
14147
14162
  id: number;
14148
14163
  type: import("@db/api").$Enums.AprType;
14164
+ uuid: string;
14149
14165
  identifier: string;
14150
14166
  value: number;
14151
14167
  aprRecordId: string;
@@ -14158,6 +14174,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
14158
14174
  breakdowns: {
14159
14175
  id: number;
14160
14176
  type: import("@db/api").$Enums.TvlType;
14177
+ uuid: string;
14161
14178
  identifier: string;
14162
14179
  value: number;
14163
14180
  tvlRecordId: string;
@@ -14169,6 +14186,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
14169
14186
  timestamp: bigint;
14170
14187
  breakdowns: {
14171
14188
  id: number;
14189
+ uuid: string;
14172
14190
  value: number;
14173
14191
  campaignId: string;
14174
14192
  dailyRewardsRecordId: string;
@@ -17314,7 +17332,9 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
17314
17332
  200: {
17315
17333
  id: number;
17316
17334
  reason: string;
17335
+ uuid: string;
17317
17336
  campaignId: string;
17337
+ stringId: string;
17318
17338
  boost: number | null;
17319
17339
  }[];
17320
17340
  }>>;
@@ -17879,6 +17899,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
17879
17899
  breakdowns: {
17880
17900
  id: number;
17881
17901
  type: import("@db/api").$Enums.AprType;
17902
+ uuid: string;
17882
17903
  identifier: string;
17883
17904
  value: number;
17884
17905
  aprRecordId: string;
@@ -17891,6 +17912,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
17891
17912
  breakdowns: {
17892
17913
  id: number;
17893
17914
  type: import("@db/api").$Enums.TvlType;
17915
+ uuid: string;
17894
17916
  identifier: string;
17895
17917
  value: number;
17896
17918
  tvlRecordId: string;
@@ -17902,6 +17924,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
17902
17924
  timestamp: bigint;
17903
17925
  breakdowns: {
17904
17926
  id: number;
17927
+ uuid: string;
17905
17928
  value: number;
17906
17929
  campaignId: string;
17907
17930
  dailyRewardsRecordId: string;
@@ -21047,7 +21070,9 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
21047
21070
  200: {
21048
21071
  id: number;
21049
21072
  reason: string;
21073
+ uuid: string;
21050
21074
  campaignId: string;
21075
+ stringId: string;
21051
21076
  boost: number | null;
21052
21077
  }[];
21053
21078
  }>>;
@@ -11,8 +11,7 @@ export declare class CompoundMetadata implements MetadataBuilder<campaignType> {
11
11
  address: any;
12
12
  }[];
13
13
  mainProtocol: ProtocolId;
14
- depositUrl: string;
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: CompoundMetadata.generateUrl(computeChainId, params),
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"], subType: CampaignParameters<campaignType>["campaignSubType"]): string | undefined;
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: {
@@ -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;
@@ -4568,7 +4571,9 @@ declare const app: Elysia<"", false, {
4568
4571
  200: {
4569
4572
  id: number;
4570
4573
  reason: string;
4574
+ uuid: string;
4571
4575
  campaignId: string;
4576
+ stringId: string;
4572
4577
  boost: number | null;
4573
4578
  }[];
4574
4579
  };
@@ -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 = Bun.hash(`${root}${x.recipient}${rewardTokenId}`).toString();
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<{
@@ -53,7 +53,9 @@ export declare const ComputedValueController: Elysia<"/value", false, {
53
53
  200: {
54
54
  id: number;
55
55
  reason: string;
56
+ uuid: string;
56
57
  campaignId: string;
58
+ stringId: string;
57
59
  boost: number | null;
58
60
  }[];
59
61
  };
@@ -9,7 +9,9 @@ export declare abstract class ComputedValueRepository {
9
9
  static findUserValues(data: GetUserComputedValuesModel): Promise<{
10
10
  id: number;
11
11
  reason: string;
12
+ uuid: string;
12
13
  campaignId: string;
14
+ stringId: string;
13
15
  boost: number | null;
14
16
  }[]>;
15
17
  static upsertUserComputedValues(data: UpsertUserComputedValuesModel): Promise<void>;
@@ -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;
@@ -9,7 +10,9 @@ export declare abstract class ComputedValueService {
9
10
  static findUserValues(params: GetUserComputedValuesModel): Promise<{
10
11
  id: number;
11
12
  reason: string;
13
+ uuid: string;
12
14
  campaignId: string;
15
+ stringId: string;
13
16
  boost: number | null;
14
17
  }[]>;
15
18
  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;