@merkl/api 0.16.15 → 0.16.17

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 (24) hide show
  1. package/dist/src/eden/index.d.ts +5 -0
  2. package/dist/src/entities/opportunity.js +7 -200
  3. package/dist/src/index.d.ts +1 -0
  4. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +1 -1
  5. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AuraProcessor.d.ts +8 -0
  6. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AuraProcessor.js +10 -12
  7. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerPoolProcessor.d.ts +8 -1
  8. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerPoolProcessor.js +11 -15
  9. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.js +4 -5
  10. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.js +6 -1
  11. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.js +1 -0
  12. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/VicunaProcessor.js +0 -1
  13. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/curveProcessor.d.ts +2 -0
  14. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/curveProcessor.js +2 -0
  15. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +1 -0
  16. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +1 -0
  17. package/dist/src/modules/v4/campaign/campaign.repository.js +1 -0
  18. package/dist/src/modules/v4/campaign/campaign.service.d.ts +1 -0
  19. package/dist/src/modules/v4/router.d.ts +1 -0
  20. package/dist/src/modules/v4/status/status.repository.js +13 -3
  21. package/dist/src/utils/generateIcons.d.ts +3 -0
  22. package/dist/src/utils/generateIcons.js +53 -0
  23. package/dist/tsconfig.package.tsbuildinfo +1 -1
  24. package/package.json +1 -1
