@merkl/api 0.13.15 → 0.14.1

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 (43) hide show
  1. package/dist/src/backgroundJobs/index.js +2 -1
  2. package/dist/src/eden/index.d.ts +33 -3
  3. package/dist/src/entities/opportunity.js +4 -1
  4. package/dist/src/index.d.ts +13 -1
  5. package/dist/src/jobs/etl/pendings.js +3 -1
  6. package/dist/src/jobs/etl/reward-breakdowns.js +3 -1
  7. package/dist/src/jobs/etl/rewards.js +3 -1
  8. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.d.ts +2 -1
  9. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +1 -1
  10. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +2 -1
  11. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +83 -112
  12. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/EulerBorrowProcessor.d.ts +8 -12
  13. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/EulerBorrowProcessor.js +28 -24
  14. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/EulerLendProcessor.d.ts +7 -11
  15. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/EulerLendProcessor.js +20 -21
  16. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.d.ts +6 -5
  17. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.js +4 -4
  18. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.d.ts +1 -1
  19. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.js +1 -1
  20. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.d.ts +1 -1
  21. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.js +2 -2
  22. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/RfxProcessor.d.ts +1 -1
  23. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/RfxProcessor.js +1 -1
  24. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.d.ts +3 -2
  25. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.js +2 -2
  26. package/dist/src/libs/campaigns/campaignsDynamicData.js +1 -2
  27. package/dist/src/libs/campaigns/utils/getEulerV2Vaults.d.ts +2 -16
  28. package/dist/src/libs/campaigns/utils/getEulerV2Vaults.js +115 -57
  29. package/dist/src/modules/v4/bucket/bucket.model.d.ts +10 -0
  30. package/dist/src/modules/v4/bucket/bucket.model.js +85 -0
  31. package/dist/src/modules/v4/bucket/bucket.service.d.ts +8 -6
  32. package/dist/src/modules/v4/bucket/bucket.service.js +145 -83
  33. package/dist/src/modules/v4/campaign/campaign.repository.js +1 -2
  34. package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.js +1 -1
  35. package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +16 -2
  36. package/dist/src/modules/v4/programPayload/programPayload.repository.js +113 -2
  37. package/dist/src/routes/v3/euler.d.ts +13 -1
  38. package/dist/src/routes/v3/euler.js +10 -2
  39. package/dist/src/routes/v3/router.d.ts +13 -1
  40. package/dist/tsconfig.package.tsbuildinfo +1 -1
  41. package/package.json +1 -1
  42. package/dist/src/libs/campaigns/campaignTypes/EulerDynamicData.d.ts +0 -3
  43. package/dist/src/libs/campaigns/campaignTypes/EulerDynamicData.js +0 -165
@@ -1,6 +1,6 @@
1
1
  import { Redis } from "../cache";
2
2
  import { redisClient } from "../cache/redis";
3
- import { getEulerV2Vaults } from "../libs/campaigns/utils/getEulerV2Vaults";
3
+ import { getEulerV2Vaults, updateEulerVaultsCollatInDatabase } from "../libs/campaigns/utils/getEulerV2Vaults";
4
4
  import { getUniswapV4Pools } from "../libs/campaigns/utils/getUniswapV4Pools";
5
5
  import { DungeonKeeperController } from "../modules/v4/dungeonKeeper";
6
6
  import { log } from "../utils/logger";
