@merkl/api 0.10.272 → 0.10.274

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.
@@ -35,6 +35,8 @@ export declare const campaignTypeToEnumMap: {
35
35
  readonly UNISWAP_V4: any;
36
36
  readonly EIGENLAYER: any;
37
37
  readonly VEST: any;
38
+ readonly ERC20LOGPROCESSOR: any;
39
+ readonly ERC20REBASELOGPROCESSOR: any;
38
40
  readonly ION: any;
39
41
  readonly ERC20TRANSFERS: any;
40
42
  };
@@ -22,6 +22,8 @@ export const campaignTypeToEnumMap = {
22
22
  UNISWAP_V4: CampaignTypeEnum.UNISWAP_V4,
23
23
  EIGENLAYER: CampaignTypeEnum.EIGENLAYER,
24
24
  VEST: CampaignTypeEnum.VEST,
25
+ ERC20LOGPROCESSOR: CampaignTypeEnum.ERC20LOGPROCESSOR,
26
+ ERC20REBASELOGPROCESSOR: CampaignTypeEnum.ERC20REBASELOGPROCESSOR,
25
27
  ION: CampaignTypeEnum.ION,
26
28
  ERC20TRANSFERS: CampaignTypeEnum.ERC20TRANSFERS,
27
29
  };
@@ -224,8 +224,10 @@ export class OpportunityService {
224
224
  }))?.[0] ?? undefined)
225
225
  : {
226
226
  cumulated: 0,
227
- timestamp: AprRecords[0].timestamp,
228
- breakdowns: [{ ...AprRecords[0].AprBreakdown[0], value: 0 }],
227
+ timestamp: AprRecords?.[0]?.timestamp ?? 0n,
228
+ breakdowns: !AprRecords?.[0]?.AprBreakdown?.[0]
229
+ ? []
230
+ : [{ ...AprRecords?.[0]?.AprBreakdown?.[0], value: 0 }],
229
231
  },
230
232
  tvlRecord: TvlRecords?.map(({ id, total, timestamp, TvlBreakdown: breakdowns }) => ({
231
233
  id,
@@ -1,5 +1,5 @@
1
1
  import { log } from "../../../utils/logger";
2
- import { Campaign, DistributorService, NETWORK_LABELS, } from "@sdk";
2
+ import { Campaign, DAY, DistributorService, NETWORK_LABELS, } from "@sdk";
3
3
  import moment from "moment";
4
4
  import { BlacklistService } from "../blacklist";
5
5
  import { CacheService } from "../cache";
@@ -313,11 +313,12 @@ export class RewardService {
313
313
  for (const { amount, rewardToken: address, chainId, startTimestamp: start, endTimestamp: end, campaignId, } of dynamicData) {
314
314
  const timespan = Math.abs(end - start);
315
315
  const isWithinTimespan = moment().unix() > start && moment().unix() < end;
316
- const dayspan = Math.max(1, Math.floor(timespan / (60 * 60 * 24)));
316
+ const dayspan = Math.max(1, Math.floor(timespan / DAY));
317
317
  const dailyAmount = isWithinTimespan ? BigInt(amount) / BigInt(dayspan) : BigInt(0);
318
+ const campaignIdInDb = CampaignService.hashId({ campaignId, distributionChain: chainId });
318
319
  const campaignDailyValue = await TokenService.getValue([{ amount: dailyAmount, address, chainId }]);
319
320
  breakdowns.push({
320
- campaignId: CampaignService.hashId({ campaignId, distributionChain: chainId }),
321
+ campaignId: campaignIdInDb,
321
322
  value: campaignDailyValue,
322
323
  amount: dailyAmount,
323
324
  token: await TokenService.findUniqueOrThrow({