@merkl/api 0.15.47 → 0.15.49

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.
@@ -31,7 +31,7 @@ export declare const DOPEX_OPTION_MARKET: {
31
31
  [market: string]: string;
32
32
  };
33
33
  export declare const constantChain: {
34
- [ChainId.MAINNET]: {
34
+ [x: number]: {
35
35
  apw: string;
36
36
  convexEndpoint: string;
37
37
  crv: string;
@@ -55,8 +55,28 @@ export declare const constantChain: {
55
55
  usdc: string;
56
56
  weth: string;
57
57
  wstETH: string;
58
- };
59
- [ChainId.ARBITRUM]: {
58
+ arb?: undefined;
59
+ chr?: undefined;
60
+ convexProxy?: undefined;
61
+ crv2Pool?: undefined;
62
+ jeur?: undefined;
63
+ ram?: undefined;
64
+ sliz?: undefined;
65
+ mai?: undefined;
66
+ op?: undefined;
67
+ usdce?: undefined;
68
+ velo?: undefined;
69
+ veloV2?: undefined;
70
+ aero?: undefined;
71
+ am3CRV?: undefined;
72
+ amDAI?: undefined;
73
+ amUSDC?: undefined;
74
+ amUSDT?: undefined;
75
+ jrt?: undefined;
76
+ oretro?: undefined;
77
+ glcr?: undefined;
78
+ cake?: undefined;
79
+ } | {
60
80
  arb: string;
61
81
  chr: string;
62
82
  convexProxy: string;
@@ -70,8 +90,38 @@ export declare const constantChain: {
70
90
  sliz: string;
71
91
  stakeEndpoint: string;
72
92
  usdc: string;
73
- };
74
- [ChainId.OPTIMISM]: {
93
+ apw?: undefined;
94
+ convexEndpoint?: undefined;
95
+ crv3?: undefined;
96
+ crvANGLESDANGLE?: undefined;
97
+ crvEURAEUROC?: undefined;
98
+ crvEURAEURe?: undefined;
99
+ crvEuropool?: undefined;
100
+ crvFRAX?: undefined;
101
+ crvFRAXEURA?: undefined;
102
+ crvLUSD3CRV?: undefined;
103
+ dai?: undefined;
104
+ fxs?: undefined;
105
+ morpho?: undefined;
106
+ rKP3R?: undefined;
107
+ sushi?: undefined;
108
+ weth?: undefined;
109
+ wstETH?: undefined;
110
+ mai?: undefined;
111
+ op?: undefined;
112
+ usdce?: undefined;
113
+ velo?: undefined;
114
+ veloV2?: undefined;
115
+ aero?: undefined;
116
+ am3CRV?: undefined;
117
+ amDAI?: undefined;
118
+ amUSDC?: undefined;
119
+ amUSDT?: undefined;
120
+ jrt?: undefined;
121
+ oretro?: undefined;
122
+ glcr?: undefined;
123
+ cake?: undefined;
124
+ } | {
75
125
  jeur: string;
76
126
  mai: string;
77
127
  op: string;
@@ -79,12 +129,89 @@ export declare const constantChain: {
79
129
  usdce: string;
80
130
  velo: string;
81
131
  veloV2: string;
82
- };
83
- [ChainId.BASE]: {
132
+ apw?: undefined;
133
+ convexEndpoint?: undefined;
134
+ crv?: undefined;
135
+ crv3?: undefined;
136
+ crvANGLESDANGLE?: undefined;
137
+ crvEURAEUROC?: undefined;
138
+ crvEURAEURe?: undefined;
139
+ crvEuropool?: undefined;
140
+ crvFRAX?: undefined;
141
+ crvFRAXEURA?: undefined;
142
+ crvLUSD3CRV?: undefined;
143
+ cvx?: undefined;
144
+ dai?: undefined;
145
+ frax?: undefined;
146
+ fxs?: undefined;
147
+ morpho?: undefined;
148
+ rKP3R?: undefined;
149
+ sdt?: undefined;
150
+ stakeEndpoint?: undefined;
151
+ sushi?: undefined;
152
+ weth?: undefined;
153
+ wstETH?: undefined;
154
+ arb?: undefined;
155
+ chr?: undefined;
156
+ convexProxy?: undefined;
157
+ crv2Pool?: undefined;
158
+ ram?: undefined;
159
+ sliz?: undefined;
160
+ aero?: undefined;
161
+ am3CRV?: undefined;
162
+ amDAI?: undefined;
163
+ amUSDC?: undefined;
164
+ amUSDT?: undefined;
165
+ jrt?: undefined;
166
+ oretro?: undefined;
167
+ glcr?: undefined;
168
+ cake?: undefined;
169
+ } | {
84
170
  aero: string;
85
171
  usdc: string;
86
- };
87
- [ChainId.POLYGON]: {
172
+ apw?: undefined;
173
+ convexEndpoint?: undefined;
174
+ crv?: undefined;
175
+ crv3?: undefined;
176
+ crvANGLESDANGLE?: undefined;
177
+ crvEURAEUROC?: undefined;
178
+ crvEURAEURe?: undefined;
179
+ crvEuropool?: undefined;
180
+ crvFRAX?: undefined;
181
+ crvFRAXEURA?: undefined;
182
+ crvLUSD3CRV?: undefined;
183
+ cvx?: undefined;
184
+ dai?: undefined;
185
+ frax?: undefined;
186
+ fxs?: undefined;
187
+ morpho?: undefined;
188
+ rKP3R?: undefined;
189
+ sdt?: undefined;
190
+ stakeEndpoint?: undefined;
191
+ sushi?: undefined;
192
+ weth?: undefined;
193
+ wstETH?: undefined;
194
+ arb?: undefined;
195
+ chr?: undefined;
196
+ convexProxy?: undefined;
197
+ crv2Pool?: undefined;
198
+ jeur?: undefined;
199
+ ram?: undefined;
200
+ sliz?: undefined;
201
+ mai?: undefined;
202
+ op?: undefined;
203
+ usdce?: undefined;
204
+ velo?: undefined;
205
+ veloV2?: undefined;
206
+ am3CRV?: undefined;
207
+ amDAI?: undefined;
208
+ amUSDC?: undefined;
209
+ amUSDT?: undefined;
210
+ jrt?: undefined;
211
+ oretro?: undefined;
212
+ glcr?: undefined;
213
+ cake?: undefined;
214
+ } | {
88
215
  am3CRV: string;
89
216
  amDAI: string;
90
217
  amUSDC: string;
@@ -93,13 +220,132 @@ export declare const constantChain: {
93
220
  jrt: string;
94
221
  oretro: string;
95
222
  usdc: string;
96
- };
97
- [ChainId.AVALANCHE]: {
223
+ apw?: undefined;
224
+ convexEndpoint?: undefined;
225
+ crv?: undefined;
226
+ crv3?: undefined;
227
+ crvANGLESDANGLE?: undefined;
228
+ crvEURAEUROC?: undefined;
229
+ crvEURAEURe?: undefined;
230
+ crvEuropool?: undefined;
231
+ crvFRAX?: undefined;
232
+ crvFRAXEURA?: undefined;
233
+ crvLUSD3CRV?: undefined;
234
+ cvx?: undefined;
235
+ dai?: undefined;
236
+ frax?: undefined;
237
+ fxs?: undefined;
238
+ morpho?: undefined;
239
+ rKP3R?: undefined;
240
+ sdt?: undefined;
241
+ stakeEndpoint?: undefined;
242
+ sushi?: undefined;
243
+ weth?: undefined;
244
+ wstETH?: undefined;
245
+ arb?: undefined;
246
+ chr?: undefined;
247
+ convexProxy?: undefined;
248
+ crv2Pool?: undefined;
249
+ ram?: undefined;
250
+ sliz?: undefined;
251
+ mai?: undefined;
252
+ op?: undefined;
253
+ usdce?: undefined;
254
+ velo?: undefined;
255
+ veloV2?: undefined;
256
+ aero?: undefined;
257
+ glcr?: undefined;
258
+ cake?: undefined;
259
+ } | {
98
260
  glcr: string;
99
261
  usdc: string;
100
- };
101
- [ChainId.BSC]: {
262
+ apw?: undefined;
263
+ convexEndpoint?: undefined;
264
+ crv?: undefined;
265
+ crv3?: undefined;
266
+ crvANGLESDANGLE?: undefined;
267
+ crvEURAEUROC?: undefined;
268
+ crvEURAEURe?: undefined;
269
+ crvEuropool?: undefined;
270
+ crvFRAX?: undefined;
271
+ crvFRAXEURA?: undefined;
272
+ crvLUSD3CRV?: undefined;
273
+ cvx?: undefined;
274
+ dai?: undefined;
275
+ frax?: undefined;
276
+ fxs?: undefined;
277
+ morpho?: undefined;
278
+ rKP3R?: undefined;
279
+ sdt?: undefined;
280
+ stakeEndpoint?: undefined;
281
+ sushi?: undefined;
282
+ weth?: undefined;
283
+ wstETH?: undefined;
284
+ arb?: undefined;
285
+ chr?: undefined;
286
+ convexProxy?: undefined;
287
+ crv2Pool?: undefined;
288
+ jeur?: undefined;
289
+ ram?: undefined;
290
+ sliz?: undefined;
291
+ mai?: undefined;
292
+ op?: undefined;
293
+ usdce?: undefined;
294
+ velo?: undefined;
295
+ veloV2?: undefined;
296
+ aero?: undefined;
297
+ am3CRV?: undefined;
298
+ amDAI?: undefined;
299
+ amUSDC?: undefined;
300
+ amUSDT?: undefined;
301
+ jrt?: undefined;
302
+ oretro?: undefined;
303
+ cake?: undefined;
304
+ } | {
102
305
  cake: string;
306
+ apw?: undefined;
307
+ convexEndpoint?: undefined;
308
+ crv?: undefined;
309
+ crv3?: undefined;
310
+ crvANGLESDANGLE?: undefined;
311
+ crvEURAEUROC?: undefined;
312
+ crvEURAEURe?: undefined;
313
+ crvEuropool?: undefined;
314
+ crvFRAX?: undefined;
315
+ crvFRAXEURA?: undefined;
316
+ crvLUSD3CRV?: undefined;
317
+ cvx?: undefined;
318
+ dai?: undefined;
319
+ frax?: undefined;
320
+ fxs?: undefined;
321
+ morpho?: undefined;
322
+ rKP3R?: undefined;
323
+ sdt?: undefined;
324
+ stakeEndpoint?: undefined;
325
+ sushi?: undefined;
326
+ usdc?: undefined;
327
+ weth?: undefined;
328
+ wstETH?: undefined;
329
+ arb?: undefined;
330
+ chr?: undefined;
331
+ convexProxy?: undefined;
332
+ crv2Pool?: undefined;
333
+ jeur?: undefined;
334
+ ram?: undefined;
335
+ sliz?: undefined;
336
+ mai?: undefined;
337
+ op?: undefined;
338
+ usdce?: undefined;
339
+ velo?: undefined;
340
+ veloV2?: undefined;
341
+ aero?: undefined;
342
+ am3CRV?: undefined;
343
+ amDAI?: undefined;
344
+ amUSDC?: undefined;
345
+ amUSDT?: undefined;
346
+ jrt?: undefined;
347
+ oretro?: undefined;
348
+ glcr?: undefined;
103
349
  };
104
350
  };
105
351
  export declare const MAVERICK_ZKSYNC_BP_LENS_ADDRESS = "0xd32CE31CaC98CAC0631764B8286358c0606D87F9";
@@ -148,7 +148,8 @@ const updatePendings = async (data) => {
148
148
  }
149
149
  }
150
150
  const totalRewardIncrease = Object.values(rewardIdToPendingIncrease).reduce((prev, current) => prev + BigInt(current.pendingIncrease), 0n);
151
- log.info(`rewards to create: ${rewardToCreate.length}, to update: ${rewardToUpdate.length}, total reward increase: ${totalRewardIncrease.toString()}`);
151
+ log.info(`total increase: ${totalRewardIncrease.toString()}, rewards to create: ${rewardToCreate.length}, to update: ${rewardToUpdate.length}`);
152
+ log.info(`total increase: ${totalBreakdownIncrease.toString()}, breakdowns to create: ${breakdownToCreate.length}, to update: ${breakdownToUpdate.length}`);
152
153
  if (rewardToCreate.length > 0) {
153
154
  const users = rewardToCreate.map(x => x.recipient);
154
155
  await apiDbClient.user.createMany({ data: users.map(x => ({ address: x, tags: [] })), skipDuplicates: true });
@@ -168,20 +169,21 @@ const updatePendings = async (data) => {
168
169
  }),
169
170
  });
170
171
  }
171
- if (rewardToUpdate.length > 0) {
172
- await apiDbClient.$transaction(rewardToUpdate.map(x => {
173
- const rewardId = Bun.hash(`${data.root}${x.recipient}${rewardTokenId}`).toString();
174
- return apiDbClient.reward.update({
175
- where: {
176
- id: rewardId,
177
- },
178
- data: {
179
- pending: x.pending.toString(),
180
- },
181
- });
182
- }));
172
+ if (breakdownToCreate.length > 0) {
173
+ await apiDbClient.rewardBreakdown.createMany({
174
+ data: breakdownToCreate.map(x => {
175
+ const rewardId = Bun.hash(`${root}${x.recipient}${rewardTokenId}`).toString();
176
+ return {
177
+ reason: x.reason,
178
+ amount: "0",
179
+ pending: x.pending,
180
+ claimed: "0",
181
+ rewardId,
182
+ campaignId,
183
+ };
184
+ }),
185
+ });
183
186
  }
184
- log.info(`breakdowns to create: ${breakdownToCreate.length}, to update: ${breakdownToUpdate.length}, total breakdown increase: ${totalBreakdownIncrease.toString()}`);
185
187
  if (breakdownToUpdate.length > 0) {
186
188
  await apiDbClient.$transaction(breakdownToUpdate.map(x => {
187
189
  return apiDbClient.rewardBreakdown.update({
@@ -198,20 +200,18 @@ const updatePendings = async (data) => {
198
200
  });
199
201
  }));
200
202
  }
201
- if (breakdownToCreate.length > 0) {
202
- await apiDbClient.rewardBreakdown.createMany({
203
- data: breakdownToCreate.map(x => {
204
- const rewardId = Bun.hash(`${root}${x.recipient}${rewardTokenId}`).toString();
205
- return {
206
- reason: x.reason,
207
- amount: "0",
208
- pending: x.pending,
209
- claimed: "0",
210
- rewardId,
211
- campaignId,
212
- };
213
- }),
214
- });
203
+ if (rewardToUpdate.length > 0) {
204
+ await apiDbClient.$transaction(rewardToUpdate.map(x => {
205
+ const rewardId = Bun.hash(`${data.root}${x.recipient}${rewardTokenId}`).toString();
206
+ return apiDbClient.reward.update({
207
+ where: {
208
+ id: rewardId,
209
+ },
210
+ data: {
211
+ pending: x.pending.toString(),
212
+ },
213
+ });
214
+ }));
215
215
  }
216
216
  return { created: breakdownToCreate.length, updated: breakdownToUpdate.length };
217
217
  };
@@ -5,6 +5,10 @@ import type { Resource } from "../prisma";
5
5
  * @see {@link Resource}
6
6
  */
7
7
  export type Protocol = Resource<"Protocol">;
8
+ export type EnrichedProtocols = Resource<"Protocol"> & {
9
+ dailyRewards: number;
10
+ numberOfLiveCampaigns: number;
11
+ };
8
12
  declare const protocolTypes: readonly ["ambient", "arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "uniswap-v3", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "uniswapv4", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "cross_curve", "curveNPool", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "syncswap-v3", "neptune", "zkSwapThreePool", "syncswap", "rfx", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "venus", "woofi", "reactor_fusion", "eigenlayer", "vest", "zerolend", "hyperdrive", "gamma", "oku", "hourglass", "veda"];
9
13
  export type ProtocolId = (typeof protocolTypes)[number];
10
14
  export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
@@ -1,8 +1,8 @@
1
1
  import { AMM as AMMV3 } from "@sdk";
2
- import type { CreateProtocolModel, GetProtocolsQueryModel, Protocol, ProtocolId, UpdateProtocolModel } from "./protocol.model";
2
+ import type { CreateProtocolModel, EnrichedProtocols, GetProtocolsQueryModel, Protocol, ProtocolId, UpdateProtocolModel } from "./protocol.model";
3
3
  export declare abstract class ProtocolService {
4
4
  static getIdFromAmmV3(amm: AMMV3): ProtocolId;
5
- static findMany(query: GetProtocolsQueryModel): Promise<Protocol["model"][]>;
5
+ static findMany(query: GetProtocolsQueryModel): Promise<EnrichedProtocols["model"][]>;
6
6
  static countMany(query: GetProtocolsQueryModel): Promise<number>;
7
7
  static getFromId(id: ProtocolId | string): Promise<Protocol["model"] | null>;
8
8
  static getFromName(name: string): Promise<Protocol["model"] | null>;
@@ -42,8 +42,8 @@ export class ProtocolService {
42
42
  const protocols = await ProtocolRepository.findMany(query);
43
43
  const enrichedProtocols = protocols.map(({ MainOpportunities, ...protocol }) => ({
44
44
  ...protocol,
45
- dailyReward: MainOpportunities.reduce((sum, opportunity) => sum + opportunity.dailyRewards, 0),
46
- numberOfCampaigns: MainOpportunities.reduce((sum, opportunity) => sum + opportunity.Campaigns.length, 0),
45
+ dailyRewards: MainOpportunities.reduce((sum, opportunity) => sum + opportunity.dailyRewards, 0),
46
+ numberOfLiveCampaigns: MainOpportunities.reduce((sum, opportunity) => sum + opportunity.Campaigns.length, 0),
47
47
  }));
48
48
  return enrichedProtocols;
49
49
  }