@@ -30,6 +30,7 @@ new Elysia({
30
30
  .use(sync) // GET /jobs/api/sync-with-engine
31
31
  .get("/eulerUpdate", async () => {
32
32
  log.info("🔃 updating Euler vaults...");
33
+ await updateEulerVaultsCollatInDatabase();
33
34
  await Redis.safeSet("EulerV2Vaults", await getEulerV2Vaults());
34
35
  })
35
36
  .get("/uniswapv4Update", async () => {
@@ -6372,7 +6372,16 @@ declare const eden: {
6372
6372
  query: {};
6373
6373
  fetch?: RequestInit | undefined;
6374
6374
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
6375
- 200: import("../libs/campaigns/utils/getEulerV2Vaults").EulerVaultType[];
6375
+ 200: EulerVaultType[];
6376
+ }>>;
6377
+ };
6378
+ "euler-update-collat": {
6379
+ get: (options: {
6380
+ headers?: Record<string, unknown> | undefined;
6381
+ query: {};
6382
+ fetch?: RequestInit | undefined;
6383
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
6384
+ 200: void;
6376
6385
  }>>;
6377
6386
  };
6378
6387
  fetch: {
@@ -10930,7 +10939,19 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
10930
10939
  query: {};
10931
10940
  headers: unknown;
10932
10941
  response: {
10933
- 200: import("../libs/campaigns/utils/getEulerV2Vaults").EulerVaultType[];
10942
+ 200: EulerVaultType[];
10943
+ };
10944
+ };
10945
+ };
10946
+ } & {
10947
+ "euler-update-collat": {
10948
+ get: {
10949
+ body: unknown;
10950
+ params: {};
10951
+ query: {};
10952
+ headers: unknown;
10953
+ response: {
10954
+ 200: void;
10934
10955
  };
10935
10956
  };
10936
10957
  };
@@ -17827,7 +17848,16 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
17827
17848
  query: {};
17828
17849
  fetch?: RequestInit | undefined;
17829
17850
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
17830
- 200: import("../libs/campaigns/utils/getEulerV2Vaults").EulerVaultType[];
17851
+ 200: EulerVaultType[];
17852
+ }>>;
17853
+ };
17854
+ "euler-update-collat": {
17855
+ get: (options: {
17856
+ headers?: Record<string, unknown> | undefined;
17857
+ query: {};
17858
+ fetch?: RequestInit | undefined;
17859
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
17860
+ 200: void;
17831
17861
  }>>;
17832
17862
  };
17833
17863
  fetch: {
@@ -328,7 +328,10 @@ export const extractOpportunities = {
328
328
  },
329
329
  },
330
330
  };
331
- const action = Object.entries(map.actions).find(([_action, _types]) => _types.includes(campaign.type ?? ""))?.[0] ?? "hold";
331
+ const action = typeInfo.action.toLowerCase() ?? "hold";
332
+ // (Object.entries(map.actions).find(([_action, _types]) =>
333
+ // _types.includes(campaign.type ?? "")
334
+ // )?.[0] as ERC20Actions) ?? "hold";
332
335
  const icons = map.icons[action]();
333
336
  const opportunity = {
334
337
  id: `${Campaign.ERC20}_${mainParameter}`,
@@ -4147,7 +4147,19 @@ declare const app: Elysia<"", false, {
4147
4147
  query: {};
4148
4148
  headers: unknown;
4149
4149
  response: {
4150
- 200: import("./libs/campaigns/utils/getEulerV2Vaults").EulerVaultType[];
4150
+ 200: EulerVaultType[];
4151
+ };
4152
+ };
4153
+ };
4154
+ } & {
4155
+ "euler-update-collat": {
4156
+ get: {
4157
+ body: unknown;
4158
+ params: {};
4159
+ query: {};
4160
+ headers: unknown;
4161
+ response: {
4162
+ 200: void;
4151
4163
  };
4152
4164
  };
4153
4165
  };
@@ -17,7 +17,9 @@ const gcsClient = new S3Client({
17
17
  endpoint: process.env.GCS_ENDPOINT,
18
18
  bucket: `merkl-rewards-lake-${process.env.ENV}`,
19
19
  });
20
- const file = gcsClient.file(`pendings/${process.env.FILENAME}`);
20
+ let file = gcsClient.file(`pendings/${process.env.FILENAME}`);
21
+ if (!(await file.exists))
22
+ file = gcsClient.file(`pendings/${process.env.FILENAME}.gz`);
21
23
  // ─── Extract ─────────────────────────────────────────────────────────────────
22
24
  const extract = async () => {
23
25
  if (!file.exists())
@@ -13,7 +13,9 @@ const gcsClient = new S3Client({
13
13
  endpoint: process.env.GCS_ENDPOINT,
14
14
  bucket: `merkl-rewards-lake-${process.env.ENV}`,
15
15
  });
16
- const file = gcsClient.file(`breakdowns/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`);
16
+ let file = gcsClient.file(`breakdowns/${process.env.CHAIN_ID}-${process.env.ROOT}`);
17
+ if (!(await file.exists()))
18
+ file = gcsClient.file(`breakdowns/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`);
17
19
  const failedBatches = [];
18
20
  // ─── Extract ─────────────────────────────────────────────────────────────────
19
21
  const extract = async () => {
@@ -13,7 +13,9 @@ const gcsClient = new S3Client({
13
13
  endpoint: process.env.GCS_ENDPOINT,
14
14
  bucket: `merkl-rewards-lake-${process.env.ENV}`,
15
15
  });
16
- const file = gcsClient.file(`rewards/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`);
16
+ let file = gcsClient.file(`rewards/${process.env.CHAIN_ID}-${process.env.ROOT}`);
17
+ if (!(await file.exists()))
18
+ file = gcsClient.file(`rewards/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`);
17
19
  const failedBatches = [];
18
20
  // ─── Extract ─────────────────────────────────────────────────────────────────
19
21
  const extract = async () => {
@@ -1,3 +1,4 @@
1
1
  import { type Campaign, type CampaignDynamicData, type CampaignParameters, type MerklChainId } from "@sdk";
2
2
  import type { UncachedResult } from "../../../utils/execute";
3
- export declare function ERC20DynamicData(chainId: MerklChainId, campaigns: CampaignParameters<Campaign.ERC20>[] | CampaignParameters<Campaign.ERC20LOGPROCESSOR>[] | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR>[]): Promise<UncachedResult<Partial<CampaignDynamicData<Campaign.ERC20 | Campaign.ERC20LOGPROCESSOR | Campaign.ERC20REBASELOGPROCESSOR>[]>>>;
3
+ export type ERC20SupportedCampaignType = Campaign.ERC20 | Campaign.ERC20LOGPROCESSOR | Campaign.ERC20REBASELOGPROCESSOR | Campaign.EULER;
4
+ export declare function ERC20DynamicData(chainId: MerklChainId, campaigns: CampaignParameters<ERC20SupportedCampaignType>[]): Promise<UncachedResult<Partial<CampaignDynamicData<ERC20SupportedCampaignType>[]>>>;
@@ -76,7 +76,7 @@ export async function ERC20DynamicData(chainId, campaigns) {
76
76
  for (const campaign of campaigns) {
77
77
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
78
78
  const callsForCampaign = tokenTypesByCampaign[campaign.campaignId].calls.length;
79
- tokenTypesByCampaign[campaign.campaignId] = getTokenTypeRound2(j, tokenTypesByCampaign[campaign.campaignId].type, tokenTypesByCampaign[campaign.campaignId].typeInfo, resultRound2);
79
+ tokenTypesByCampaign[campaign.campaignId] = getTokenTypeRound2(j, tokenTypesByCampaign[campaign.campaignId].type, tokenTypesByCampaign[campaign.campaignId].typeInfo, resultRound2, campaign);
80
80
  j += callsForCampaign;
81
81
  callsRounds3.push(...tokenTypesByCampaign[campaign.campaignId].calls);
82
82
  }
@@ -1,3 +1,4 @@
1
+ import { OpportunityAction } from "../../../../../../database/api/.generated";
1
2
  import type { CallDto } from "@sdk";
2
3
  export declare enum tokenType {
3
4
  aura = "aura",
@@ -85,7 +86,7 @@ export declare enum tokenType {
85
86
  }
86
87
  export declare const tokenTypeToProtocol: {
87
88
  [key in tokenType]: {
88
- [key: string]: string;
89
+ [key: string]: string | OpportunityAction;
89
90
  };
90
91
  };
91
92
  export type tokenTypeStruct = {
@@ -1,3 +1,4 @@
1
+ import { OpportunityAction } from "../../../../../../database/api/.generated";
1
2
  // This enum's order is important, do not change it unless you know what you are doing
2
3
  export var tokenType;
3
4
  (function (tokenType) {
@@ -85,116 +86,86 @@ export var tokenType;
85
86
  tokenType["vicuna_borrowing"] = "vicuna_borrowing";
86
87
  })(tokenType || (tokenType = {}));
87
88
  export const tokenTypeToProtocol = {
88
- [tokenType.aave_borrowing]: { protocol: "Aave" },
89
- [tokenType.aave_lending]: { protocol: "Aave" },
90
- [tokenType.aerodrome]: { protocol: "Aerodrome V2" },
91
- [tokenType.akron]: { protocol: "Akron V2" },
92
- [tokenType.aura]: { protocol: "Aura" },
93
- [tokenType.balancerGauge]: { protocol: "Balancer Gauge" },
94
- [tokenType.balancerPool]: { protocol: "Balancer Pool" },
95
- [tokenType.baseswap]: { protocol: "Baseswap V2" },
96
- [tokenType.beefy]: { protocol: "Moo Velodrome V2" },
97
- [tokenType.compound]: { protocol: "Compound" },
98
- [tokenType.curve]: { protocol: "Curve" },
99
- [tokenType.curve_2]: { protocol: "Curve" },
100
- [tokenType.dragonswap]: { protocol: "Dragonswap V2" },
101
- [tokenType.enzyme]: { protocol: "Enzyme" },
102
- [tokenType.euler_borrow]: { protocol: "Euler V2" },
103
- [tokenType.euler_lend]: { protocol: "Euler V2" },
104
- [tokenType.fenix]: { protocol: "Fenix V2" },
105
- [tokenType.filament]: { protocol: "Filament" },
106
- [tokenType.fluid]: { protocol: "Fluid" },
107
- [tokenType.fraxlend]: { protocol: "Fraxlend" },
108
- [tokenType.gearbox]: { protocol: "Gearbox" },
109
- [tokenType.ionic]: { protocol: "Ionic" },
110
- [tokenType.ironclad_borrowing]: { protocol: "Ironclad" },
111
- [tokenType.ironclad_lending]: { protocol: "Ironclad" },
112
- [tokenType.koi]: { protocol: "Koi" },
113
- [tokenType.layerbank]: { protocol: "Layerbank" },
114
- [tokenType.metamorpho]: { protocol: "Metamorpho" },
115
- [tokenType.moonwell]: { protocol: "Moonwell" },
116
- [tokenType.pendle]: { protocol: "Pendle" },
117
- [tokenType.poolside]: { protocol: "Poolside" },
118
- [tokenType.ra]: { protocol: "Ra" },
119
- [tokenType.radiant_borrow]: { protocol: "Radiant" },
120
- [tokenType.radiant_lend]: { protocol: "Radiant" },
121
- [tokenType.reactor_fusion]: { protocol: "Reactor Fusion" },
122
- [tokenType.silostaking]: { protocol: "Silo Staking", symbolUnderlyingToken: "SEI" },
123
- [tokenType.splice]: { protocol: "Splice" },
124
- [tokenType.sturdy_aggregator]: { protocol: "Sturdy" },
125
- [tokenType.sturdy_silo]: { protocol: "Sturdy" },
126
- [tokenType.syncswap]: { protocol: "SyncSwap" },
127
- [tokenType.toros]: { protocol: "Toros" },
128
- [tokenType.uniswapv2]: { protocol: "Uniswap V2" },
129
- [tokenType.velodrome]: { protocol: "Velodrome V2" },
130
- [tokenType.venus]: { protocol: "Venus" },
131
- [tokenType.unknown]: { protocol: "Unknown" },
132
- [tokenType.yei_borrowing]: { protocol: "Yei Finance" },
133
- [tokenType.yei_lending]: { protocol: "Yei Finance" },
134
- [tokenType.zerolend_borrowing]: { protocol: "ZeroLend" },
135
- [tokenType.zerolend_lending]: { protocol: "ZeroLend" },
136
- [tokenType.zkswap]: { protocol: "ZKSwap" },
137
- [tokenType.rfx]: { protocol: "RFX" },
138
- [tokenType.woofi]: {
139
- protocol: "Woofi",
140
- },
141
- [tokenType.ironcladStaking]: {
142
- protocol: "Ironclad",
143
- },
144
- [tokenType.maverickBoostedPosition]: {
145
- protocol: "Maverick",
146
- },
147
- [tokenType.zkSwapThreePool]: {
148
- protocol: "ZKSwap",
149
- },
150
- [tokenType.maha]: {
151
- protocol: "Maha",
152
- },
153
- [tokenType.tempest]: {
154
- protocol: "Tempest",
155
- },
156
- [tokenType.pendleYT]: {
157
- protocol: "Pendle",
158
- },
159
- [tokenType.pancakeswap]: {
160
- protocol: "PancakeSwap V2",
161
- },
162
- [tokenType.tempestStaking]: {
163
- protocol: "Tempest",
164
- },
165
- [tokenType.holdstation]: {
166
- protocol: "HoldStation",
167
- },
168
- [tokenType.staking]: {
169
- protocol: "Staking",
170
- },
171
- [tokenType.noLinkVault]: {
172
- protocol: "NoLinkVault",
173
- },
174
- [tokenType.cpmmGamma]: {
175
- protocol: "GammaSwap",
176
- },
177
- [tokenType.crosscurve]: {
178
- protocol: "CrossCurve",
179
- },
180
- [tokenType.curveNPool]: {
181
- protocol: "Curve",
182
- },
183
- [tokenType.vicuna]: { protocol: "Vicuna" },
184
- [tokenType.traderJoe]: { protocol: "Trader Joe" },
185
- [tokenType.avalon_lending]: { protocol: "Avalon" },
186
- [tokenType.avalon_borrowing]: { protocol: "Avalon" },
187
- [tokenType.satlayer]: { protocol: "Satlayer" },
188
- [tokenType.veda]: { protocol: "Veda" },
189
- [tokenType.superlend_borrowing]: { protocol: "Superlend" },
190
- [tokenType.superlend_lending]: { protocol: "Superlend" },
191
- [tokenType.cian]: { protocol: "Cian" },
192
- [tokenType.concrete]: { protocol: "Concrete" },
193
- [tokenType.lendle_borrowing]: { protocol: "Lendle" },
194
- [tokenType.lendle_lending]: { protocol: "Lendle" },
195
- [tokenType.takotako_borrowing]: { protocol: "TakoTako" },
196
- [tokenType.takotako_lending]: { protocol: "TakoTako" },
197
- [tokenType.equalizer_gauge]: { protocol: "Equalizer" },
198
- [tokenType.vicuna_lending]: { protocol: "Vicuna" },
199
- [tokenType.vicuna_borrowing]: { protocol: "Vicuna" },
89
+ [tokenType.aave_borrowing]: { protocol: "Aave", action: OpportunityAction.BORROW },
90
+ [tokenType.aave_lending]: { protocol: "Aave", action: OpportunityAction.LEND },
91
+ [tokenType.aerodrome]: { protocol: "Aerodrome V2", action: OpportunityAction.POOL },
92
+ [tokenType.akron]: { protocol: "Akron V2", action: OpportunityAction.POOL },
93
+ [tokenType.aura]: { protocol: "Aura", action: OpportunityAction.POOL },
94
+ [tokenType.balancerGauge]: { protocol: "Balancer Gauge", action: OpportunityAction.POOL },
95
+ [tokenType.balancerPool]: { protocol: "Balancer Pool", action: OpportunityAction.POOL },
96
+ [tokenType.baseswap]: { protocol: "Baseswap V2", action: OpportunityAction.HOLD },
97
+ [tokenType.beefy]: { protocol: "Moo Velodrome V2", action: OpportunityAction.POOL },
98
+ [tokenType.compound]: { protocol: "Compound", action: OpportunityAction.LEND },
99
+ [tokenType.curve]: { protocol: "Curve", action: OpportunityAction.POOL },
100
+ [tokenType.curve_2]: { protocol: "Curve", action: OpportunityAction.POOL },
101
+ [tokenType.dragonswap]: { protocol: "Dragonswap V2", action: OpportunityAction.POOL },
102
+ [tokenType.enzyme]: { protocol: "Enzyme", action: OpportunityAction.HOLD },
103
+ [tokenType.euler_borrow]: { protocol: "Euler V2", action: OpportunityAction.BORROW },
104
+ [tokenType.euler_lend]: { protocol: "Euler V2", action: OpportunityAction.LEND },
105
+ [tokenType.fenix]: { protocol: "Fenix V2", action: OpportunityAction.HOLD },
106
+ [tokenType.filament]: { protocol: "Filament", action: OpportunityAction.HOLD },
107
+ [tokenType.fluid]: { protocol: "Fluid", action: OpportunityAction.LEND },
108
+ [tokenType.fraxlend]: { protocol: "Fraxlend", action: OpportunityAction.LEND },
109
+ [tokenType.gearbox]: { protocol: "Gearbox", action: OpportunityAction.LEND },
110
+ [tokenType.ionic]: { protocol: "Ionic", action: OpportunityAction.LEND },
111
+ [tokenType.ironclad_borrowing]: { protocol: "Ironclad", action: OpportunityAction.HOLD },
112
+ [tokenType.ironclad_lending]: { protocol: "Ironclad", action: OpportunityAction.HOLD },
113
+ [tokenType.koi]: { protocol: "Koi", action: OpportunityAction.POOL },
114
+ [tokenType.layerbank]: { protocol: "Layerbank", action: OpportunityAction.LEND },
115
+ [tokenType.metamorpho]: { protocol: "Metamorpho", action: OpportunityAction.HOLD },
116
+ [tokenType.moonwell]: { protocol: "Moonwell", action: OpportunityAction.LEND },
117
+ [tokenType.pendle]: { protocol: "Pendle", action: OpportunityAction.HOLD },
118
+ [tokenType.poolside]: { protocol: "Poolside", action: OpportunityAction.POOL },
119
+ [tokenType.ra]: { protocol: "Ra", action: OpportunityAction.HOLD },
120
+ [tokenType.radiant_borrow]: { protocol: "Radiant", action: OpportunityAction.BORROW },
121
+ [tokenType.radiant_lend]: { protocol: "Radiant", action: OpportunityAction.LEND },
122
+ [tokenType.reactor_fusion]: { protocol: "Reactor Fusion", action: OpportunityAction.LEND },
123
+ [tokenType.silostaking]: { protocol: "Silo Staking", action: OpportunityAction.LEND },
124
+ [tokenType.splice]: { protocol: "Splice", action: OpportunityAction.HOLD },
125
+ [tokenType.sturdy_aggregator]: { protocol: "Sturdy", action: OpportunityAction.LEND },
126
+ [tokenType.sturdy_silo]: { protocol: "Sturdy", action: OpportunityAction.LEND },
127
+ [tokenType.syncswap]: { protocol: "SyncSwap", action: OpportunityAction.POOL },
128
+ [tokenType.toros]: { protocol: "Toros", action: OpportunityAction.HOLD },
129
+ [tokenType.uniswapv2]: { protocol: "Uniswap V2", action: OpportunityAction.POOL },
130
+ [tokenType.velodrome]: { protocol: "Velodrome V2", action: OpportunityAction.POOL },
131
+ [tokenType.venus]: { protocol: "Venus", action: OpportunityAction.LEND },
132
+ [tokenType.unknown]: { protocol: "Unknown", action: OpportunityAction.HOLD },
133
+ [tokenType.yei_borrowing]: { protocol: "Yei Finance", action: OpportunityAction.HOLD },
134
+ [tokenType.yei_lending]: { protocol: "Yei Finance", action: OpportunityAction.HOLD },
135
+ [tokenType.zerolend_borrowing]: { protocol: "ZeroLend", action: OpportunityAction.BORROW },
136
+ [tokenType.zerolend_lending]: { protocol: "ZeroLend", action: OpportunityAction.LEND },
137
+ [tokenType.zkswap]: { protocol: "ZKSwap", action: OpportunityAction.POOL },
138
+ [tokenType.rfx]: { protocol: "RFX", action: OpportunityAction.POOL },
139
+ [tokenType.woofi]: { protocol: "Woofi", action: OpportunityAction.LEND },
140
+ [tokenType.ironcladStaking]: { protocol: "Ironclad", action: OpportunityAction.HOLD },
141
+ [tokenType.maverickBoostedPosition]: { protocol: "Maverick", action: OpportunityAction.POOL },
142
+ [tokenType.zkSwapThreePool]: { protocol: "ZKSwap", action: OpportunityAction.POOL },
143
+ [tokenType.maha]: { protocol: "Maha", action: OpportunityAction.HOLD },
144
+ [tokenType.tempest]: { protocol: "Tempest", action: OpportunityAction.POOL },
145
+ [tokenType.pendleYT]: { protocol: "Pendle", action: OpportunityAction.HOLD },
146
+ [tokenType.pancakeswap]: { protocol: "PancakeSwap V2", action: OpportunityAction.POOL },
147
+ [tokenType.tempestStaking]: { protocol: "Tempest", action: OpportunityAction.HOLD },
148
+ [tokenType.holdstation]: { protocol: "HoldStation", action: OpportunityAction.HOLD },
149
+ [tokenType.staking]: { protocol: "Staking", action: OpportunityAction.HOLD },
150
+ [tokenType.noLinkVault]: { protocol: "NoLinkVault", action: OpportunityAction.HOLD },
151
+ [tokenType.cpmmGamma]: { protocol: "GammaSwap", action: OpportunityAction.HOLD },
152
+ [tokenType.crosscurve]: { protocol: "CrossCurve", action: OpportunityAction.POOL },
153
+ [tokenType.curveNPool]: { protocol: "Curve", action: OpportunityAction.POOL },
154
+ [tokenType.vicuna]: { protocol: "Vicuna", action: OpportunityAction.HOLD },
155
+ [tokenType.traderJoe]: { protocol: "Trader Joe", action: OpportunityAction.HOLD },
156
+ [tokenType.avalon_lending]: { protocol: "Avalon", action: OpportunityAction.HOLD },
157
+ [tokenType.avalon_borrowing]: { protocol: "Avalon", action: OpportunityAction.HOLD },
158
+ [tokenType.satlayer]: { protocol: "Satlayer", action: OpportunityAction.HOLD },
159
+ [tokenType.veda]: { protocol: "Veda", action: OpportunityAction.HOLD },
160
+ [tokenType.superlend_borrowing]: { protocol: "Superlend", action: OpportunityAction.BORROW },
161
+ [tokenType.superlend_lending]: { protocol: "Superlend", action: OpportunityAction.LEND },
162
+ [tokenType.cian]: { protocol: "Cian", action: OpportunityAction.HOLD },
163
+ [tokenType.concrete]: { protocol: "Concrete", action: OpportunityAction.HOLD },
164
+ [tokenType.lendle_borrowing]: { protocol: "Lendle", action: OpportunityAction.BORROW },
165
+ [tokenType.lendle_lending]: { protocol: "Lendle", action: OpportunityAction.LEND },
166
+ [tokenType.takotako_borrowing]: { protocol: "TakoTako", action: OpportunityAction.BORROW },
167
+ [tokenType.takotako_lending]: { protocol: "TakoTako", action: OpportunityAction.LEND },
168
+ [tokenType.equalizer_gauge]: { protocol: "Equalizer", action: OpportunityAction.HOLD },
169
+ [tokenType.vicuna_lending]: { protocol: "Vicuna", action: OpportunityAction.LEND },
170
+ [tokenType.vicuna_borrowing]: { protocol: "Vicuna", action: OpportunityAction.BORROW },
200
171
  };
@@ -9,22 +9,17 @@ type callType = {
9
9
  metaData?: keyof callKeysEuler;
10
10
  };
11
11
  type callKeysEuler = mandatoryCallKeys & {
12
- vault: string;
13
- underlying: string;
14
- symbolUnderlyingToken: string;
15
- decimalsUnderlyingToken: string;
16
- targetTotalAsset: string;
12
+ addressVault: string;
17
13
  totalAssets: string;
18
14
  };
19
15
  type dataRawEuler = callKeysEuler & {};
20
16
  type dataTypeEuler = dataType & {
21
- vault: string;
22
- underlying: string;
23
- symbolUnderlyingToken: string;
24
- decimalsUnderlyingToken: string;
17
+ addressVault: string;
18
+ asset: string;
19
+ symbolAsset: string;
20
+ decimalsAsset: number;
25
21
  totalSupply: number;
26
- targetTotalAsset: string;
27
- totalAssets: string;
22
+ totalBorrows: string;
28
23
  };
29
24
  export declare class EulerBorrowProcessor extends GenericProcessor<callKeysEuler, dataRawEuler, dataTypeEuler> {
30
25
  rounds: {
@@ -33,6 +28,7 @@ export declare class EulerBorrowProcessor extends GenericProcessor<callKeysEuler
33
28
  round3: callType[];
34
29
  round4: callType[];
35
30
  };
36
- processingRound5(_index: number, type: tokenType, typeInfo: dataRawEuler, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeEuler>;
31
+ processingRound2(typeInfo: dataRawEuler, campaign: CampaignParameters<Campaign.EULER>): void;
32
+ processingRound5(_index: number, type: tokenType, typeInfo: dataRawEuler, _calls: string[], campaign: CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeEuler>;
37
33
  }
38
34
  export {};
@@ -1,46 +1,50 @@
1
1
  import { generateCardName } from "../../../../../utils/generateCardName";
2
- import { BN2Number } from "@sdk";
2
+ import { BN2Number, EulerSubCampaignType } from "@sdk";
3
3
  import { fetchEulerVaultName } from "../helpers/eulerVaultNames";
4
4
  import { GenericProcessor } from "./GenericProcessor";
5
5
  export class EulerBorrowProcessor extends GenericProcessor {
6
6
  rounds = {
7
- round1: [{ key: "vault", call: "eVault", target: "tokenAddress" }],
8
- round2: [{ key: "underlying", call: "underlying", target: "tokenAddress" }],
9
- round3: [
10
- { key: "decimalsUnderlyingToken", call: "decimals", target: "underlying" },
11
- { key: "symbolUnderlyingToken", call: "symbol", target: "underlying" },
12
- ],
7
+ round1: [],
8
+ round2: [],
9
+ round3: [],
13
10
  round4: [
14
11
  { key: "totalSupply", call: "totalSupply", target: "tokenAddress" },
15
- { key: "totalAssets", call: "totalAssets", target: "vault" },
12
+ { key: "totalAssets", call: "totalAssets", target: "addressVault" },
16
13
  ],
17
14
  };
18
- // override computeRound1(): void {}
15
+ processingRound2(typeInfo, campaign) {
16
+ typeInfo.addressVault = campaign.campaignParameters.evkAddress;
17
+ }
19
18
  async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
20
19
  const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
21
- const priceUnderlying = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 1;
22
- let totalAssetsOrBorrows = 0;
23
- let cardName = "";
24
- const decimalsUnderlyingToken = Number(typeInfo.decimalsUnderlyingToken);
25
- totalAssetsOrBorrows = BN2Number(
26
- // eulerInterface.decodeFunctionResult("totalBorrows", calls[index++])[0],
27
- typeInfo.totalAssets, decimalsUnderlyingToken);
28
- cardName = generateCardName(type, typeInfo, campaign);
29
- const vaultName = await fetchEulerVaultName(typeInfo.vault, campaign.chainId);
20
+ const symbolAsset = campaign.campaignParameters.symbolAsset;
21
+ const decimalsAsset = Number(campaign.campaignParameters.decimalsAsset);
22
+ const priceAsset = (await pricer.get({ symbol: symbolAsset })) ?? 1;
23
+ const totalBorrows = BN2Number(typeInfo.totalAssets, decimalsAsset);
24
+ let cardName = generateCardName(type, typeInfo, campaign);
25
+ const vaultName = await fetchEulerVaultName(campaign.campaignParameters.evkAddress, campaign.chainId);
30
26
  if (!!vaultName) {
31
27
  cardName = `Borrow from ${vaultName} vault`;
32
28
  }
33
- const tvl = priceUnderlying * totalAssetsOrBorrows;
29
+ if (campaign.campaignSubType === EulerSubCampaignType.BORROW_FROM_COLLATERAL) {
30
+ cardName = `${cardName} using ${campaign.campaignParameters.symbolCollateral}`;
31
+ // TODO
32
+ }
33
+ const tvl = priceAsset * totalBorrows;
34
34
  const priceTargetToken = tvl / totalSupply;
35
35
  return {
36
36
  ...typeInfo,
37
- totalSupply,
37
+ asset: campaign.campaignParameters.addressAsset,
38
+ addressVault: typeInfo.addressVault,
38
39
  blacklistedSupply,
39
- whitelistedSupplyTargetToken,
40
- tvl,
41
- priceTargetToken,
42
40
  cardName: cardName,
43
- totalAssets: typeInfo.totalAssets,
41
+ decimalsAsset,
42
+ priceTargetToken,
43
+ symbolAsset,
44
+ totalBorrows: typeInfo.totalAssets.toString(),
45
+ totalSupply,
46
+ tvl,
47
+ whitelistedSupplyTargetToken,
44
48
  };
45
49
  }
46
50
  }
@@ -9,21 +9,16 @@ type callType = {
9
9
  metaData?: keyof callKeysEuler;
10
10
  };
11
11
  type callKeysEuler = mandatoryCallKeys & {
12
- vault: string;
13
- underlying: string;
14
- symbolUnderlyingToken: string;
15
- decimalsUnderlyingToken: string;
16
- targetTotalAsset: string;
12
+ addressVault: string;
17
13
  totalAssets: string;
18
14
  };
19
15
  type dataRawEuler = callKeysEuler & {};
20
16
  type dataTypeEuler = dataType & {
21
- vault: string;
22
- underlying: string;
23
- symbolUnderlyingToken: string;
24
- decimalsUnderlyingToken: string;
17
+ addressVault: string;
18
+ asset: string;
19
+ symbolAsset: string;
20
+ decimalsAsset: number;
25
21
  totalSupply: number;
26
- targetTotalAsset: string;
27
22
  totalAssets: string;
28
23
  };
29
24
  export declare class EulerLendProcessor extends GenericProcessor<callKeysEuler, dataRawEuler, dataTypeEuler> {
@@ -33,6 +28,7 @@ export declare class EulerLendProcessor extends GenericProcessor<callKeysEuler,
33
28
  round3: callType[];
34
29
  round4: callType[];
35
30
  };
36
- processingRound5(index: number, type: tokenType, typeInfo: dataRawEuler, calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeEuler>;
31
+ processingRound2(typeInfo: dataRawEuler, campaign: CampaignParameters<Campaign.EULER>): void;
32
+ processingRound5(index: number, type: tokenType, typeInfo: dataRawEuler, calls: string[], campaign: CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeEuler>;
37
33
  }
38
34
  export {};
@@ -1,4 +1,3 @@
1
- import { decodeCall } from "../../../../../utils/decodeCalls";
2
1
  import { generateCardName } from "../../../../../utils/generateCardName";
3
2
  import { BN2Number } from "@sdk";
4
3
  import { fetchEulerVaultName } from "../helpers/eulerVaultNames";
@@ -6,42 +5,42 @@ import { GenericProcessor } from "./GenericProcessor";
6
5
  export class EulerLendProcessor extends GenericProcessor {
7
6
  rounds = {
8
7
  round1: [],
9
- round2: [{ key: "underlying", call: "underlying", target: "tokenAddress" }],
10
- round3: [
11
- { key: "decimalsUnderlyingToken", call: "decimals", target: "underlying" },
12
- { key: "symbolUnderlyingToken", call: "symbol", target: "underlying" },
13
- ],
8
+ round2: [],
9
+ round3: [],
14
10
  round4: [
15
11
  { key: "totalSupply", call: "totalSupply", target: "tokenAddress" },
16
12
  { key: "totalAssets", call: "totalAssets", target: "tokenAddress" },
17
13
  ],
18
14
  };
19
- // override computeRound1(): void {}
15
+ processingRound2(typeInfo, campaign) {
16
+ typeInfo.addressVault = campaign.campaignParameters.evkAddress;
17
+ }
20
18
  async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
21
19
  const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
22
- const priceUnderlying = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 1;
23
- let totalAssetsOrBorrows = 0;
24
- let cardName = "";
25
- const decimalsUnderlyingToken = Number(typeInfo.decimalsUnderlyingToken);
26
- totalAssetsOrBorrows = BN2Number(
27
- // eulerInterface.decodeFunctionResult("totalAssets", calls[index++])[0],
28
- decodeCall(calls, index++, "totalAssets", type), decimalsUnderlyingToken);
29
- cardName = generateCardName(type, typeInfo, campaign);
20
+ const symbolAsset = campaign.campaignParameters.symbolAsset;
21
+ const decimalsAsset = Number(campaign.campaignParameters.decimalsAsset);
22
+ const priceAsset = (await pricer.get({ symbol: symbolAsset })) ?? 1;
23
+ const totalAssets = BN2Number(typeInfo.totalAssets, decimalsAsset);
24
+ let cardName = generateCardName(type, typeInfo, campaign);
30
25
  const vaultName = await fetchEulerVaultName(typeInfo.tokenAddress, campaign.chainId);
31
26
  if (!!vaultName) {
32
- cardName = `Supply ${typeInfo.symbolUnderlyingToken} on ${vaultName} vault`;
27
+ cardName = `Supply ${symbolAsset} on ${vaultName} vault`;
33
28
  }
34
- const tvl = priceUnderlying * totalAssetsOrBorrows;
29
+ const tvl = priceAsset * totalAssets;
35
30
  const priceTargetToken = tvl / totalSupply;
36
31
  return {
37
32
  ...typeInfo,
38
- totalSupply,
33
+ asset: campaign.campaignParameters.addressAsset,
34
+ addressVault: typeInfo.addressVault,
39
35
  blacklistedSupply,
36
+ cardName: cardName,
37
+ decimalsAsset,
38
+ priceTargetToken,
39
+ symbolAsset,
40
+ totalAssets: typeInfo.totalAssets.toString(),
41
+ totalSupply,
40
42
  tvl,
41
43
  whitelistedSupplyTargetToken,
42
- priceTargetToken,
43
- cardName: cardName,
44
- totalAssets: typeInfo.totalAssets,
45
44
  };
46
45
  }
47
46
  }