@merkl/api 0.20.64 → 0.20.65

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 (135) hide show
  1. package/dist/database/index.js +5 -1
  2. package/dist/src/eden/index.d.ts +115 -60
  3. package/dist/src/engine/dynamicData/implementations/Erc20.js +80 -42
  4. package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.d.ts +18 -18
  5. package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.js +33 -30
  6. package/dist/src/engine/erc20SubTypeProcessors/{helpers/tokenType.d.ts → constants.d.ts} +0 -6
  7. package/dist/src/engine/erc20SubTypeProcessors/factory.d.ts +6 -0
  8. package/dist/src/engine/erc20SubTypeProcessors/{implementations/processorMapping.js → factory.js} +49 -48
  9. package/dist/src/engine/erc20SubTypeProcessors/helpers/factoryFinder.d.ts +1 -1
  10. package/dist/src/engine/erc20SubTypeProcessors/helpers/factoryFinder.js +1 -1
  11. package/dist/src/engine/erc20SubTypeProcessors/helpers/hardcoded.d.ts +1 -1
  12. package/dist/src/engine/erc20SubTypeProcessors/helpers/hardcoded.js +1 -1
  13. package/dist/src/engine/erc20SubTypeProcessors/helpers/ownerFinder.d.ts +1 -1
  14. package/dist/src/engine/erc20SubTypeProcessors/helpers/ownerFinder.js +1 -1
  15. package/dist/src/engine/erc20SubTypeProcessors/implementations/AaveProcessor.d.ts +1 -2
  16. package/dist/src/engine/erc20SubTypeProcessors/implementations/AaveProcessor.js +1 -2
  17. package/dist/src/engine/erc20SubTypeProcessors/implementations/AnglesLiquid.d.ts +2 -3
  18. package/dist/src/engine/erc20SubTypeProcessors/implementations/AnglesLiquid.js +1 -5
  19. package/dist/src/engine/erc20SubTypeProcessors/implementations/AssetProcessor.d.ts +1 -2
  20. package/dist/src/engine/erc20SubTypeProcessors/implementations/AssetProcessor.js +2 -2
  21. package/dist/src/engine/erc20SubTypeProcessors/implementations/AuraProcessor.d.ts +3 -2
  22. package/dist/src/engine/erc20SubTypeProcessors/implementations/AuraProcessor.js +6 -7
  23. package/dist/src/engine/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.d.ts +3 -2
  24. package/dist/src/engine/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.js +4 -5
  25. package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerGaugeProcessor.d.ts +3 -2
  26. package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerGaugeProcessor.js +3 -4
  27. package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerPoolProcessor.d.ts +3 -2
  28. package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerPoolProcessor.js +3 -4
  29. package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerV3PoolProcessor.d.ts +2 -2
  30. package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerV3PoolProcessor.js +1 -2
  31. package/dist/src/engine/erc20SubTypeProcessors/implementations/BeefyProcessor.d.ts +2 -2
  32. package/dist/src/engine/erc20SubTypeProcessors/implementations/BeefyProcessor.js +3 -3
  33. package/dist/src/engine/erc20SubTypeProcessors/implementations/BunniV2Processor.d.ts +2 -2
  34. package/dist/src/engine/erc20SubTypeProcessors/implementations/BunniV2Processor.js +2 -2
  35. package/dist/src/engine/erc20SubTypeProcessors/implementations/CompoundProcessor.d.ts +2 -2
  36. package/dist/src/engine/erc20SubTypeProcessors/implementations/CompoundProcessor.js +2 -3
  37. package/dist/src/engine/erc20SubTypeProcessors/implementations/ERC4626Processor.d.ts +1 -2
  38. package/dist/src/engine/erc20SubTypeProcessors/implementations/ERC4626Processor.js +1 -1
  39. package/dist/src/engine/erc20SubTypeProcessors/implementations/EnzymeProcessor.d.ts +3 -2
  40. package/dist/src/engine/erc20SubTypeProcessors/implementations/EnzymeProcessor.js +2 -2
  41. package/dist/src/engine/erc20SubTypeProcessors/implementations/EqualizerGaugeProcessor.d.ts +1 -2
  42. package/dist/src/engine/erc20SubTypeProcessors/implementations/EqualizerGaugeProcessor.js +1 -1
  43. package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerBorrowProcessor.d.ts +1 -2
  44. package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerBorrowProcessor.js +1 -1
  45. package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerLendProcessor.d.ts +1 -2
  46. package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerLendProcessor.js +1 -1
  47. package/dist/src/engine/erc20SubTypeProcessors/implementations/FluidProcessor.d.ts +2 -2
  48. package/dist/src/engine/erc20SubTypeProcessors/implementations/FluidProcessor.js +2 -3
  49. package/dist/src/engine/erc20SubTypeProcessors/implementations/FraxProcessor.d.ts +1 -2
  50. package/dist/src/engine/erc20SubTypeProcessors/implementations/FraxProcessor.js +2 -2
  51. package/dist/src/engine/erc20SubTypeProcessors/implementations/GammaProcessor.d.ts +2 -3
  52. package/dist/src/engine/erc20SubTypeProcessors/implementations/GammaProcessor.js +1 -4
  53. package/dist/src/engine/erc20SubTypeProcessors/implementations/GearboxProcessor.d.ts +2 -2
  54. package/dist/src/engine/erc20SubTypeProcessors/implementations/GearboxProcessor.js +2 -3
  55. package/dist/src/engine/erc20SubTypeProcessors/implementations/HanjiVaultProcessor.d.ts +3 -2
  56. package/dist/src/engine/erc20SubTypeProcessors/implementations/HanjiVaultProcessor.js +4 -5
  57. package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.d.ts +1 -2
  58. package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.js +1 -1
  59. package/dist/src/engine/erc20SubTypeProcessors/implementations/HourglassProcessor.d.ts +2 -2
  60. package/dist/src/engine/erc20SubTypeProcessors/implementations/HourglassProcessor.js +2 -3
  61. package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.d.ts +2 -2
  62. package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.js +2 -2
  63. package/dist/src/engine/erc20SubTypeProcessors/implementations/MetamorphoProcessor.d.ts +2 -2
  64. package/dist/src/engine/erc20SubTypeProcessors/implementations/MetamorphoProcessor.js +1 -2
  65. package/dist/src/engine/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.d.ts +2 -3
  66. package/dist/src/engine/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.js +3 -6
  67. package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleProcessor.d.ts +1 -2
  68. package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleProcessor.js +1 -1
  69. package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleYTProcessor.d.ts +1 -2
  70. package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleYTProcessor.js +1 -1
  71. package/dist/src/engine/erc20SubTypeProcessors/implementations/RadiantProcessor.d.ts +2 -2
  72. package/dist/src/engine/erc20SubTypeProcessors/implementations/RadiantProcessor.js +1 -2
  73. package/dist/src/engine/erc20SubTypeProcessors/implementations/RfxProcessor.d.ts +2 -2
  74. package/dist/src/engine/erc20SubTypeProcessors/implementations/RfxProcessor.js +5 -6
  75. package/dist/src/engine/erc20SubTypeProcessors/implementations/Satlayer.d.ts +1 -2
  76. package/dist/src/engine/erc20SubTypeProcessors/implementations/Satlayer.js +1 -2
  77. package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraProcessor.d.ts +1 -2
  78. package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraProcessor.js +1 -1
  79. package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraYTProcessor.d.ts +1 -2
  80. package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraYTProcessor.js +1 -1
  81. package/dist/src/engine/erc20SubTypeProcessors/implementations/SpliceProcessor.d.ts +2 -1
  82. package/dist/src/engine/erc20SubTypeProcessors/implementations/SpliceProcessor.js +0 -1
  83. package/dist/src/engine/erc20SubTypeProcessors/implementations/SturdySiloProcessor.d.ts +1 -2
  84. package/dist/src/engine/erc20SubTypeProcessors/implementations/SturdySiloProcessor.js +1 -2
  85. package/dist/src/engine/erc20SubTypeProcessors/implementations/TempestVaultProcessor.d.ts +2 -2
  86. package/dist/src/engine/erc20SubTypeProcessors/implementations/TempestVaultProcessor.js +2 -2
  87. package/dist/src/engine/erc20SubTypeProcessors/implementations/TemplateProcessor.d.ts +2 -3
  88. package/dist/src/engine/erc20SubTypeProcessors/implementations/TemplateProcessor.js +0 -4
  89. package/dist/src/engine/erc20SubTypeProcessors/implementations/TorosProcessor.d.ts +1 -2
  90. package/dist/src/engine/erc20SubTypeProcessors/implementations/TorosProcessor.js +1 -2
  91. package/dist/src/engine/erc20SubTypeProcessors/implementations/UniswapProcessor.d.ts +3 -2
  92. package/dist/src/engine/erc20SubTypeProcessors/implementations/UniswapProcessor.js +3 -3
  93. package/dist/src/engine/erc20SubTypeProcessors/implementations/VicunaProcessor.d.ts +1 -2
  94. package/dist/src/engine/erc20SubTypeProcessors/implementations/VicunaProcessor.js +1 -1
  95. package/dist/src/engine/erc20SubTypeProcessors/implementations/WoofiProcessor.d.ts +1 -2
  96. package/dist/src/engine/erc20SubTypeProcessors/implementations/WoofiProcessor.js +1 -2
  97. package/dist/src/engine/erc20SubTypeProcessors/implementations/ZkSwapThreePoolProcessor.d.ts +2 -2
  98. package/dist/src/engine/erc20SubTypeProcessors/implementations/ZkSwapThreePoolProcessor.js +7 -7
  99. package/dist/src/engine/erc20SubTypeProcessors/implementations/curveNPoolProcessor.d.ts +3 -2
  100. package/dist/src/engine/erc20SubTypeProcessors/implementations/curveNPoolProcessor.js +5 -6
  101. package/dist/src/engine/erc20SubTypeProcessors/implementations/curveProcessor.d.ts +1 -2
  102. package/dist/src/engine/erc20SubTypeProcessors/implementations/curveProcessor.js +2 -3
  103. package/dist/src/engine/erc20SubTypeProcessors/implementations/stakedCurveProcessor.d.ts +2 -2
  104. package/dist/src/engine/erc20SubTypeProcessors/implementations/stakedCurveProcessor.js +3 -4
  105. package/dist/src/engine/erc20SubTypeProcessors/implementations/xU308Processor.d.ts +2 -2
  106. package/dist/src/engine/erc20SubTypeProcessors/implementations/xU308Processor.js +3 -4
  107. package/dist/src/engine/erc20SubTypeProcessors/subtypesRound1.d.ts +17 -3
  108. package/dist/src/engine/erc20SubTypeProcessors/subtypesRound1.js +52 -62
  109. package/dist/src/engine/opportunityMetadata/implementations/JsonAirdrop.js +1 -1
  110. package/dist/src/index.d.ts +23 -12
  111. package/dist/src/jobs/update-rpc-calls-cache.js +9 -4
  112. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +23 -12
  113. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +23 -12
  114. package/dist/src/modules/v4/opportunity/opportunity.service.js +2 -1
  115. package/dist/src/modules/v4/router.d.ts +23 -12
  116. package/dist/src/utils/decodeCalls.d.ts +1 -1
  117. package/dist/src/utils/decodeCalls.js +1 -1
  118. package/dist/src/utils/encodeCalls.d.ts +2 -2
  119. package/dist/src/utils/encodeCalls.js +15 -15
  120. package/dist/src/utils/generateCardName.d.ts +4 -3
  121. package/dist/src/utils/generateCardName.js +3 -3
  122. package/dist/tsconfig.package.tsbuildinfo +1 -1
  123. package/package.json +1 -1
  124. package/dist/src/engine/erc20SubTypeProcessors/implementations/processorMapping.d.ts +0 -6
  125. package/dist/src/engine/erc20SubTypeProcessors/subtypesPrices.d.ts +0 -4
  126. package/dist/src/engine/erc20SubTypeProcessors/subtypesPrices.js +0 -24
  127. package/dist/src/engine/erc20SubTypeProcessors/subtypesRound2.d.ts +0 -4
  128. package/dist/src/engine/erc20SubTypeProcessors/subtypesRound2.js +0 -22
  129. package/dist/src/engine/erc20SubTypeProcessors/subtypesRound3.d.ts +0 -3
  130. package/dist/src/engine/erc20SubTypeProcessors/subtypesRound3.js +0 -22
  131. package/dist/src/engine/erc20SubTypeProcessors/subtypesRound4.d.ts +0 -3
  132. package/dist/src/engine/erc20SubTypeProcessors/subtypesRound4.js +0 -22
  133. package/dist/src/utils/generateIcons.d.ts +0 -3
  134. package/dist/src/utils/generateIcons.js +0 -65
  135. /package/dist/src/engine/erc20SubTypeProcessors/{helpers/tokenType.js → constants.js} +0 -0
