@merkl/api 0.10.199 → 0.10.200

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. package/dist/src/eden/index.d.ts +2 -6398
  2. package/dist/src/errors/HttpError.d.ts +5 -0
  3. package/dist/src/errors/HttpError.js +6 -0
  4. package/dist/src/errors/NotFound.error.d.ts +4 -0
  5. package/dist/src/errors/NotFound.error.js +5 -0
  6. package/dist/src/index.d.ts +1 -2464
  7. package/dist/src/index.js +56 -7
  8. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +15 -22
  9. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +1 -0
  10. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -1
  11. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +8 -0
  12. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GammaProcessor.d.ts +43 -0
  13. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GammaProcessor.js +63 -0
  14. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.d.ts +3 -3
  15. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.js +3 -1
  16. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.d.ts +36 -0
  17. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.js +51 -0
  18. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.d.ts +0 -1
  19. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.js +15 -7
  20. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +4 -0
  21. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPrices.d.ts +1 -1
  22. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPrices.js +13 -572
  23. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.d.ts +2 -21
  24. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +197 -1174
  25. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.d.ts +1 -5
  26. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.js +11 -634
  27. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.d.ts +1 -4
  28. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.js +10 -380
  29. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4.d.ts +3 -3
  30. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4.js +11 -312
  31. package/dist/src/libs/campaigns/campaignTypes/EulerDynamicData.js +8 -8
  32. package/dist/src/libs/campaigns/campaignTypes/RadiantDynamicData.js +3 -4
  33. package/dist/src/libs/campaigns/campaignsDynamicData.js +0 -5
  34. package/dist/src/modules/v4/accounting/accounting.controller.js +1 -1
  35. package/dist/src/modules/v4/apr/apr.model.d.ts +26 -0
  36. package/dist/src/modules/v4/apr/apr.model.js +15 -1
  37. package/dist/src/modules/v4/blacklist/blacklist.controller.js +1 -1
  38. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +4 -4
  39. package/dist/src/modules/v4/campaign/campaign.controller.js +14 -4
  40. package/dist/src/modules/v4/campaign/campaign.model.d.ts +50 -5
  41. package/dist/src/modules/v4/campaign/campaign.model.js +47 -13
  42. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +2 -2
  43. package/dist/src/modules/v4/campaign/campaign.service.d.ts +2 -2
  44. package/dist/src/modules/v4/chain/chain.controller.d.ts +2 -2
  45. package/dist/src/modules/v4/chain/chain.controller.js +7 -2
  46. package/dist/src/modules/v4/chain/chain.model.d.ts +6 -1
  47. package/dist/src/modules/v4/chain/chain.model.js +8 -1
  48. package/dist/src/modules/v4/chain/chain.repository.js +1 -1
  49. package/dist/src/modules/v4/claims/claims.controller.js +1 -1
  50. package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +4 -1
  51. package/dist/src/modules/v4/enso/enso.model.d.ts +1 -1
  52. package/dist/src/modules/v4/enso/enso.model.js +2 -1
  53. package/dist/src/modules/v4/enso/enso.service.d.ts +0 -1
  54. package/dist/src/modules/v4/enso/enso.service.js +4 -4
  55. package/dist/src/modules/v4/interaction/interaction.controller.d.ts +26 -17
  56. package/dist/src/modules/v4/interaction/interaction.controller.js +19 -28
  57. package/dist/src/modules/v4/interaction/interaction.model.d.ts +17 -5
  58. package/dist/src/modules/v4/interaction/interaction.model.js +3 -3
  59. package/dist/src/modules/v4/interaction/interaction.service.d.ts +18 -3
  60. package/dist/src/modules/v4/interaction/interaction.service.js +89 -11
  61. package/dist/src/modules/v4/kyberzap/kyberzap.model.d.ts +72 -0
  62. package/dist/src/modules/v4/kyberzap/kyberzap.model.js +79 -0
  63. package/dist/src/modules/v4/kyberzap/kyberzap.service.d.ts +15 -0
  64. package/dist/src/modules/v4/kyberzap/kyberzap.service.js +84 -0
  65. package/dist/src/modules/v4/liquidity/liquidity.controller.js +1 -1
  66. package/dist/src/modules/v4/merklRoot/merklRoot.controller.js +1 -1
  67. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +224 -213
  68. package/dist/src/modules/v4/opportunity/opportunity.controller.js +39 -10
  69. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +252 -22
  70. package/dist/src/modules/v4/opportunity/opportunity.model.js +58 -15
  71. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +11 -11
  72. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +12 -232
  73. package/dist/src/modules/v4/opportunity/opportunity.service.js +0 -32
  74. package/dist/src/modules/v4/price/price.controller.js +1 -1
  75. package/dist/src/modules/v4/protocol/protocol.controller.d.ts +23 -24
  76. package/dist/src/modules/v4/protocol/protocol.controller.js +15 -9
  77. package/dist/src/modules/v4/protocol/protocol.model.d.ts +13 -1
  78. package/dist/src/modules/v4/protocol/protocol.model.js +12 -8
  79. package/dist/src/modules/v4/reward/reward.controller.js +1 -1
  80. package/dist/src/modules/v4/reward/reward.model.d.ts +44 -1
  81. package/dist/src/modules/v4/reward/reward.model.js +15 -0
  82. package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -2
  83. package/dist/src/modules/v4/reward/reward.service.d.ts +11 -11
  84. package/dist/src/modules/v4/reward/reward.service.js +1 -1
  85. package/dist/src/modules/v4/router.d.ts +287 -268
  86. package/dist/src/modules/v4/status/status.controller.js +2 -3
  87. package/dist/src/modules/v4/status/status.model.d.ts +12 -0
  88. package/dist/src/modules/v4/status/status.model.js +12 -0
  89. package/dist/src/modules/v4/token/token.controller.d.ts +4 -4
  90. package/dist/src/modules/v4/token/token.controller.js +1 -1
  91. package/dist/src/modules/v4/token/token.model.d.ts +12 -0
  92. package/dist/src/modules/v4/token/token.model.js +12 -0
  93. package/dist/src/modules/v4/token/token.repository.d.ts +2 -2
  94. package/dist/src/modules/v4/token/token.service.d.ts +7 -7
  95. package/dist/src/modules/v4/tvl/tvl.model.d.ts +24 -0
  96. package/dist/src/modules/v4/tvl/tvl.model.js +15 -1
  97. package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.d.ts +1 -1
  98. package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.js +9 -8
  99. package/dist/src/modules/v4/user/user.controller.d.ts +4 -4
  100. package/dist/src/modules/v4/user/user.controller.js +20 -17
  101. package/dist/src/modules/v4/user/user.model.d.ts +30 -0
  102. package/dist/src/modules/v4/user/user.model.js +27 -0
  103. package/dist/src/modules/v4/zyfi/zyfi.model.d.ts +45 -0
  104. package/dist/src/modules/v4/zyfi/zyfi.model.js +1 -0
  105. package/dist/src/modules/v4/zyfi/zyfi.service.d.ts +30 -0
  106. package/dist/src/modules/v4/zyfi/zyfi.service.js +35 -0
  107. package/dist/src/plugins/error-handling.plugin.d.ts +2 -2
  108. package/dist/src/plugins/error-handling.plugin.js +9 -3
  109. package/dist/src/plugins/logger.plugin.js +1 -20
  110. package/dist/src/routes/v1/allowances.d.ts +1 -1
  111. package/dist/src/routes/v1/allowances.js +1 -1
  112. package/dist/src/routes/v1/balances.d.ts +1 -1
  113. package/dist/src/routes/v1/balances.js +1 -1
  114. package/dist/src/routes/v1/prices.d.ts +1 -1
  115. package/dist/src/routes/v1/prices.js +1 -1
  116. package/dist/src/routes/v1/router.d.ts +102 -0
  117. package/dist/src/routes/v1/router.js +6 -0
  118. package/dist/src/routes/v1/tokens.d.ts +1 -1
  119. package/dist/src/routes/v1/tokens.js +1 -1
  120. package/dist/src/routes/v2/merkl.d.ts +5 -5
  121. package/dist/src/routes/v2/merkl.js +1 -1
  122. package/dist/src/routes/v2/router.d.ts +46 -0
  123. package/dist/src/routes/v2/router.js +3 -0
  124. package/dist/src/routes/v3/app.d.ts +1 -1
  125. package/dist/src/routes/v3/app.js +1 -1
  126. package/dist/src/routes/v3/blacklist.d.ts +1 -2479
  127. package/dist/src/routes/v3/blacklist.js +1 -1
  128. package/dist/src/routes/v3/campaignClaims.d.ts +1 -1
  129. package/dist/src/routes/v3/campaignClaims.js +1 -1
  130. package/dist/src/routes/v3/campaignReport.d.ts +1 -1
  131. package/dist/src/routes/v3/campaignReport.js +1 -1
  132. package/dist/src/routes/v3/campaignUnclaimed.d.ts +1 -1
  133. package/dist/src/routes/v3/campaignUnclaimed.js +1 -1
  134. package/dist/src/routes/v3/campaigns.d.ts +1 -2483
  135. package/dist/src/routes/v3/campaigns.js +1 -1
  136. package/dist/src/routes/v3/campaignsForMainParameter.d.ts +1 -1
  137. package/dist/src/routes/v3/campaignsForMainParameter.js +1 -1
  138. package/dist/src/routes/v3/campaignsInfo.d.ts +1 -2481
  139. package/dist/src/routes/v3/campaignsInfo.js +1 -1
  140. package/dist/src/routes/v3/campaignsRewardsReport.d.ts +1 -1
  141. package/dist/src/routes/v3/campaignsRewardsReport.js +1 -1
  142. package/dist/src/routes/v3/claims.d.ts +1 -1
  143. package/dist/src/routes/v3/claims.js +1 -1
  144. package/dist/src/routes/v3/compoundV2.d.ts +1 -1
  145. package/dist/src/routes/v3/compoundV2.js +1 -1
  146. package/dist/src/routes/v3/createCampaign.d.ts +1 -1
  147. package/dist/src/routes/v3/createCampaign.js +1 -1
  148. package/dist/src/routes/v3/dolomite.d.ts +1 -1
  149. package/dist/src/routes/v3/dolomite.js +1 -1
  150. package/dist/src/routes/v3/euler.d.ts +1 -1
  151. package/dist/src/routes/v3/euler.js +1 -1
  152. package/dist/src/routes/v3/fetch.d.ts +1 -1
  153. package/dist/src/routes/v3/fetch.js +1 -1
  154. package/dist/src/routes/v3/health.d.ts +1 -1
  155. package/dist/src/routes/v3/health.js +1 -1
  156. package/dist/src/routes/v3/lostyield.d.ts +1 -1
  157. package/dist/src/routes/v3/lostyield.js +1 -1
  158. package/dist/src/routes/v3/merkl.d.ts +1 -1
  159. package/dist/src/routes/v3/merkl.js +1 -1
  160. package/dist/src/routes/v3/morphoMarkets.d.ts +1 -1
  161. package/dist/src/routes/v3/morphoMarkets.js +1 -1
  162. package/dist/src/routes/v3/morphoVaults.d.ts +1 -1
  163. package/dist/src/routes/v3/morphoVaults.js +1 -1
  164. package/dist/src/routes/v3/multiChainPositions.d.ts +1 -2480
  165. package/dist/src/routes/v3/multiChainPositions.js +1 -1
  166. package/dist/src/routes/v3/opportunity.d.ts +1 -2483
  167. package/dist/src/routes/v3/opportunity.js +1 -1
  168. package/dist/src/routes/v3/overview.d.ts +1 -1
  169. package/dist/src/routes/v3/overview.js +1 -1
  170. package/dist/src/routes/v3/parse.d.ts +1 -1
  171. package/dist/src/routes/v3/parse.js +1 -1
  172. package/dist/src/routes/v3/payload.d.ts +1 -1
  173. package/dist/src/routes/v3/payload.js +1 -1
  174. package/dist/src/routes/v3/poolInfo.js +1 -1
  175. package/dist/src/routes/v3/positions.d.ts +1 -2479
  176. package/dist/src/routes/v3/positions.js +1 -1
  177. package/dist/src/routes/v3/radiant.d.ts +1 -1
  178. package/dist/src/routes/v3/radiant.js +1 -1
  179. package/dist/src/routes/v3/recipients.d.ts +1 -1
  180. package/dist/src/routes/v3/recipients.js +1 -1
  181. package/dist/src/routes/v3/rewards.d.ts +1 -2508
  182. package/dist/src/routes/v3/rewards.js +1 -1
  183. package/dist/src/routes/v3/rewardsReport.d.ts +1 -1
  184. package/dist/src/routes/v3/rewardsReport.js +1 -1
  185. package/dist/src/routes/v3/router.d.ts +1 -0
  186. package/dist/src/routes/v3/router.js +74 -0
  187. package/dist/src/routes/v3/silo.d.ts +1 -1
  188. package/dist/src/routes/v3/silo.js +1 -1
  189. package/dist/src/routes/v3/token.d.ts +1 -1
  190. package/dist/src/routes/v3/token.js +1 -1
  191. package/dist/src/routes/v3/tokenUnclaimed.d.ts +1 -1
  192. package/dist/src/routes/v3/tokenUnclaimed.js +1 -1
  193. package/dist/src/routes/v3/updates.d.ts +1 -2483
  194. package/dist/src/routes/v3/updates.js +1 -1
  195. package/dist/src/routes/v3/userRewards.d.ts +1 -2499
  196. package/dist/src/routes/v3/userRewards.js +1 -1
  197. package/dist/src/utils/decodeCalls.js +12 -1
  198. package/dist/src/utils/encodeCalls.js +26 -3
  199. package/dist/src/utils/generateCardName.js +2 -0
  200. package/dist/tsconfig.package.tsbuildinfo +1 -1
  201. package/package.json +2 -3
  202. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.d.ts +0 -3
  203. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.js +0 -155
  204. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPricesRefactoFinal.d.ts +0 -4
  205. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPricesRefactoFinal.js +0 -24
  206. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.d.ts +0 -4
  207. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +0 -230
  208. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2RefactoFinal.d.ts +0 -3
  209. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2RefactoFinal.js +0 -22
  210. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3RefactoFinal.d.ts +0 -3
  211. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3RefactoFinal.js +0 -22
  212. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4RefactoFinal.d.ts +0 -4
  213. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4RefactoFinal.js +0 -22
  214. package/dist/src/libs/campaigns/campaignsDynamicDataRefacto.d.ts +0 -3
  215. package/dist/src/libs/campaigns/campaignsDynamicDataRefacto.js +0 -75