@@ -999,6 +999,7 @@ declare const eden: {
999
999
  endTimestamp: bigint;
1000
1000
  campaignId: string;
1001
1001
  CampaignStatus: {
1002
+ status: import("../../database/api/.generated").$Enums.RunStatus;
1002
1003
  computedUntil: bigint;
1003
1004
  processingStarted: bigint;
1004
1005
  }[];
@@ -4100,6 +4101,7 @@ declare const eden: {
4100
4101
  endTimestamp: bigint;
4101
4102
  campaignId: string;
4102
4103
  CampaignStatus: {
4104
+ status: import("../../database/api/.generated").$Enums.RunStatus;
4103
4105
  computedUntil: bigint;
4104
4106
  processingStarted: bigint;
4105
4107
  }[];
@@ -8055,6 +8057,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
8055
8057
  endTimestamp: bigint;
8056
8058
  campaignId: string;
8057
8059
  CampaignStatus: {
8060
+ status: import("../../database/api/.generated").$Enums.RunStatus;
8058
8061
  computedUntil: bigint;
8059
8062
  processingStarted: bigint;
8060
8063
  }[];
@@ -12668,6 +12671,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
12668
12671
  endTimestamp: bigint;
12669
12672
  campaignId: string;
12670
12673
  CampaignStatus: {
12674
+ status: import("../../database/api/.generated").$Enums.RunStatus;
12671
12675
  computedUntil: bigint;
12672
12676
  processingStarted: bigint;
12673
12677
  }[];
@@ -15769,6 +15773,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
15769
15773
  endTimestamp: bigint;
15770
15774
  campaignId: string;
15771
15775
  CampaignStatus: {
15776
+ status: import("../../database/api/.generated").$Enums.RunStatus;
15772
15777
  computedUntil: bigint;
15773
15778
  processingStarted: bigint;
15774
15779
  }[];
@@ -123,7 +123,11 @@ export const extractOpportunities = {
123
123
  tokenIcons: [params.baseToken, params.quoteToken],
124
124
  rewardTokenIcons: getRewardTokenIcons(campaigns.active),
125
125
  dailyRewardTokens: getRewardTokens(campaigns.active),
126
- campaigns: { ...campaigns, type: Campaign.AMBIENTPROCESSOR, ids: campaigns.all.map(c => c.campaignId) },
126
+ campaigns: {
127
+ ...campaigns,
128
+ type: Campaign.AMBIENTPROCESSOR,
129
+ ids: campaigns.all.map(c => c.campaignId),
130
+ },
127
131
  };
128
132
  return opportunity;
129
133
  },
@@ -244,97 +248,6 @@ export const extractOpportunities = {
244
248
  [Campaign.ERC20]: (campaign, campaigns, prices) => {
245
249
  const { chainId, tvl, campaignParameters: params, typeInfo, computeChainId, mainParameter } = campaign;
246
250
  const { active, all } = campaigns;
247
- // DEPRECATED!!!!
248
- const map = {
249
- actions: {
250
- pool: [
251
- "uniswapv2",
252
- "velodrome",
253
- "aerodrome",
254
- "balancerGauge",
255
- "balancerPool",
256
- "curve",
257
- "aura",
258
- "akron",
259
- "beefy",
260
- "dragonswap",
261
- "poolside",
262
- "koi",
263
- "pancakeswap",
264
- "tempest",
265
- "cross_curve",
266
- "curve",
267
- "curve_2",
268
- "curveNPool",
269
- "zkswap",
270
- "maverickBoostedPosition",
271
- "zkSwapThreePool",
272
- "syncswap",
273
- "rfx",
274
- ],
275
- borrow: [
276
- "radiant_borrow",
277
- "aave_borrowing",
278
- "euler_borrow",
279
- "zerolend_borrowing",
280
- "vicuna_borrowing",
281
- "takotako_borrowing",
282
- "lendle_borrowing",
283
- ],
284
- lend: [
285
- "gearbox",
286
- "compound",
287
- "radiant_lend",
288
- "aave_lending",
289
- "vicuna_lending",
290
- "takotako_lending",
291
- "lendle_lending",
292
- "vicuna_lending",
293
- "sturdy_aggregator",
294
- "sturdy_silo",
295
- "fraxlend",
296
- "moonwell",
297
- "ionic",
298
- "fluid",
299
- "silostaking",
300
- "euler_lend",
301
- "layerbank",
302
- "zerolend_lending",
303
- "venus",
304
- "reactor_fusion",
305
- "woofi",
306
- ],
307
- },
308
- icons: {
309
- pool: () => {
310
- if (["balancerGauge", "balancerPool"].includes(campaign.type ?? ""))
311
- return Object.values(typeInfo.poolTokens ?? {})
312
- .map(tkn => tkn?.symbol)
313
- .filter(tkn => tkn);
314
- if (["curve"].includes(campaign.type ?? ""))
315
- return Object.values(typeInfo.poolTokens ?? {}).filter(tkn => tkn);
316
- if (["rfx"].includes(campaign.type ?? "")) {
317
- return [typeInfo.symbolShortToken, typeInfo.symbolLongToken];
318
- }
319
- if (["maverickBoostedPosition"].includes(campaign.type ?? "")) {
320
- return [typeInfo.symbolTokenA, typeInfo.symbolTokenB];
321
- }
322
- return [typeInfo.symbolToken0, typeInfo.symbolToken1];
323
- },
324
- lend: () => (campaign.type === "compound" ? [typeInfo.symbolBaseToken] : [typeInfo.symbolUnderlyingToken]),
325
- borrow: () => [typeInfo.symbolUnderlyingToken],
326
- hold: () => {
327
- if (["toros", "enzyme"].includes(campaign.type))
328
- return [typeInfo.symbolUnderlyingToken];
329
- return [campaign.campaignParameters.symbolTargetToken];
330
- },
331
- },
332
- };
333
- const action = typeInfo.action.toLowerCase() ?? "hold";
334
- // (Object.entries(map.actions).find(([_action, _types]) =>
335
- // _types.includes(campaign.type ?? "")
336
- // )?.[0] as ERC20Actions) ?? "hold";
337
- const icons = map.icons[action]();
338
251
  const opportunity = {
339
252
  id: `${Campaign.ERC20}_${mainParameter}`,
340
253
  platform: params.symbolTargetToken,
@@ -342,12 +255,12 @@ export const extractOpportunities = {
342
255
  chainId: !computeChainId ? chainId : computeChainId,
343
256
  distributionChainId: chainId,
344
257
  tvl,
345
- action,
258
+ action: typeInfo.action ? typeInfo.action.toLowerCase() : "hold",
346
259
  apr: getApr(active),
347
260
  status: getStatus(all),
348
261
  tags: getTags(campaigns.all),
349
262
  dailyrewards: getDailyRewards(active, prices),
350
- tokenIcons: icons,
263
+ tokenIcons: typeInfo.icons,
351
264
  campaigns: { ...campaigns, type: Campaign.ERC20, ids: campaigns.all.map(c => c.campaignId) },
352
265
  rewardTokenIcons: getRewardTokenIcons(campaigns.active),
353
266
  dailyRewardTokens: getRewardTokens(campaigns.active),
@@ -651,112 +564,6 @@ export const extractOpportunities = {
651
564
  };
652
565
  return opportunity;
653
566
  },
654
- [Campaign.ERC20]: (campaign, campaigns, prices) => {
655
- const { chainId, tvl, campaignParameters: params, typeInfo, computeChainId, mainParameter } = campaign;
656
- const { active, all } = campaigns;
657
- // DEPRECATED!!!!
658
- const map = {
659
- actions: {
660
- pool: [
661
- "uniswapv2",
662
- "velodrome",
663
- "aerodrome",
664
- "balancerGauge",
665
- "balancerPool",
666
- "curve",
667
- "aura",
668
- "akron",
669
- "beefy",
670
- "dragonswap",
671
- "poolside",
672
- "koi",
673
- "pancakeswap",
674
- "tempest",
675
- "cross_curve",
676
- "zkswap",
677
- "maverickBoostedPosition",
678
- "zkSwapThreePool",
679
- "syncswap",
680
- "rfx",
681
- ],
682
- borrow: [
683
- "radiant_borrow",
684
- "aave_borrowing",
685
- "euler_borrow",
686
- "zerolend_borrowing",
687
- "takotako_borrowing",
688
- "lendle_borrowing",
689
- "vicuna_borrowing",
690
- ],
691
- lend: [
692
- "gearbox",
693
- "compound",
694
- "radiant_lend",
695
- "aave_lending",
696
- "vicuna_lending",
697
- "takotako_lending",
698
- "lendle_lending",
699
- "sturdy_aggregator",
700
- "sturdy_silo",
701
- "fraxlend",
702
- "moonwell",
703
- "ionic",
704
- "fluid",
705
- "silostaking",
706
- "euler_lend",
707
- "layerbank",
708
- "zerolend_lending",
709
- "venus",
710
- "reactor_fusion",
711
- "woofi",
712
- ],
713
- },
714
- icons: {
715
- pool: () => {
716
- if (["balancerGauge", "balancerPool", "aura"].includes(campaign.type ?? ""))
717
- return Object.values(typeInfo.poolTokens ?? {})
718
- .map(tkn => tkn?.symbol)
719
- .filter(tkn => tkn);
720
- if (["curve"].includes(campaign.type ?? ""))
721
- return Object.values(typeInfo.poolTokens ?? {}).filter(tkn => tkn);
722
- if (["rfx"].includes(campaign.type ?? "")) {
723
- return [typeInfo.symbolShortToken, typeInfo.symbolLongToken];
724
- }
725
- if (["maverickBoostedPosition"].includes(campaign.type ?? "")) {
726
- return [typeInfo.symbolTokenA, typeInfo.symbolTokenB];
727
- }
728
- return [typeInfo.symbolToken0, typeInfo.symbolToken1];
729
- },
730
- lend: () => (campaign.type === "compound" ? [typeInfo.symbolBaseToken] : [typeInfo.symbolUnderlyingToken]),
731
- borrow: () => [typeInfo.symbolUnderlyingToken],
732
- hold: () => {
733
- if (["toros", "enzyme"].includes(campaign.type))
734
- return [typeInfo.symbolUnderlyingToken];
735
- return [campaign.campaignParameters.symbolTargetToken];
736
- },
737
- },
738
- };
739
- const action = Object.entries(map.actions).find(([_action, _types]) => _types.includes(campaign.type ?? ""))?.[0] ?? "hold";
740
- const icons = map.icons[action]();
741
- const opportunity = {
742
- id: `${Campaign.ERC20}_${mainParameter}`,
743
- platform: params.symbolTargetToken,
744
- name: typeInfo?.cardName,
745
- chainId: !computeChainId ? chainId : computeChainId,
746
- distributionChainId: chainId,
747
- tvl,
748
- action,
749
- apr: getApr(active),
750
- status: getStatus(all),
751
- tags: getTags(campaigns.all),
752
- dailyrewards: getDailyRewards(active, prices),
753
- tokenIcons: icons,
754
- campaigns: { ...campaigns, type: Campaign.ERC20, ids: campaigns.all.map(c => c.campaignId) },
755
- rewardTokenIcons: getRewardTokenIcons(campaigns.active),
756
- dailyRewardTokens: getRewardTokens(campaigns.active),
757
- };
758
- return opportunity;
759
- },
760
567
  [Campaign.ERC20LOGPROCESSOR]: (campaign, campaigns, prices) => {
761
568
  const { chainId, tvl, campaignParameters: params, typeInfo, computeChainId, mainParameter } = campaign;
762
569
  const { active, all } = campaigns;
@@ -1155,6 +1155,7 @@ declare const app: Elysia<"", false, {
1155
1155
  endTimestamp: bigint;
1156
1156
  campaignId: string;
1157
1157
  CampaignStatus: {
1158
+ status: import("../database/api/.generated").$Enums.RunStatus;
1158
1159
  computedUntil: bigint;
1159
1160
  processingStarted: bigint;
1160
1161
  }[];
@@ -156,7 +156,7 @@ export const tokenTypeToProtocol = {
156
156
  [tokenType.holdstation]: { protocol: "HoldStation", action: OpportunityAction.HOLD },
157
157
  [tokenType.staking]: { protocol: "Staking", action: OpportunityAction.HOLD },
158
158
  [tokenType.noLinkVault]: { protocol: "NoLinkVault", action: OpportunityAction.HOLD },
159
- [tokenType.cpmmGamma]: { protocol: "GammaSwap", action: OpportunityAction.HOLD },
159
+ [tokenType.cpmmGamma]: { protocol: "GammaSwap", action: OpportunityAction.POOL },
160
160
  [tokenType.crosscurve]: { protocol: "CrossCurve", action: OpportunityAction.POOL },
161
161
  [tokenType.curveNPool]: { protocol: "Curve", action: OpportunityAction.POOL },
162
162
  [tokenType.vicuna]: { protocol: "Vicuna", action: OpportunityAction.HOLD },
@@ -28,6 +28,10 @@ type dataRawAura = callKeysAura & {
28
28
  poolTokens: Array<{
29
29
  token: string;
30
30
  balance: string;
31
+ amountInPool: number;
32
+ symbol: string;
33
+ decimals: number;
34
+ price: number;
31
35
  }>;
32
36
  };
33
37
  type dataTypeAura = dataType & {
@@ -46,6 +50,10 @@ type dataTypeAura = dataType & {
46
50
  poolTokens: Array<{
47
51
  token: string;
48
52
  balance: string;
53
+ amountInPool: number;
54
+ symbol: string;
55
+ decimals: number;
56
+ price: number;
49
57
  }>;
50
58
  };
51
59
  export declare class AuraProcessor extends GenericProcessor<callKeysAura, dataRawAura, dataTypeAura> {
@@ -38,6 +38,10 @@ export class AuraProcessor extends GenericProcessor {
38
38
  poolTokens.push({
39
39
  token: token,
40
40
  balance: balances[i].toString(),
41
+ amountInPool: 0,
42
+ symbol: "",
43
+ decimals: 0,
44
+ price: 0,
41
45
  });
42
46
  i++;
43
47
  typeInfo.poolTokens = poolTokens;
@@ -57,21 +61,16 @@ export class AuraProcessor extends GenericProcessor {
57
61
  const gaugeBalance = BN2Number(typeInfo.gaugeBalance, 18);
58
62
  const auraBalance = BN2Number(typeInfo.auraBalance, 18);
59
63
  const totalSupplyGauge = BN2Number(typeInfo.totalSupplyGauge, 18);
60
- const poolTokensinfo = {};
61
64
  let poolTvl = 0;
62
65
  const symbols = [];
63
66
  let indexUpdated = index + this.rounds.round4.length;
64
67
  for (const poolToken of typeInfo.poolTokens) {
65
- const symbol = decodeCall(calls, indexUpdated++, "symbol");
66
- const decimals = decodeCall(calls, indexUpdated++, "decimals");
67
- poolTokensinfo[poolToken.token] = {
68
- symbol: symbol,
69
- decimals: decimals,
70
- amountInPool: BN2Number(poolToken.balance, decimals),
71
- price: (await pricer.get({ symbol: symbol })) ?? 0,
72
- };
73
- poolTvl += poolTokensinfo[poolToken.token].price * poolTokensinfo[poolToken.token].amountInPool;
74
- symbols.push(symbol);
68
+ poolToken.symbol = decodeCall(calls, indexUpdated++, "symbol");
69
+ poolToken.decimals = decodeCall(calls, indexUpdated++, "decimals");
70
+ poolToken.amountInPool = BN2Number(poolToken.balance, poolToken.decimals);
71
+ poolToken.price = (await pricer.get({ symbol: poolToken.symbol })) ?? 0;
72
+ poolTvl += poolToken.price * poolToken.amountInPool;
73
+ symbols.push(poolToken.symbol);
75
74
  }
76
75
  const percentageOfSupplyInAura = (auraBalance / totalSupplyGauge) * (gaugeBalance / totalSupplyBalancerPool);
77
76
  const tvl = poolTvl * percentageOfSupplyInAura;
@@ -85,7 +84,6 @@ export class AuraProcessor extends GenericProcessor {
85
84
  totalSupply,
86
85
  whitelistedSupplyTargetToken,
87
86
  blacklistedSupply,
88
- poolTokens: poolTokensinfo,
89
87
  tvl: tvl,
90
88
  priceTargetToken: priceTargetToken,
91
89
  cardName: generateCardName(type, typeInfo, campaign, symbols),
@@ -22,6 +22,10 @@ type dataRawBP = callKeysBP & {
22
22
  poolTokens: Array<{
23
23
  token: string;
24
24
  balance: string;
25
+ amountInPool: number;
26
+ symbol: string;
27
+ decimals: number;
28
+ price: number;
25
29
  }>;
26
30
  };
27
31
  type dataTypeBP = dataType & {
@@ -30,7 +34,10 @@ type dataTypeBP = dataType & {
30
34
  vault: string;
31
35
  poolTokens: Array<{
32
36
  token: string;
33
- balance: string;
37
+ amountInPool: number;
38
+ symbol: string;
39
+ decimals: number;
40
+ price: number;
34
41
  }>;
35
42
  totalSupply: number;
36
43
  blacklistedSupply: number;
@@ -25,7 +25,6 @@ export class BalancerPoolProcessor extends GenericProcessor {
25
25
  const vaultBalanceBN = BigNumber.from(typeInfo.vaultBalance);
26
26
  const totalSupplyUpdated = BN2Number(totalSupplyBN.sub(vaultBalanceBN), campaign.campaignParameters.decimalsTargetToken);
27
27
  const vaultBalance = BN2Number(vaultBalanceBN, campaign.campaignParameters.decimalsTargetToken);
28
- const poolTokensinfo = {};
29
28
  let tvl = 0;
30
29
  const symbols = [];
31
30
  let indexUpdated = index + this.rounds.round4.length;
@@ -36,23 +35,16 @@ export class BalancerPoolProcessor extends GenericProcessor {
36
35
  blacklistedSupply -= BN2Number(decodeCall(calls, index + vaultIndex, "balanceOf"), campaign.campaignParameters.decimalsTargetToken); // The vault balance was already removed from the total supply
37
36
  }
38
37
  for (const poolToken of typeInfo.poolTokens) {
39
- const symbol = decodeCall(calls, indexUpdated++, "symbol");
40
- const decimals = decodeCall(calls, indexUpdated++, "decimals");
41
- poolTokensinfo[poolToken.token] = {
42
- symbol: symbol,
43
- decimals: decimals,
44
- amountInPool: BN2Number(poolToken.balance, decimals),
45
- price: (await pricer.get({ symbol: symbol })) ?? 0,
46
- };
47
- tvl += poolTokensinfo[poolToken.token].price * poolTokensinfo[poolToken.token].amountInPool;
48
- symbols.push(symbol);
38
+ poolToken.symbol = decodeCall(calls, indexUpdated++, "symbol");
39
+ poolToken.decimals = decodeCall(calls, indexUpdated++, "decimals");
40
+ poolToken.amountInPool = BN2Number(poolToken.balance, poolToken.decimals);
41
+ poolToken.price = (await pricer.get({ symbol: poolToken.symbol })) ?? 0;
42
+ tvl += poolToken.price * poolToken.amountInPool;
43
+ symbols.push(poolToken.symbol);
49
44
  }
50
45
  const priceTargetToken = tvl / totalSupplyUpdated;
51
46
  return {
52
- tokenAddress: typeInfo.tokenAddress,
53
- poolId: typeInfo.poolId,
54
- vault: typeInfo.vault,
55
- poolTokens: poolTokensinfo,
47
+ ...typeInfo,
56
48
  totalSupply: totalSupplyUpdated,
57
49
  whitelistedSupplyTargetToken,
58
50
  blacklistedSupply,
@@ -72,6 +64,10 @@ export class BalancerPoolProcessor extends GenericProcessor {
72
64
  poolTokens.push({
73
65
  token: token,
74
66
  balance: balances[i].toString(),
67
+ amountInPool: 0,
68
+ symbol: "",
69
+ decimals: 0,
70
+ price: 0,
75
71
  });
76
72
  }
77
73
  i++;
@@ -40,8 +40,10 @@ export class BalancerV3PoolProcessor extends GenericProcessor {
40
40
  const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
41
41
  let tvl = 0;
42
42
  for (let i = 0; i < typeInfo.numberTokens; i++) {
43
- const symbol = typeInfo[`symbolToken${i}`];
43
+ let symbol = typeInfo[`symbolToken${i}`];
44
44
  const price = (await pricer.get({ symbol: symbol })) ?? 0;
45
+ symbol = symbol.replace("wmooSiloV2Sonic", "");
46
+ typeInfo[`symbolToken${i}`] = symbol.replace(" (wS Market)", "");
45
47
  const decimals = Number(typeInfo[`decimalsToken${i}`]);
46
48
  const amount = BN2Number(typeInfo[`balanceToken${i}`], decimals);
47
49
  tvl += amount * price;
@@ -58,10 +60,7 @@ export class BalancerV3PoolProcessor extends GenericProcessor {
58
60
  }
59
61
  const symbols = [];
60
62
  for (let i = 0; i < typeInfo.numberTokens; i++) {
61
- let symbolToClean = typeInfo[`symbolToken${i}`];
62
- symbolToClean = symbolToClean.replace("wmooSiloV2Sonic", "");
63
- symbolToClean = symbolToClean.replace(" (wS Market)", "");
64
- symbols.push(symbolToClean);
63
+ symbols.push(typeInfo[`symbolToken${i}`]);
65
64
  }
66
65
  return {
67
66
  ...typeInfo,
@@ -1,6 +1,7 @@
1
1
  import { decodeCall } from "../../../../../utils/decodeCalls";
2
2
  import { createCall } from "../../../../../utils/encodeCalls";
3
3
  import { generateCardName } from "../../../../../utils/generateCardName";
4
+ import { generateIcons } from "../../../../../utils/generateIcons";
4
5
  import { BN2Number } from "@sdk";
5
6
  import { tokenTypeToProtocol } from "../helpers/tokenType";
6
7
  export var roundType;
@@ -130,7 +131,10 @@ export class GenericProcessor {
130
131
  console.log("Round 5", {
131
132
  type: type,
132
133
  calls: [],
133
- outputInfo,
134
+ typeInfo: {
135
+ ...outputInfo,
136
+ icons: generateIcons(type, typeInfo, campaign),
137
+ },
134
138
  });
135
139
  }
136
140
  return {
@@ -138,6 +142,7 @@ export class GenericProcessor {
138
142
  calls: [],
139
143
  typeInfo: {
140
144
  ...outputInfo,
145
+ icons: generateIcons(type, typeInfo, campaign),
141
146
  },
142
147
  };
143
148
  }
@@ -5,6 +5,7 @@ export class StakingProcessor extends GenericProcessor {
5
5
  round1: [
6
6
  { key: "lockNFT", call: "lockNFT", target: "stakingContract", optional: true },
7
7
  { key: "eip712DomainName", call: "eip712DomainName", target: "stakingContract", optional: true },
8
+ { key: "stakingSymbol", call: "symbol", target: "stakingContract", optional: true },
8
9
  ],
9
10
  round2: [{ key: "stakingSymbol", call: "symbol", target: "lockNFT", optional: true }],
10
11
  round3: [],
@@ -21,7 +21,6 @@ export class VicunaProcessor extends GenericProcessor {
21
21
  const vicunaTVL = (await axios("https://vicuna.orthae.xyz/tvl/details")).data;
22
22
  // find the entry that matches the vault address
23
23
  const tvl = findTvlByVaultAddress(vicunaTVL[campaign.chainId], typeInfo.tokenAddress) ?? 0;
24
- console.log("tvl", tvl);
25
24
  const priceTargetToken = tvl / totalSupply;
26
25
  return {
27
26
  ...typeInfo,
@@ -22,8 +22,10 @@ type dataRawCurve = callKeysCurve & {
22
22
  poolTokens: {
23
23
  [key: string]: string;
24
24
  };
25
+ numberTokens: number;
25
26
  };
26
27
  type dataTypeCurve = dataType & {
28
+ numberTokens: number;
27
29
  lp_price: number;
28
30
  token0: string;
29
31
  token1: string;
@@ -29,12 +29,14 @@ export class CurveProcessor extends GenericProcessor {
29
29
  [typeInfo.token1]: typeInfo.symbolToken1,
30
30
  [typeInfo.token2]: typeInfo.symbolToken2,
31
31
  };
32
+ typeInfo.numberTokens = 3;
32
33
  }
33
34
  else {
34
35
  typeInfo.poolTokens = {
35
36
  [typeInfo.token0]: typeInfo.symbolToken0,
36
37
  [typeInfo.token1]: typeInfo.symbolToken1,
37
38
  };
39
+ typeInfo.numberTokens = 2;
38
40
  }
39
41
  if (type === tokenType.curve_2) {
40
42
  const prices = [];
@@ -217,6 +217,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
217
217
  endTimestamp: bigint;
218
218
  campaignId: string;
219
219
  CampaignStatus: {
220
+ status: import("../../../../database/api/.generated").$Enums.RunStatus;
220
221
  computedUntil: bigint;
221
222
  processingStarted: bigint;
222
223
  }[];
@@ -142,6 +142,7 @@ export declare abstract class CampaignRepository {
142
142
  endTimestamp: bigint;
143
143
  campaignId: string;
144
144
  CampaignStatus: {
145
+ status: import("../../../../database/api/.generated").$Enums.RunStatus;
145
146
  computedUntil: bigint;
146
147
  processingStarted: bigint;
147
148
  }[];
@@ -256,6 +256,7 @@ export class CampaignRepository {
256
256
  // To be able to filter out campaigns that are already fully computed
257
257
  take: 1,
258
258
  select: {
259
+ status: true,
259
260
  computedUntil: true,
260
261
  processingStarted: true,
261
262
  },
@@ -133,6 +133,7 @@ export declare abstract class CampaignService {
133
133
  endTimestamp: bigint;
134
134
  campaignId: string;
135
135
  CampaignStatus: {
136
+ status: import("../../../../database/api/.generated").$Enums.RunStatus;
136
137
  computedUntil: bigint;
137
138
  processingStarted: bigint;
138
139
  }[];
@@ -1025,6 +1025,7 @@ export declare const v4: Elysia<"/v4", false, {
1025
1025
  endTimestamp: bigint;
1026
1026
  campaignId: string;
1027
1027
  CampaignStatus: {
1028
+ status: import("../../../database/api/.generated").$Enums.RunStatus;
1028
1029
  computedUntil: bigint;
1029
1030
  processingStarted: bigint;
1030
1031
  }[];
@@ -72,13 +72,23 @@ export class StatusRepository {
72
72
  }
73
73
  static async updateProcessing(campaignUnique) {
74
74
  const campaignId = CampaignService.hashId(campaignUnique);
75
+ const now = moment().unix();
75
76
  return await apiDbClient.$transaction([
76
77
  apiDbClient.campaignStatus.findUniqueOrThrow({
77
78
  where: {
78
79
  campaignId,
79
- status: {
80
- not: "PROCESSING",
81
- },
80
+ OR: [
81
+ {
82
+ status: {
83
+ not: "PROCESSING",
84
+ },
85
+ },
86
+ {
87
+ processingStarted: {
88
+ lte: now - 60, // The job wasn't already updated in the last minute
89
+ },
90
+ },
91
+ ],
82
92
  },
83
93
  }),
84
94
  apiDbClient.campaignStatus.update({
@@ -0,0 +1,3 @@
1
+ import { tokenType } from "../libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType";
2
+ import type { Campaign, CampaignParameters } from "@sdk";
3
+ export declare function generateIcons(type: tokenType, typeInfo: any, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.ERC20LOGPROCESSOR> | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR> | CampaignParameters<Campaign.EULER>, symbols?: string[]): string[];