@@ -1,12 +1,13 @@
1
1
  import type { Pricer } from "@/utils/pricer";
2
2
  import { type Campaign, type CampaignParameters } from "@sdk";
3
3
  import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
4
- import type { tokenType, tokenTypeStruct } from "../helpers/tokenType";
4
+ import type { tokenType } from "../constants";
5
+ import type { tokenTypeStruct } from "../interface";
5
6
  type callType = {
6
7
  key: keyof dataRawCurveN;
7
8
  call: string;
8
9
  target: keyof callKeysCurveN;
9
- metaData?: keyof callKeysCurveN | string;
10
+ callArgs?: keyof callKeysCurveN | string;
10
11
  optional?: boolean;
11
12
  };
12
13
  type callKeysCurveN = mandatoryCallKeys & {
@@ -12,13 +12,12 @@ export class CurveNPoolProcessor extends GenericProcessor {
12
12
  round3: [],
13
13
  round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
14
14
  };
15
- // override computeRound1(): void {}
16
15
  processingRound2(typeInfo) {
17
16
  typeInfo.numberTokens = Number(typeInfo.numberTokens);
18
17
  for (let i = 0; i < typeInfo.numberTokens; i++) {
19
18
  typeInfo[`${i}`] = i.toString();
20
19
  this.rounds.round2 = this.rounds.round2.concat([
21
- { key: `token${i}`, call: "coins", target: "tokenAddress", metaData: i.toString() },
20
+ { key: `token${i}`, call: "coins", target: "tokenAddress", callArgs: i.toString() },
22
21
  ]);
23
22
  }
24
23
  }
@@ -27,14 +26,14 @@ export class CurveNPoolProcessor extends GenericProcessor {
27
26
  this.rounds.round3 = this.rounds.round3.concat([
28
27
  { key: `symbolToken${i}`, call: "symbol", target: `token${i}` },
29
28
  { key: `decimalsToken${i}`, call: "decimals", target: `token${i}` },
30
- { key: `balanceToken${i}`, call: "balances", target: "tokenAddress", metaData: i.toString() },
29
+ { key: `balanceToken${i}`, call: "balances", target: "tokenAddress", callArgs: i.toString() },
31
30
  ]);
32
31
  }
33
32
  }
