@merkl/api 0.10.134 → 0.10.136

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.
@@ -20,11 +20,13 @@ export async function CompoundDynamicData(_chainId, campaigns) {
20
20
  target: campaign.campaignParameters.targetToken,
21
21
  });
22
22
  }
23
- calls.push({
24
- allowFailure: true,
25
- callData: CTokenInterface.encodeFunctionData("totalBorrows"),
26
- target: campaign.campaignParameters.targetToken,
27
- });
23
+ else {
24
+ calls.push({
25
+ allowFailure: true,
26
+ callData: CTokenInterface.encodeFunctionData("totalBorrows"),
27
+ target: campaign.campaignParameters.targetToken,
28
+ });
29
+ }
28
30
  }
29
31
  }
30
32
  return {
@@ -1,4 +1,4 @@
1
- import type { Prisma, Status } from "../../../../database/api/.generated";
1
+ import { type Prisma, Status } from "../../../../database/api/.generated";
2
2
  import { type AprRecord } from "../apr";
3
3
  import { type DailyRewardsRecord } from "../reward";
4
4
  import { type TvlRecord } from "../tvl";
@@ -462,20 +462,6 @@ export declare abstract class OpportunityRepository {
462
462
  apr: number;
463
463
  dailyRewards: number;
464
464
  }>;
465
- static updateApr(id: string, apr: number): Promise<{
466
- name: string;
467
- type: import("../../../../database/api/.generated").$Enums.CampaignType;
468
- id: string;
469
- status: import("../../../../database/api/.generated").$Enums.Status;
470
- tags: string[];
471
- identifier: string;
472
- chainId: number;
473
- action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
474
- mainProtocolId: string | null;
475
- tvl: number;
476
- apr: number;
477
- dailyRewards: number;
478
- }>;
479
465
  static aggregateSum(field: keyof Prisma.OpportunitySumAggregateInputType, query: GetOpportunitiesQueryEntity): Promise<{
480
466
  sum: never;
481
467
  }>;
@@ -1,4 +1,5 @@
1
1
  import { apiDbClient } from "../../../utils/prisma";
2
+ import { Status } from "../../../../database/api/.generated";
2
3
  import { AprService } from "../apr";
3
4
  import { RewardService } from "../reward";
4
5
  import { TvlService } from "../tvl";
@@ -209,11 +210,10 @@ export class OpportunityRepository {
209
210
  };
210
211
  }
211
212
  static async updateStatus(id, status) {
213
+ if (status === Status.PAST)
214
+ return await apiDbClient.opportunity.update({ where: { id }, data: { status, apr: 0, dailyRewards: 0 } });
212
215
  return await apiDbClient.opportunity.update({ where: { id }, data: { status } });
213
216
  }
214
- static async updateApr(id, apr) {
215
- return await apiDbClient.opportunity.update({ where: { id }, data: { apr } });
216
- }
217
217
  static async aggregateSum(field, query) {
218
218
  const args = OpportunityRepository.#transformQueryToPrismaFilters(query);
219
219
  const result = await apiDbClient.opportunity.aggregate({
@@ -84,7 +84,6 @@ export class OpportunityService {
84
84
  for (const opp of opportunities) {
85
85
  const { live: activeCampaigns, soon: futureCampaigns } = CampaignService.splitOnStatus(opp.Campaigns);
86
86
  if (activeCampaigns.length === 0) {
87
- await OpportunityRepository.updateApr(opp.id, 0);
88
87
  await OpportunityRepository.updateStatus(opp.id, futureCampaigns.length === 0 ? "PAST" : "SOON").catch(err => log.error("Cannot update opportunity status to PAST", err, "opportunities"));
89
88
  }
90
89
  if (opp.status !== "LIVE" && activeCampaigns.length !== 0)