@merkl/api 0.17.13 → 0.17.15
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.
@@ -135,9 +135,7 @@ export const campaignCacheUpdate = async (rawChainId, queryCampaignTypes, highCa
|
|
135
135
|
});
|
136
136
|
await OpportunityRepository.updateRecords(opportunityId, apr, tvl, dailyRewards);
|
137
137
|
}
|
138
|
-
catch
|
139
|
-
// console.log(mainParameter);
|
140
|
-
}
|
138
|
+
catch { }
|
141
139
|
}
|
142
140
|
await OpportunityService.updateMetadata(chainId);
|
143
141
|
// ─── Refresh Cache For GET /opportunities ────
|
@@ -46,9 +46,9 @@ export async function MORPHODynamicData(chainId, campaigns) {
|
|
46
46
|
tvl = priceAsset * totalAssets;
|
47
47
|
totalSupplyTargetToken = totalSupply;
|
48
48
|
}
|
49
|
-
if (campaign.
|
50
|
-
campaign.
|
51
|
-
campaign.
|
49
|
+
if (campaign.subType === MorphoSubCampaignType.SUPPLY_BLUE ||
|
50
|
+
campaign.subType === MorphoSubCampaignType.BORROWING_BLUE ||
|
51
|
+
campaign.subType === MorphoSubCampaignType.COLLATERAL_BLUE) {
|
52
52
|
const graphqlQueryMarket = {
|
53
53
|
query: `query MarketByUniqueKey($uniqueKey: String!, $chainId: Int) {
|
54
54
|
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
@@ -314,14 +314,27 @@ export class RewardService {
|
|
314
314
|
const dailyAmount = isWithinTimespan ? BigInt(amount) / BigInt(dayspan) : BigInt(0);
|
315
315
|
const campaignIdInDb = CampaignService.hashId({ campaignId, distributionChain: chainId });
|
316
316
|
const tokenToAmount = new Map();
|
317
|
-
tokenToAmount.set(rewardToken, dailyAmount);
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
317
|
+
tokenToAmount.set(TokenService.hashId({ address: rewardToken, chainId }), dailyAmount);
|
318
|
+
try {
|
319
|
+
let token;
|
320
|
+
try {
|
321
|
+
token = await TokenService.findUniqueOrThrow({ address: rewardToken, chainId });
|
322
|
+
}
|
323
|
+
catch {
|
324
|
+
await TokenService.create(await TokenService.fetchOnChain({ address: rewardToken, chainId }));
|
325
|
+
token = await TokenService.findUniqueOrThrow({ address: rewardToken, chainId });
|
326
|
+
}
|
327
|
+
const campaignDailyValue = await TokenService.getValueByTokenId(tokenToAmount);
|
328
|
+
breakdowns.push({
|
329
|
+
campaignId: campaignIdInDb,
|
330
|
+
value: campaignDailyValue,
|
331
|
+
amount: dailyAmount,
|
332
|
+
token,
|
333
|
+
});
|
334
|
+
}
|
335
|
+
catch (e) {
|
336
|
+
log.warn(`token ${rewardToken} not found`);
|
337
|
+
}
|
325
338
|
}
|
326
339
|
return {
|
327
340
|
timestamp,
|