34
33
  computeRound3(index, type, typeInfo, calls) {
35
34
  for (let i = 0; i < typeInfo.numberTokens; i++) {
36
35
  this.rounds.round2 = this.rounds.round2.concat([
37
- { key: `token${i}`, call: "coins", target: "tokenAddress", metaData: i.toString() },
36
+ { key: `token${i}`, call: "coins", target: "tokenAddress", callArgs: i.toString() },
38
37
  ]);
39
38
  }
40
39
  return super.computeRound3(index, type, typeInfo, calls);
@@ -44,7 +43,7 @@ export class CurveNPoolProcessor extends GenericProcessor {
44
43
  this.rounds.round3 = this.rounds.round3.concat([
45
44
  { key: `symbolToken${i}`, call: "symbol", target: `token${i}` },
46
45
  { key: `decimalsToken${i}`, call: "decimals", target: `token${i}` },
47
- { key: `balanceToken${i}`, call: "balances", target: "tokenAddress", metaData: i.toString() },
46
+ { key: `balanceToken${i}`, call: "balances", target: "tokenAddress", callArgs: i.toString() },
48
47
  ]);
49
48
  }
50
49
  return super.computeRound4(index, type, typeInfo, calls, campaign);
@@ -91,7 +90,7 @@ export class CurveNPoolProcessor extends GenericProcessor {
91
90
  whitelistedSupplyTargetToken,
92
91
  blacklistedSupply,
93
92
  priceTargetToken,
94
- cardName: generateCardName(type, typeInfo, campaign),
93
+ cardName: generateCardName(type, this.isStaking, typeInfo, campaign),
95
94
  tokensDisplay,
96
95
  };
97
96
  }