@@ -1,323 +1,22 @@
1
- import { BN2Number, ERC20Interface } from "@sdk";
2
- import { tokenType } from "./helpers/tokenType";
3
- import { eulerInterface, fluidInterface, torosInterface } from "./subtypesRound1";
4
- import { balancerVaultInterface } from "./subtypesRound3";
1
+ import { processorMapping } from "./processor/processorMapping";
5
2
  export function getTokenTypeRound4(index, type, typeInfo, calls, campaign) {
6
- const blacklistedLiquidityCalls = [];
7
- if (campaign.campaignParameters.blacklist.length > 0) {
8
- for (const blacklistedAddress of campaign.campaignParameters.blacklist) {
9
- blacklistedLiquidityCalls.push({
10
- allowFailure: true,
11
- callData: ERC20Interface.encodeFunctionData("balanceOf", [blacklistedAddress]),
12
- target: typeInfo.tokenAddress,
13
- });
3
+ try {
4
+ const ProcessorClass = processorMapping[type];
5
+ const returnValueOfCalls = calls.map(call => call.returnData);
6
+ if (!ProcessorClass) {
7
+ throw new Error(`Processor not found for key: ${type}`);
14
8
  }
9
+ const processorObject = new ProcessorClass();
10
+ return processorObject.computeRound4(index, type, typeInfo, returnValueOfCalls, campaign);
15
11
  }
16
- const whitelistedLiquidityCalls = [];
17
- if (campaign.campaignParameters.whitelist.length > 0) {
18
- for (const whitelistedAddress of campaign.campaignParameters.whitelist) {
19
- whitelistedLiquidityCalls.push({
20
- allowFailure: true,
21
- callData: ERC20Interface.encodeFunctionData("balanceOf", [whitelistedAddress]),
22
- target: typeInfo.tokenAddress,
23
- });
24
- }
25
- }
26
- if (type === tokenType.uniswapv2 ||
27
- type === tokenType.poolside ||
28
- type === tokenType.aerodrome ||
29
- type === tokenType.velodrome ||
30
- type === tokenType.dragonswap ||
31
- type === tokenType.akron) {
32
- return {
33
- type: type,
34
- calls: [
35
- {
36
- allowFailure: true,
37
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
38
- target: typeInfo.tokenAddress,
39
- },
40
- ].concat(blacklistedLiquidityCalls),
41
- typeInfo: {
42
- ...typeInfo,
43
- },
44
- };
45
- }
46
- if (type === tokenType.balancerGauge) {
47
- const tokens = balancerVaultInterface.decodeFunctionResult("getPoolTokens", calls[index].returnData)[0];
48
- const balances = balancerVaultInterface.decodeFunctionResult("getPoolTokens", calls[index].returnData)[1];
49
- let i = 0;
50
- const poolTokens = [];
51
- for (const token of tokens) {
52
- poolTokens.push({
53
- token: token,
54
- balance: balances[i].toString(),
55
- });
56
- i++;
57
- }
58
- const poolCalls = [
59
- {
60
- allowFailure: true,
61
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
62
- target: typeInfo.tokenAddress,
63
- },
64
- ];
65
- for (const poolToken of poolTokens) {
66
- poolCalls.push({
67
- allowFailure: true,
68
- callData: ERC20Interface.encodeFunctionData("symbol"),
69
- target: poolToken.token,
70
- });
71
- poolCalls.push({
72
- allowFailure: true,
73
- callData: ERC20Interface.encodeFunctionData("decimals"),
74
- target: poolToken.token,
75
- });
76
- }
77
- return {
78
- type: tokenType.balancerGauge,
79
- calls: poolCalls.concat(blacklistedLiquidityCalls),
80
- typeInfo: {
81
- ...typeInfo,
82
- poolTokens: poolTokens,
83
- },
84
- };
85
- }
86
- // symbol is ECLP-USDC-USDT
87
- if (type === tokenType.balancerPool) {
88
- const tokens = balancerVaultInterface.decodeFunctionResult("getPoolTokens", calls[index].returnData)[0];
89
- const balances = balancerVaultInterface.decodeFunctionResult("getPoolTokens", calls[index].returnData)[1];
90
- let i = 0;
91
- const poolTokens = [];
92
- for (const token of tokens) {
93
- if (token !== typeInfo.tokenAddress) {
94
- poolTokens.push({
95
- token: token,
96
- balance: balances[i].toString(),
97
- });
98
- }
99
- i++;
100
- }
101
- const poolCalls = [
102
- {
103
- allowFailure: true,
104
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
105
- target: typeInfo.tokenAddress,
106
- },
107
- ];
108
- for (const poolToken of poolTokens) {
109
- poolCalls.push({
110
- allowFailure: true,
111
- callData: ERC20Interface.encodeFunctionData("symbol"),
112
- target: poolToken.token,
113
- });
114
- poolCalls.push({
115
- allowFailure: true,
116
- callData: ERC20Interface.encodeFunctionData("decimals"),
117
- target: poolToken.token,
118
- });
119
- }
120
- poolCalls.push({
121
- allowFailure: true,
122
- callData: ERC20Interface.encodeFunctionData("balanceOf", [typeInfo.vault]),
123
- target: typeInfo.tokenAddress,
124
- });
125
- return {
126
- type: tokenType.balancerPool,
127
- calls: poolCalls.concat(blacklistedLiquidityCalls),
128
- typeInfo: {
129
- ...typeInfo,
130
- poolTokens: poolTokens,
131
- },
132
- };
133
- }
134
- if (type === tokenType.aura) {
135
- const tokens = balancerVaultInterface.decodeFunctionResult("getPoolTokens", calls[index].returnData)[0];
136
- const balances = balancerVaultInterface.decodeFunctionResult("getPoolTokens", calls[index].returnData)[1];
137
- let i = 0;
138
- const poolTokens = [];
139
- for (const token of tokens) {
140
- if (token !== typeInfo.tokenAddress) {
141
- poolTokens.push({
142
- token: token,
143
- balance: balances[i].toString(),
144
- });
145
- }
146
- i++;
147
- }
148
- const poolCalls = [
149
- {
150
- allowFailure: true,
151
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
152
- target: typeInfo.tokenAddress,
153
- },
154
- ];
155
- for (const poolToken of poolTokens) {
156
- poolCalls.push({
157
- allowFailure: true,
158
- callData: ERC20Interface.encodeFunctionData("symbol"),
159
- target: poolToken.token,
160
- });
161
- poolCalls.push({
162
- allowFailure: true,
163
- callData: ERC20Interface.encodeFunctionData("decimals"),
164
- target: poolToken.token,
165
- });
166
- }
167
- const gaugeBalance = ERC20Interface.decodeFunctionResult("balanceOf", calls[index + 1].returnData)[0];
168
- const auraBalance = ERC20Interface.decodeFunctionResult("balanceOf", calls[index + 2].returnData)[0];
169
- const totalSupplyGauge = ERC20Interface.decodeFunctionResult("totalSupply", calls[index + 3].returnData)[0];
12
+ catch (error) {
13
+ console.error(error);
170
14
  return {
171
15
  type: type,
172
- calls: poolCalls.concat(blacklistedLiquidityCalls),
16
+ calls: [],
173
17
  typeInfo: {
174
18
  ...typeInfo,
175
- poolTokens: poolTokens,
176
- gaugeBalance: BN2Number(gaugeBalance, 18),
177
- auraBalance: BN2Number(auraBalance, 18),
178
- totalSupplyGauge: BN2Number(totalSupplyGauge, 18),
179
19
  },
180
20
  };
181
21
  }
182
- if (type === tokenType.gearbox) {
183
- // Get the underlying gearbox token to fetch the final underlying token
184
- const decimalsUnderlyingToken = ERC20Interface.decodeFunctionResult("decimals", calls[index].returnData)[0];
185
- const symbolUnderlyingToken = ERC20Interface.decodeFunctionResult("symbol", calls[index + 1].returnData)[0];
186
- const totalAssets = BN2Number(typeInfo.totalAssets, decimalsUnderlyingToken);
187
- return {
188
- type: tokenType.gearbox,
189
- calls: [
190
- {
191
- allowFailure: true,
192
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
193
- target: typeInfo.tokenAddress,
194
- },
195
- ].concat(blacklistedLiquidityCalls),
196
- typeInfo: {
197
- ...typeInfo,
198
- decimalsUnderlyingToken,
199
- symbolUnderlyingToken,
200
- totalAssets: totalAssets,
201
- },
202
- };
203
- }
204
- if (type === tokenType.toros) {
205
- return {
206
- type: type,
207
- calls: [
208
- {
209
- allowFailure: true,
210
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
211
- target: typeInfo.tokenAddress,
212
- },
213
- {
214
- allowFailure: true,
215
- callData: torosInterface.encodeFunctionData("tokenPrice"),
216
- target: typeInfo.tokenAddress,
217
- },
218
- ].concat(blacklistedLiquidityCalls),
219
- typeInfo: {
220
- ...typeInfo,
221
- },
222
- };
223
- }
224
- if (type === tokenType.fluid) {
225
- const toAssets = fluidInterface.decodeFunctionResult("convertToAssets", calls[index].returnData)[0];
226
- return {
227
- type: type,
228
- calls: [
229
- {
230
- allowFailure: true,
231
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
232
- target: typeInfo.tokenAddress,
233
- },
234
- ].concat(blacklistedLiquidityCalls),
235
- typeInfo: {
236
- ...typeInfo,
237
- exchangeRate: BN2Number(toAssets, typeInfo.decimalsUnderlyingToken),
238
- },
239
- };
240
- }
241
- if (type === tokenType.euler_lend || type === tokenType.euler_borrow) {
242
- const decimalsUnderlyingToken = ERC20Interface.decodeFunctionResult("decimals", calls[index].returnData)[0];
243
- const symbolUnderlyingToken = ERC20Interface.decodeFunctionResult("symbol", calls[index + 1].returnData)[0];
244
- let call;
245
- if (type === tokenType.euler_lend) {
246
- call = {
247
- allowFailure: true,
248
- callData: eulerInterface.encodeFunctionData("totalAssets"),
249
- target: typeInfo.tokenAddress,
250
- };
251
- }
252
- else {
253
- call = {
254
- allowFailure: true,
255
- callData: eulerInterface.encodeFunctionData("totalBorrows"),
256
- target: typeInfo.vault,
257
- };
258
- }
259
- return {
260
- type: type,
261
- calls: [
262
- {
263
- allowFailure: true,
264
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
265
- target: typeInfo.tokenAddress,
266
- },
267
- call,
268
- ].concat(blacklistedLiquidityCalls),
269
- typeInfo: {
270
- ...typeInfo,
271
- decimalsUnderlyingToken: decimalsUnderlyingToken,
272
- symbolUnderlyingToken: symbolUnderlyingToken,
273
- },
274
- };
275
- }
276
- if (type === tokenType.beefy) {
277
- const symbolToken0 = ERC20Interface.decodeFunctionResult("symbol", calls[index].returnData)[0];
278
- const symbolToken1 = ERC20Interface.decodeFunctionResult("symbol", calls[index + 1].returnData)[0];
279
- const decimalsToken0 = ERC20Interface.decodeFunctionResult("decimals", calls[index + 2].returnData)[0];
280
- const decimalsToken1 = ERC20Interface.decodeFunctionResult("decimals", calls[index + 3].returnData)[0];
281
- const balanceToken0 = ERC20Interface.decodeFunctionResult("balanceOf", calls[index + 4].returnData)[0];
282
- const balanceToken1 = ERC20Interface.decodeFunctionResult("balanceOf", calls[index + 5].returnData)[0];
283
- return {
284
- type: type,
285
- calls: [
286
- {
287
- allowFailure: true,
288
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
289
- target: typeInfo.underlyingToken,
290
- },
291
- {
292
- allowFailure: true,
293
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
294
- target: typeInfo.tokenAddress,
295
- },
296
- ],
297
- typeInfo: {
298
- ...typeInfo,
299
- symbolToken0,
300
- symbolToken1,
301
- decimalsToken0,
302
- decimalsToken1,
303
- balanceToken0: BN2Number(balanceToken0, decimalsToken0),
304
- balanceToken1: BN2Number(balanceToken1, decimalsToken1),
305
- },
306
- };
307
- }
308
- return {
309
- type: type,
310
- calls: [
311
- {
312
- allowFailure: true,
313
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
314
- target: typeInfo.tokenAddress,
315
- },
316
- ]
317
- .concat(blacklistedLiquidityCalls)
318
- .concat(whitelistedLiquidityCalls),
319
- typeInfo: {
320
- ...typeInfo,
321
- },
322
- };
323
22
  }
@@ -1,11 +1,11 @@
1
- import { BN2Number, ERC20Interface, EulerSubCampaignType, YEAR, } from "@sdk";
1
+ import { BN2Number, BalancerPoolInterface, ERC20Interface, EnzymeInterface, EulerSubCampaignType, FactoryInterface, MetamorphoInterface, YEAR, } from "@sdk";
2
2
  import { batchMulticallCallWithRetry } from "../../../utils/generic";
3
3
  import { Pricer } from "../../../utils/pricer";
4
4
  import { fetchEulerVaultName } from "./ERC20SubTypes/helpers/eulerVaultNames";
5
5
  import { tokenType } from "./ERC20SubTypes/helpers/tokenType";
6
6
  import { getTokenPricesInfo } from "./ERC20SubTypes/subtypesPrices";
7
- import { enzymeInterface, factoryInterface, getTokenTypeRound1, metamorphoInterface, } from "./ERC20SubTypes/subtypesRound1";
8
- import { balancerPoolInterface, getTokenTypeRound2 } from "./ERC20SubTypes/subtypesRound2";
7
+ import { getTokenTypeRound1 } from "./ERC20SubTypes/subtypesRound1";
8
+ import { getTokenTypeRound2 } from "./ERC20SubTypes/subtypesRound2";
9
9
  import { getTokenTypeRound3 } from "./ERC20SubTypes/subtypesRound3";
10
10
  import { getTokenTypeRound4 } from "./ERC20SubTypes/subtypesRound4";
11
11
  export async function EulerDynamicData(chainId, campaigns) {
@@ -15,12 +15,12 @@ export async function EulerDynamicData(chainId, campaigns) {
15
15
  for (const campaign of campaigns) {
16
16
  callsRounds1.push({
17
17
  allowFailure: true,
18
- callData: factoryInterface.encodeFunctionData("factory"),
18
+ callData: FactoryInterface.encodeFunctionData("factory"),
19
19
  target: campaign.campaignParameters.targetToken,
20
20
  });
21
21
  callsRounds1.push({
22
22
  allowFailure: true,
23
- callData: metamorphoInterface.encodeFunctionData("MORPHO"),
23
+ callData: MetamorphoInterface.encodeFunctionData("MORPHO"),
24
24
  target: campaign.campaignParameters.targetToken,
25
25
  });
26
26
  callsRounds1.push({
@@ -30,12 +30,12 @@ export async function EulerDynamicData(chainId, campaigns) {
30
30
  });
31
31
  callsRounds1.push({
32
32
  allowFailure: true,
33
- callData: balancerPoolInterface.encodeFunctionData("getPoolId"),
33
+ callData: BalancerPoolInterface.encodeFunctionData("getPoolId"),
34
34
  target: campaign.campaignParameters.targetToken,
35
35
  });
36
36
  callsRounds1.push({
37
37
  allowFailure: true,
38
- callData: enzymeInterface.encodeFunctionData("getCreator"),
38
+ callData: EnzymeInterface.encodeFunctionData("getCreator"),
39
39
  target: campaign.campaignParameters.targetToken,
40
40
  });
41
41
  }
@@ -52,7 +52,7 @@ export async function EulerDynamicData(chainId, campaigns) {
52
52
  calls: [],
53
53
  typeInfo: {},
54
54
  };
55
- typeStruct = getTokenTypeRound1(resultRound1, campaign.campaignParameters.targetToken, i);
55
+ typeStruct = getTokenTypeRound1(resultRound1, campaign.campaignParameters.targetToken, i, campaign);
56
56
  i += 5;
57
57
  tokenTypesByCampaign[campaign.campaignId] = typeStruct;
58
58
  callsRounds2.push(...typeStruct.calls);
@@ -1,12 +1,11 @@
1
1
  import { engineDbClient } from "../../../utils/prisma";
2
- import { BN2Number, ERC20Interface, NULL_ADDRESS, RadiantPoolInterface, YEAR, } from "@sdk";
2
+ import { BN2Number, ERC20Interface, NULL_ADDRESS, RadiantInterface, RadiantPoolInterface, YEAR, } from "@sdk";
3
3
  import { Contract } from "ethers";
4
4
  import { log } from "../../../utils/logger";
5
5
  import { Pricer } from "../../../utils/pricer";
6
6
  import { providers } from "../../../utils/providers";
7
7
  import { merklChainDataWithCache } from "../../merklChainData";
8
8
  import { getLastEligibilityRatio } from "../utils/getLastEligibilityRatio";
9
- import { radiantInterface } from "./ERC20SubTypes/subtypesRound1";
10
9
  export async function RadiantDynamicData(chainId, campaigns) {
11
10
  const pricer = await Pricer.load();
12
11
  const calls = [];
@@ -24,7 +23,7 @@ export async function RadiantDynamicData(chainId, campaigns) {
24
23
  });
25
24
  calls.push({
26
25
  allowFailure: true,
27
- callData: radiantInterface.encodeFunctionData("getAssetPrice"),
26
+ callData: RadiantInterface.encodeFunctionData("getAssetPrice"),
28
27
  target: campaign.campaignParameters.targetToken,
29
28
  });
30
29
  }
@@ -79,7 +78,7 @@ export async function RadiantDynamicData(chainId, campaigns) {
79
78
  i++;
80
79
  let priceTargetToken = 0;
81
80
  try {
82
- priceTargetToken = BN2Number(radiantInterface.decodeFunctionResult("getAssetPrice", result[i])[0], priceDecimals);
81
+ priceTargetToken = BN2Number(RadiantInterface.decodeFunctionResult("getAssetPrice", result[i])[0], priceDecimals);
83
82
  }
84
83
  catch (e) {
85
84
  log.local("Error getting priceTargetToken");
@@ -7,7 +7,6 @@ import { CLAMMDynamicData } from "./campaignTypes/CLAMMDynamicData";
7
7
  import { CompoundDynamicData } from "./campaignTypes/CompoundDynamicData";
8
8
  import { DolomiteDynamicData } from "./campaignTypes/DolomiteDynamicData";
9
9
  import { ERC20DynamicData } from "./campaignTypes/ERC20DynamicData";
10
- import { ERC20DynamicDataRefacto } from "./campaignTypes/ERC20DynamicDataRefacto";
11
10
  import { ERC20_SNAPSHOTDynamicData } from "./campaignTypes/ERC20_SNAPSHOTDynamicData";
12
11
  import { EulerDynamicData } from "./campaignTypes/EulerDynamicData";
13
12
  import { JSON_AIRDROPDynamicData } from "./campaignTypes/JSON_AIRDROPDynamicData";
@@ -27,10 +26,6 @@ export async function campaignsDynamicData(chainId, campaigns, type) {
27
26
  catch (_err) { }
28
27
  switch (type) {
29
28
  case Campaign.ERC20: {
30
- const switchRefacto = process.env.SWITCH_REFACTO_SUBTYPES_ERC20 !== undefined ? process.env.SWITCH_REFACTO_SUBTYPES_ERC20 : false;
31
- if (switchRefacto) {
32
- return ERC20DynamicDataRefacto(chainId, campaigns);
33
- }
34
29
  return ERC20DynamicData(chainId, campaigns);
35
30
  }
36
31
  case Campaign.CLAMM: {
@@ -2,7 +2,7 @@ import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOf
2
2
  import { AccountingService, ChainDto, DateDto, GetTransactionsQueryModel, RevenuesDto, TokensDateDto, TokensDto, } from "./";
3
3
  import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "../../../utils/throw";
4
4
  import Elysia from "elysia";
5
- export const AccountingController = new Elysia({ prefix: "/accounting", detail: { tags: ["Accounting"] } })
5
+ export const AccountingController = new Elysia({ prefix: "/accounting", detail: { tags: ["Accounting"], hide: true } })
6
6
  .get("/", async ({ query }) => await AccountingService.getMany(query), {
7
7
  query: GetTransactionsQueryModel,
8
8
  headers: AuthorizationHeadersDto,
@@ -13,3 +13,29 @@ export type AprRecord = Resource<"AprRecord", "id" | "opportunityId", {
13
13
  * @see {@link Resource}
14
14
  */
15
15
  export type AprBreakdown = Resource<"AprBreakdown", "id" | "aprRecordId">;
16
+ export declare const AprBreakdownResourceDto: import("@sinclair/typebox").TObject<{
17
+ id: import("@sinclair/typebox").TNumber;
18
+ type: import("@sinclair/typebox").TEnum<{
19
+ CAMPAIGN: "CAMPAIGN";
20
+ TOKEN: "TOKEN";
21
+ PROTOCOL: "PROTOCOL";
22
+ }>;
23
+ identifier: import("@sinclair/typebox").TString;
24
+ value: import("@sinclair/typebox").TNumber;
25
+ aprRecordId: import("@sinclair/typebox").TString;
26
+ }>;
27
+ export declare const AprRecordResourceDto: import("@sinclair/typebox").TObject<{
28
+ cumulated: import("@sinclair/typebox").TNumber;
29
+ timestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
30
+ breakdowns: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
31
+ id: import("@sinclair/typebox").TNumber;
32
+ type: import("@sinclair/typebox").TEnum<{
33
+ CAMPAIGN: "CAMPAIGN";
34
+ TOKEN: "TOKEN";
35
+ PROTOCOL: "PROTOCOL";
36
+ }>;
37
+ identifier: import("@sinclair/typebox").TString;
38
+ value: import("@sinclair/typebox").TNumber;
39
+ aprRecordId: import("@sinclair/typebox").TString;
40
+ }>>;
41
+ }>;
@@ -1 +1,15 @@
1
- export {};
1
+ import { AprType } from "../../../../database/api/.generated";
2
+ import { t } from "elysia";
3
+ // ─── Dtos ────────────────────────────────────────────────────────────────────
4
+ export const AprBreakdownResourceDto = t.Object({
5
+ id: t.Number(),
6
+ type: t.Enum(AprType),
7
+ identifier: t.String(),
8
+ value: t.Number(),
9
+ aprRecordId: t.String(),
10
+ });
11
+ export const AprRecordResourceDto = t.Object({
12
+ cumulated: t.Number(),
13
+ timestamp: t.Union([t.BigInt(), t.String()]),
14
+ breakdowns: t.Array(AprBreakdownResourceDto),
15
+ });
@@ -4,7 +4,7 @@ import { NULL_ADDRESS } from "@sdk";
4
4
  import Elysia from "elysia";
5
5
  import { AddBlacklistDto, CheckBlacklistDto, RemoveBlacklistDto } from "./blacklist.model";
6
6
  import { BlacklistService } from "./blacklist.service";
7
- export const BlacklistController = new Elysia({ prefix: "/blacklists", detail: { tags: ["Blacklists"] } })
7
+ export const BlacklistController = new Elysia({ prefix: "/blacklists", detail: { tags: ["Blacklists"], hide: true } })
8
8
  // ─── Get Entire Blacklist ────────────────────────────────────────────
9
9
  .get("/", async () => await BlacklistService.findMany())
10
10
  .get("/mapping", async () => await BlacklistService.findMapping())
@@ -20,13 +20,13 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
20
20
  subType?: number | undefined;
21
21
  type: number;
22
22
  params: string;
23
+ creator: string;
23
24
  chainId: number;
24
25
  startTimestamp: string;
25
26
  endTimestamp: string;
26
27
  computeChainId: number;
27
28
  campaignId: string;
28
29
  amount: string;
29
- creator: string;
30
30
  rewardTokenAddress: string;
31
31
  opportunityIdentifier: string;
32
32
  };
@@ -63,11 +63,11 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
63
63
  type?: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | undefined;
64
64
  items?: number | undefined;
65
65
  subType?: number | undefined;
66
+ page?: number | undefined;
66
67
  chainId?: number | undefined;
67
68
  startTimestamp?: string | undefined;
68
69
  endTimestamp?: string | undefined;
69
70
  tokenAddress?: string | undefined;
70
- page?: number | undefined;
71
71
  mainParameter?: string | undefined;
72
72
  campaignId?: string | undefined;
73
73
  opportunityId?: string | undefined;
@@ -87,9 +87,9 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
87
87
  symbol: string;
88
88
  name: string | null;
89
89
  id: string;
90
+ icon: string;
90
91
  chainId: number;
91
92
  address: string;
92
- icon: string;
93
93
  decimals: number;
94
94
  verified: boolean;
95
95
  isTest: boolean;
@@ -134,11 +134,11 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
134
134
  type?: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | undefined;
135
135
  items?: number | undefined;
136
136
  subType?: number | undefined;
137
+ page?: number | undefined;
137
138
  chainId?: number | undefined;
138
139
  startTimestamp?: string | undefined;
139
140
  endTimestamp?: string | undefined;
140
141
  tokenAddress?: string | undefined;
141
- page?: number | undefined;
142
142
  mainParameter?: string | undefined;
143
143
  campaignId?: string | undefined;
144
144
  opportunityId?: string | undefined;
@@ -1,8 +1,8 @@
1
1
  import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
2
- import Elysia from "elysia";
2
+ import Elysia, { t } from "elysia";
3
3
  import { throwOnUnsupportedChainId } from "src/utils/throw";
4
4
  import { ChainUniqueDto } from "../chain";
5
- import { CreateCampaignDto, GetCampaignQueryDto } from "./campaign.model";
5
+ import { CampaignResourceDto, CreateCampaignDto, GetCampaignQueryDto } from "./campaign.model";
6
6
  import { CampaignService } from "./campaign.service";
7
7
  // ─── Campaigns Controller ────────────────────────────────────────────────────
8
8
  export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { tags: ["Campaigns"] } })
@@ -14,9 +14,17 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
14
14
  detail: { hide: true },
15
15
  })
16
16
  // ─── Get Many Campaigns ──────────────────────────────────────────────
17
- .get("/", async ({ query }) => await CampaignService.findMany(query), { query: GetCampaignQueryDto })
17
+ .get("/", async ({ query }) => await CampaignService.findMany(query), {
18
+ query: GetCampaignQueryDto,
19
+ response: t.Array(CampaignResourceDto),
20
+ detail: `**Retrieve Multiple Campaigns**
21
+ <p>This endpoint enables you to search for opportunities by providing specific criteria through query parameters.</p>`,
22
+ })
18
23
  // ─── Get Total Campaigns Count ───────────────────────────────────────
19
- .get("/count", async ({ query }) => await CampaignService.countMany(query), { query: GetCampaignQueryDto })
24
+ .get("/count", async ({ query }) => await CampaignService.countMany(query), {
25
+ query: GetCampaignQueryDto,
26
+ response: t.Number(),
27
+ })
20
28
  .group("/campaigns-to-process", app => {
21
29
  return (app
22
30
  // ─── Get The List Of Campaigns To Process ────
@@ -25,6 +33,7 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
25
33
  beforeHandle: ({ query }) => {
26
34
  throwOnUnsupportedChainId(query.chainId);
27
35
  },
36
+ detail: { hide: true },
28
37
  })
29
38
  // ─── Get Count Of CampaignsToProcess ─────────
30
39
  .get("/count", async ({ query }) => (await CampaignService.findCampaignsToProcess(query.chainId)).length, {
@@ -32,6 +41,7 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
32
41
  beforeHandle: ({ query }) => {
33
42
  throwOnUnsupportedChainId(query.chainId);
34
43
  },
44
+ detail: { hide: true },
35
45
  })
36
46
  // ─── Marks A Campaignid As Processing ────────
37
47
  .post("/engine", async ({ query }) => await CampaignService.pickCampaignToProcess(query.chainId), {