@merkl/api 0.20.141 → 0.20.143

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.
@@ -32,7 +32,10 @@ export class EulerTVLBuilder {
32
32
  chainId: computeChainId,
33
33
  address: underlylingTokenAddress,
34
34
  });
35
- const tvl = (bigIntToNumber(totalAssets, underlyingToken.decimals) ?? 0) * (underlyingToken.price ?? 0);
35
+ if (!underlyingToken.decimals || !underlyingToken.price) {
36
+ throw new Error(`Missing decimals or price for token ${underlylingTokenAddress}`);
37
+ }
38
+ const tvl = bigIntToNumber(totalAssets, underlyingToken.decimals) * underlyingToken.price;
36
39
  tvls.push({
37
40
  campaign,
38
41
  tvl,
@@ -80,7 +80,6 @@ export class Erc20TVLBuilder {
80
80
  throw new Error("Erc20TVLBuilder: dynamicDataList.length !== campaignsOfSubType.length");
81
81
  }
82
82
  for (const [index, dynamicData] of dynamicDataList.entries()) {
83
- console.log(dynamicData);
84
83
  tvls.push({
85
84
  campaign: campaignsOfSubType[index],
86
85
  tvl: dynamicData.tvl,
@@ -29,6 +29,7 @@ export class DynamicDataService {
29
29
  throw new InvalidParameter(`Campaign ${campaign.campaignId} is not of type ${type} on chain ${chainId}`);
30
30
  }
31
31
  }
32
+ const initialOpportunityIds = new Set(campaigns.map(c => OpportunityService.hashId({ chainId, identifier: c.mainParameter, type: CampaignType[+type] }))).size;
32
33
  // 2 - If the new dynamic data builder is available, use it
33
34
  const builder = campaignTVLBuilderFactory(type);
34
35
  if (!!builder) {
@@ -182,7 +183,7 @@ export class DynamicDataService {
182
183
  });
183
184
  }
184
185
  }
185
- log.info(`[${NETWORK_LABELS[chainId]}][${CampaignType[type]}] updated ${updates.length}/${campaigns.length} campaigns using campaignTVLBuilder`);
186
+ log.info(`[${NETWORK_LABELS[chainId]}][${CampaignType[type]}] updated ${updates.length}/${initialOpportunityIds} opportunities using campaignTVLBuilder`);
186
187
  }
187
188
  return updates;
188
189
  }