@@ -1,12 +1,11 @@
1
1
  import type { Pricer } from "@/utils/pricer";
2
2
  import { type Campaign, type CampaignParameters } from "@sdk";
3
3
  import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
4
- import { tokenType } from "../helpers/tokenType";
4
+ import { tokenType } from "../constants";
5
5
  type callType = {
6
6
  key: keyof dataRawCurve;
7
7
  call: string;
8
8
  target: keyof callKeysCurve;
9
- metaData?: keyof callKeysCurve;
10
9
  optional?: boolean;
11
10
  };
12
11
  type callKeysCurve = mandatoryCallKeys & {
@@ -1,7 +1,7 @@
1
1
  import { generateCardName } from "@/utils/generateCardName";
2
2
  import { BN2Number } from "@sdk";
3
3
  import { GenericProcessor } from "../GenericProcessor";
4
- import { tokenType } from "../helpers/tokenType";
4
+ import { tokenType } from "../constants";
5
5
  export class CurveProcessor extends GenericProcessor {
6
6
  rounds = {
7
7
  round1: [
@@ -18,7 +18,6 @@ export class CurveProcessor extends GenericProcessor {
18
18
  round3: [],
19
19
  round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
20
20
  };
21
- // override computeRound1(): void {}
22
21
  async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
23
22
  const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
24
23
  const lp_price = BN2Number(typeInfo.lp_price, 18);
@@ -74,7 +73,7 @@ export class CurveProcessor extends GenericProcessor {
74
73
  whitelistedSupplyTargetToken,
75
74
  blacklistedSupply,
76
75
  priceTargetToken,
77
- cardName: generateCardName(type, typeInfo, campaign),
76
+ cardName: generateCardName(type, this.isStaking, typeInfo, campaign),
78
77
  tokensDisplay,
79
78
  };
80
79
  }
@@ -1,12 +1,12 @@
1
1
  import type { Pricer } from "@/utils/pricer";
2
2
  import { type Campaign, type CampaignParameters } from "@sdk";
3
3
  import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
4
- import { tokenType } from "../helpers/tokenType";
4
+ import { tokenType } from "../constants";
5
5
  type callType = {
6
6
  key: keyof dataRawStakedCurve;
7
7
  call: string;
8
8
  target: keyof callKeysStakedCurve;
9
- metaData?: keyof callKeysStakedCurve;
9
+ callArgs?: keyof callKeysStakedCurve;
10
10
  optional?: boolean;
11
11
  };
12
12
  type callKeysStakedCurve = mandatoryCallKeys & {
@@ -2,7 +2,7 @@ import { generateCardName } from "@/utils/generateCardName";
2
2
  import { BN2Number } from "@sdk";
3
3
  import { BigNumber } from "ethers";
4
4
  import { GenericProcessor } from "../GenericProcessor";
5
- import { tokenType } from "../helpers/tokenType";
5
+ import { tokenType } from "../constants";
6
6
  export class StakedCurveProcessor extends GenericProcessor {
7
7
  rounds = {
8
8
  round1: [{ key: "underlying", call: "underlying", target: "tokenAddress" }],
@@ -19,11 +19,10 @@ export class StakedCurveProcessor extends GenericProcessor {
19
19
  { key: "symbolToken2", call: "symbol", target: "token2", optional: true },
20
20
  ],
21
21
  round4: [
22
- { key: "toAssets", call: "convertToAssets", target: "tokenAddress", metaData: "amount" },
22
+ { key: "toAssets", call: "convertToAssets", target: "tokenAddress", callArgs: "amount" },
23
23
  { key: "totalSupply", call: "totalSupply", target: "tokenAddress" },
24
24
  ],
25
25
  };
26
- // override computeRound1(): void {}
27
26
  processingRound3(typeInfo) {
28
27
  typeInfo.amount = BigNumber.from(10).pow(18).toString();
29
28
  }
@@ -81,7 +80,7 @@ export class StakedCurveProcessor extends GenericProcessor {
81
80
  whitelistedSupplyTargetToken,
82
81
  blacklistedSupply,
83
82
  priceTargetToken,
84
- cardName: generateCardName(type, typeInfo, campaign),
83
+ cardName: generateCardName(type, this.isStaking, typeInfo, campaign),
85
84
  tokensDisplay,
86
85
  };
87
86
  }
@@ -1,12 +1,12 @@
1
1
  import type { Pricer } from "@/utils/pricer";
2
2
  import type { Campaign, CampaignParameters } from "@sdk";
3
3
  import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
4
- import type { tokenType } from "../helpers/tokenType";
4
+ import type { tokenType } from "../constants";
5
5
  type callType = {
6
6
  key: keyof dataRawxU308;
7
7
  call: string;
8
8
  target: keyof callKeysxU308;
9
- metaData?: keyof callKeysxU308;
9
+ callArgs?: keyof callKeysxU308;
10
10
  };
11
11
  type callKeysxU308 = mandatoryCallKeys & {
12
12
  pool: string;
@@ -13,12 +13,11 @@ export class xU308Processor extends GenericProcessor {
13
13
  { key: "symbolToken1", call: "symbol", target: "_token1" },
14
14
  { key: "decimalsToken0", call: "decimals", target: "_token0" },
15
15
  { key: "decimalsToken1", call: "decimals", target: "_token1" },
16
- { key: "balanceToken0", call: "balanceOf", target: "_token0", metaData: "pool" },
17
- { key: "balanceToken1", call: "balanceOf", target: "_token1", metaData: "pool" },
16
+ { key: "balanceToken0", call: "balanceOf", target: "_token0", callArgs: "pool" },
17
+ { key: "balanceToken1", call: "balanceOf", target: "_token1", callArgs: "pool" },
18
18
  ],
19
19
  round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
20
20
  };
21
- // override computeRound1(): void {}
22
21
  processingRound2(typeInfo) {
23
22
  typeInfo.pool = "0xB387D0A73619791420De4a1e5e710023Cb0f49c0";
24
23
  }
@@ -35,7 +34,7 @@ export class xU308Processor extends GenericProcessor {
35
34
  blacklistedSupply,
36
35
  priceTargetToken,
37
36
  totalSupply,
38
- cardName: generateCardName(type, typeInfo, campaign),
37
+ cardName: generateCardName(type, this.isStaking, typeInfo, campaign),
39
38
  tokensDisplay: [{ symbol: campaign.campaignParameters.symbolTargetToken, address: typeInfo.tokenAddress }],
40
39
  };
41
40
  }
@@ -1,3 +1,17 @@
1
- import type { Campaign, CampaignParameters, ResultDto } from "@sdk";
2
- import { type tokenTypeStruct } from "./helpers/tokenType";
3
- export declare function getTokenTypeRound1(calls: ResultDto[], targetToken: string, index: number, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.ERC20LOGPROCESSOR> | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR> | CampaignParameters<Campaign.EULER>): tokenTypeStruct;
1
+ import type { CampaignParameters } from "@sdk";
2
+ import type { ERC20SupportedCampaignType } from "../dynamicData/implementations/Erc20";
3
+ import { tokenType } from "./constants";
4
+ declare function generateResult(type: tokenType, name: string, campaign: CampaignParameters<ERC20SupportedCampaignType>, data?: {
5
+ owner?: string;
6
+ factory?: string;
7
+ fundValueCalculator?: string;
8
+ dispatcher?: string;
9
+ }): import("./interface").tokenTypeStruct;
10
+ export declare function parseForStaking(campaign: CampaignParameters<ERC20SupportedCampaignType>): {
11
+ isStaking: false;
12
+ } | {
13
+ isStaking: true;
14
+ stakingContract: string;
15
+ };
16
+ export declare function getTokenTypeRound1(callResults: string[], index: number, campaign: CampaignParameters<ERC20SupportedCampaignType>): ReturnType<typeof generateResult>;
17
+ export {};
@@ -1,9 +1,9 @@
1
1
  import { decodeCall, decodeReturnValue } from "@/utils/decodeCalls";
2
+ import { tokenType } from "./constants";
3
+ import { erc20ProcessorFactory } from "./factory";
2
4
  import { enzymeFundValueCalculatorRouterMapping, getTypeFromFactoryAddress } from "./helpers/factoryFinder";
3
5
  import { getTypeFromAddressChain } from "./helpers/hardcoded";
4
6
  import { getTypeFromOwnerAddress } from "./helpers/ownerFinder";
5
- import { tokenType } from "./helpers/tokenType";
6
- import { processorMapping } from "./implementations/processorMapping";
7
7
  function satisfiesNameConditions(name, type) {
8
8
  const lowerCaseName = name.toLowerCase();
9
9
  switch (type) {
@@ -165,178 +165,168 @@ function satisfiesNameConditions(name, type) {
165
165
  return false;
166
166
  }
167
167
  }
168
- function generateResult(type, name, targetToken, typeInfo, campaign) {
169
- const ProcessorClass = processorMapping[type];
170
- if (!ProcessorClass) {
171
- throw new Error(`Processor not found for key: ${type}`);
172
- }
173
- const processorObject = new ProcessorClass();
174
- if (campaign)
175
- typeInfo = { ...typeInfo, ...parseForStaking(campaign) };
176
- typeInfo = {
177
- ...typeInfo,
168
+ function generateResult(type, name, campaign, data) {
169
+ const typeInfo = {
178
170
  name: name,
179
- tokenAddress: targetToken,
171
+ tokenAddress: campaign.campaignParameters.targetToken,
180
172
  totalSupply: 0,
181
173
  blacklistedSupply: 0,
174
+ whitelistedSupply: 0,
175
+ ...parseForStaking(campaign),
176
+ ...(data ?? {}),
182
177
  };
183
- return processorObject.computeRound1(type, typeInfo);
178
+ return erc20ProcessorFactory(type, campaign).computeRound1(typeInfo); // TODO Fix
184
179
  }
185
- function processNamingConditions(type, name, targetToken, campaign) {
180
+ function processNamingConditions(type, name, campaign) {
186
181
  if (satisfiesNameConditions(name, type)) {
187
- return generateResult(type, name, targetToken, {}, campaign);
182
+ return generateResult(type, name, campaign);
188
183
  }
189
184
  }
190
- function processNamingConditionsInOrder(types, name, targetToken, campaign) {
185
+ function processNamingConditionsInOrder(types, name, campaign) {
191
186
  for (const type of types) {
192
- const result = processNamingConditions(type, name, targetToken, campaign);
187
+ const result = processNamingConditions(type, name, campaign);
193
188
  if (result)
194
189
  return result;
195
190
  }
196
191
  }
197
- function parseForFactory(calls, targetToken, campaign) {
192
+ function parseForFactory(calls, campaign) {
198
193
  try {
199
194
  const factory = decodeReturnValue(calls.factory, "factory");
200
195
  const name = decodeReturnValue(calls.name, "name");
201
196
  const type = getTypeFromFactoryAddress(factory);
202
197
  if (type !== tokenType.unknown)
203
- return generateResult(type, name, targetToken, { factory }, campaign);
198
+ return generateResult(type, name, campaign, { factory });
204
199
  }
205
200
  catch (e) {
206
201
  // No factory on this token
207
202
  // console.log(e);
208
203
  }
209
204
  }
210
- function parseForOwner(calls, targetToken) {
205
+ function parseForOwner(calls, campaign) {
211
206
  try {
212
207
  const owner = decodeReturnValue(calls.owner, "owner");
213
208
  const name = decodeReturnValue(calls.name, "name");
214
209
  const type = getTypeFromOwnerAddress(owner);
215
210
  if (type !== tokenType.unknown)
216
- return generateResult(type, name, targetToken, { owner: owner });
211
+ return generateResult(type, name, campaign, { owner });
217
212
  }
218
213
  catch (e) {
219
214
  // No factory on this token
220
215
  // console.log(e);
221
216
  }
222
217
  }
223
- function parseForEnzyme(calls, targetToken) {
218
+ function parseForEnzyme(calls, campaign) {
224
219
  // Enzyme check
225
220
  try {
226
221
  const dispatcher = decodeReturnValue(calls.creator, "getCreator");
227
222
  const name = decodeReturnValue(calls.name, "name");
228
223
  const type = getTypeFromFactoryAddress(dispatcher);
229
224
  const fundValueCalculator = enzymeFundValueCalculatorRouterMapping[dispatcher];
230
- const typeInfo = {
231
- fundValueCalculator,
232
- dispatcher,
233
- };
234
225
  if (type === tokenType.enzyme) {
235
- return generateResult(type, name, targetToken, typeInfo);
226
+ return generateResult(type, name, campaign, {
227
+ fundValueCalculator,
228
+ dispatcher,
229
+ });
236
230
  }
237
231
  }
238
232
  catch (e) {
239
233
  // No factory on this token
240
234
  }
241
235
  }
242
- function parseForMetamorpho(calls, targetToken) {
236
+ function parseForMetamorpho(calls, campaign) {
243
237
  // MetaMorpho check
244
238
  try {
245
239
  decodeReturnValue(calls.metamorpho, "MORPHO");
246
240
  const name = decodeReturnValue(calls.name, "name");
247
- return generateResult(tokenType.metamorpho, name, targetToken, {});
241
+ return generateResult(tokenType.metamorpho, name, campaign);
248
242
  }
249
243
  catch (e) {
250
244
  // Not a metamorpho token
251
245
  }
252
246
  }
253
- function parseForBalancer(calls, targetToken, name) {
247
+ function parseForBalancer(calls, name, campaign) {
254
248
  // Check for balancer pools
255
249
  try {
256
250
  decodeReturnValue(calls.poolId, "getPoolId");
257
- return generateResult(tokenType.balancerPool, name, targetToken, {});
251
+ return generateResult(tokenType.balancerPool, name, campaign);
258
252
  }
259
253
  catch (e) {
260
254
  // Not a balancer pool
261
255
  }
262
256
  try {
263
257
  decodeReturnValue(calls.vault, "getVault");
264
- return generateResult(tokenType.balancerV3, name, targetToken, {});
258
+ return generateResult(tokenType.balancerV3, name, campaign);
265
259
  }
266
260
  catch (e) {
267
261
  // Not a balancer v3 pool
268
262
  }
269
263
  }
270
- function checkAgainstHardcoded(calls, chainId, targetToken) {
264
+ function checkAgainstHardcoded(calls, campaign) {
271
265
  // Check for balancer pools
272
266
  try {
273
267
  const name = decodeReturnValue(calls.name, "name");
274
- const type = getTypeFromAddressChain(chainId, targetToken);
268
+ const type = getTypeFromAddressChain(campaign.computeChainId, campaign.campaignParameters.targetToken);
275
269
  if (type !== tokenType.unknown)
276
- return generateResult(type, name, targetToken, {});
270
+ return generateResult(type, name, campaign);
277
271
  }
278
272
  catch (e) {
279
273
  // Not a hardcoded address
280
274
  }
281
275
  }
282
- function parseForStaking(campaign) {
276
+ export function parseForStaking(campaign) {
283
277
  try {
284
278
  const whitelist = campaign.campaignParameters.whitelist;
285
279
  if (whitelist.length === 1) {
286
280
  const forwarders = campaign.campaignParameters.forwarders;
287
281
  if (forwarders.length === 1) {
288
282
  if (forwarders[0].sender === whitelist[0]) {
289
- return { isStaking: "true", stakingContract: whitelist[0] };
283
+ return { isStaking: true, stakingContract: whitelist[0] };
290
284
  }
291
285
  }
292
286
  }
293
287
  }
294
- catch (e) {
295
- // No factory on this token
296
- // console.log(e);
297
- }
298
- return { isStaking: "false" };
288
+ catch { }
289
+ return { isStaking: false };
299
290
  }
300
- export function getTokenTypeRound1(calls, targetToken, index, campaign) {
301
- const returnValueOfCalls = calls.map(call => call.returnData);
291
+ export function getTokenTypeRound1(callResults, index, campaign) {
302
292
  const returnValue = {
303
- factory: returnValueOfCalls[index],
304
- metamorpho: returnValueOfCalls[index + 1],
305
- name: returnValueOfCalls[index + 2],
306
- poolId: returnValueOfCalls[index + 3],
307
- creator: returnValueOfCalls[index + 4],
308
- owner: returnValueOfCalls[index + 5],
309
- vault: returnValueOfCalls[index + 6],
293
+ factory: callResults[index],
294
+ metamorpho: callResults[index + 1],
295
+ name: callResults[index + 2],
296
+ poolId: callResults[index + 3],
297
+ creator: callResults[index + 4],
298
+ owner: callResults[index + 5],
299
+ vault: callResults[index + 6],
310
300
  };
311
- let result = parseForFactory(returnValue, targetToken, campaign);
301
+ let result = parseForFactory(returnValue, campaign);
312
302
  if (result)
313
303
  return result;
314
- result = parseForOwner(returnValue, targetToken);
304
+ result = parseForOwner(returnValue, campaign);
315
305
  if (result)
316
306
  return result;
317
- result = checkAgainstHardcoded(returnValue, campaign.computeChainId, targetToken);
307
+ result = checkAgainstHardcoded(returnValue, campaign);
318
308
  if (result)
319
309
  return result;
320
- result = parseForEnzyme(returnValue, targetToken);
310
+ result = parseForEnzyme(returnValue, campaign);
321
311
  if (result)
322
312
  return result;
323
- result = parseForMetamorpho(returnValue, targetToken);
313
+ result = parseForMetamorpho(returnValue, campaign);
324
314
  if (result)
325
315
  return result;
326
316
  let name;
327
317
  try {
328
- name = decodeCall(returnValueOfCalls, index + 2, "name");
318
+ name = decodeCall(callResults, index + 2, "name");
329
319
  }
330
320
  catch {
331
- return generateResult(tokenType.unknown, "Unknown", targetToken, {}, campaign);
321
+ return generateResult(tokenType.unknown, "Unknown", campaign);
332
322
  }
333
- result = parseForBalancer(returnValue, targetToken, name);
323
+ result = parseForBalancer(returnValue, name, campaign);
334
324
  if (result)
335
325
  return result;
336
326
  // Order matters
337
327
  const ordered_token_Type = Object.values(tokenType).filter(value => typeof value === "string");
338
- result = processNamingConditionsInOrder(ordered_token_Type, name, targetToken, campaign);
328
+ result = processNamingConditionsInOrder(ordered_token_Type, name, campaign);
339
329
  if (result)
340
330
  return result;
341
- return generateResult(tokenType.unknown, name, targetToken, {}, campaign);
331
+ return generateResult(tokenType.unknown, name, campaign);
342
332
  }
@@ -19,7 +19,7 @@ export class JsonAirdropMetadata {
19
19
  tokens: [
20
20
  {
21
21
  chainId: computeChainId,
22
- address: tokenAddress, // TODO: Make sure targetToken is set
22
+ address: tokenAddress,
23
23
  },
24
24
  ],
25
25
  mainProtocol: aavePrefix || aciPrefix ? "aave" : undefined,
@@ -261,20 +261,31 @@ declare const app: Elysia<"", false, {
261
261
  response: {
262
262
  200: {
263
263
  id: string;
264
- name: string;
264
+ chainId: number;
265
265
  type: string;
266
- status: import("@db/api").$Enums.Status;
267
- tags: string[];
268
266
  identifier: string;
269
- action: import("@db/api").$Enums.OpportunityAction;
270
- manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
271
- chainId: number;
272
- depositUrl: string | null;
273
- explorerAddress: string | null;
274
- mainProtocolId: string | null;
275
- tvl: number;
276
- apr: number;
277
- dailyRewards: number;
267
+ name: string;
268
+ status: "PAST" | "LIVE" | "SOON";
269
+ action: any;
270
+ tokens: ({
271
+ symbol: string;
272
+ id: string;
273
+ name: string | null;
274
+ icon: string;
275
+ address: string;
276
+ chainId: number;
277
+ decimals: number;
278
+ verified: boolean;
279
+ isTest: boolean;
280
+ isPoint: boolean;
281
+ isNative: boolean;
282
+ } & {
283
+ price?: number | null | undefined;
284
+ })[];
285
+ mainProtocol: "splice" | "morpho" | "quickswap" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "ramses" | "retro" | "stryke" | "sushi-swap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "iguana" | "xlend" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
286
+ depositUrl: any;
287
+ explorerAddress: string | undefined;
288
+ tags: string[];
278
289
  };
279
290
  };
280
291
  };
@@ -7,11 +7,16 @@ import { log } from "@/utils/logger";
7
7
  import { NETWORK_LABELS } from "@sdk";
8
8
  const main = async () => {
9
9
  try {
10
- const chains = await ChainService.getSupportedIds();
10
+ const chainIds = await ChainService.getSupportedIds();
11
11
  const promises = [];
12
- for (const chain of chains)
13
- promises.push(MerklRootRepository.fetch(chain).catch(_err => log.warn(`RPC calls cache update failed for ${NETWORK_LABELS[chain]}.`)));
14
- await Promise.allSettled(promises);
12
+ for (const chainId of chainIds)
13
+ promises.push(CacheService.set(TTLPresets.HOUR_12, MerklRootRepository.fetch, chainId));
14
+ const results = await Promise.allSettled(promises);
15
+ for (const [index, result] of results.entries()) {
16
+ if (result.status === "rejected") {
17
+ log.warn(`Failed to fetch Merkl root for ${NETWORK_LABELS[chainIds[index]]}: ${result.reason}`);
18
+ }
19
+ }
15
20
  // ─── Refresh Cache For GET /opportunities ────
16
21
  await CacheService.set(TTLPresets.MIN_5, OpportunityService.findMany, { items: 25, page: 0 });
17
22
  await CacheService.set(TTLPresets.MIN_5, OpportunityService.findMany, { items: 50, page: 0 });
@@ -116,20 +116,31 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
116
116
  response: {
117
117
  200: {
118
118
  id: string;
119
- name: string;
119
+ chainId: number;
120
120
  type: string;
121
- status: import("@db/api").$Enums.Status;
122
- tags: string[];
123
121
  identifier: string;
124
- action: import("@db/api").$Enums.OpportunityAction;
125
- manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
126
- chainId: number;
127
- depositUrl: string | null;
128
- explorerAddress: string | null;
129
- mainProtocolId: string | null;
130
- tvl: number;
131
- apr: number;
132
- dailyRewards: number;
122
+ name: string;
123
+ status: "PAST" | "LIVE" | "SOON";
124
+ action: any;
125
+ tokens: ({
126
+ symbol: string;
127
+ id: string;
128
+ name: string | null;
129
+ icon: string;
130
+ address: string;
131
+ chainId: number;
132
+ decimals: number;
133
+ verified: boolean;
134
+ isTest: boolean;
135
+ isPoint: boolean;
136
+ isNative: boolean;
137
+ } & {
138
+ price?: number | null | undefined;
139
+ })[];
140
+ mainProtocol: "splice" | "morpho" | "quickswap" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "ramses" | "retro" | "stryke" | "sushi-swap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "iguana" | "xlend" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
141
+ depositUrl: any;
142
+ explorerAddress: string | undefined;
143
+ tags: string[];
133
144
  };
134
145
  };
135
146
  };
@@ -25,20 +25,31 @@ export declare abstract class OpportunityService {
25
25
  }>;
26
26
  static deleteOverrides(id: string, overridesToDelete: OpportunityManualOverride[]): Promise<{
27
27
  id: string;
28
- name: string;
28
+ chainId: number;
29
29
  type: string;
30
- status: import("@db/api").$Enums.Status;
31
- tags: string[];
32
30
  identifier: string;
33
- action: import("@db/api").$Enums.OpportunityAction;
34
- manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
35
- chainId: number;
36
- depositUrl: string | null;
37
- explorerAddress: string | null;
38
- mainProtocolId: string | null;
39
- tvl: number;
40
- apr: number;
41
- dailyRewards: number;
31
+ name: string;
32
+ status: "PAST" | "LIVE" | "SOON";
33
+ action: OpportunityAction;
34
+ tokens: ({
35
+ symbol: string;
36
+ id: string;
37
+ name: string | null;
38
+ icon: string;
39
+ address: string;
40
+ chainId: number;
41
+ decimals: number;
42
+ verified: boolean;
43
+ isTest: boolean;
44
+ isPoint: boolean;
45
+ isNative: boolean;
46
+ } & {
47
+ price?: number | null | undefined;
48
+ })[];
49
+ mainProtocol: "splice" | "morpho" | "quickswap" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "ramses" | "retro" | "stryke" | "sushi-swap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "iguana" | "xlend" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
50
+ depositUrl: any;
51
+ explorerAddress: string | undefined;
52
+ tags: string[];
42
53
  }>;
43
54
  /**
44
55
  * create an opportunity without campaigns