@merkl/api 0.16.13 → 0.16.15

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 (51) hide show
  1. package/dist/src/backgroundJobs/jobs/priceUpdater.js +1 -1
  2. package/dist/src/eden/index.d.ts +363 -413
  3. package/dist/src/entities/opportunity.js +17 -0
  4. package/dist/src/index.d.ts +84 -82
  5. package/dist/src/libs/campaigns/campaignTypes/EncompassingDynamicData.d.ts +5 -0
  6. package/dist/src/libs/campaigns/campaignTypes/EncompassingDynamicData.js +34 -0
  7. package/dist/src/libs/campaigns/campaignsDynamicData.js +4 -0
  8. package/dist/src/libs/merklChainData.js +1 -1
  9. package/dist/src/libs/tokens/balances.js +1 -1
  10. package/dist/src/modules/v4/accounting/accounting.service.js +1 -1
  11. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +1 -13
  12. package/dist/src/modules/v4/campaign/campaign.repository.js +2 -2
  13. package/dist/src/modules/v4/campaign/campaign.service.d.ts +2 -26
  14. package/dist/src/modules/v4/campaign/campaign.service.js +3 -3
  15. package/dist/src/modules/v4/claims/claims.controller.d.ts +1 -1
  16. package/dist/src/modules/v4/enso/enso.model.d.ts +1 -1
  17. package/dist/src/modules/v4/enso/enso.model.js +1 -1
  18. package/dist/src/modules/v4/enso/enso.service.d.ts +2 -2
  19. package/dist/src/modules/v4/enso/enso.service.js +2 -2
  20. package/dist/src/modules/v4/interaction/interaction.model.d.ts +1 -1
  21. package/dist/src/modules/v4/kyberzap/kyberzap.service.d.ts +1 -1
  22. package/dist/src/modules/v4/kyberzap/kyberzap.service.js +1 -1
  23. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +4 -40
  24. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +12 -108
  25. package/dist/src/modules/v4/opportunity/opportunity.service.js +8 -5
  26. package/dist/src/modules/v4/opportunity/subservices/getAjnaMetadata.service.js +1 -1
  27. package/dist/src/modules/v4/opportunity/subservices/getBadgerMetadata.service.js +1 -1
  28. package/dist/src/modules/v4/opportunity/subservices/getEncompassingMetadata.service.d.ts +3 -0
  29. package/dist/src/modules/v4/opportunity/subservices/getEncompassingMetadata.service.js +35 -0
  30. package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -1
  31. package/dist/src/modules/v4/protocol/protocol.model.js +4 -0
  32. package/dist/src/modules/v4/protocol/protocol.service.js +6 -2
  33. package/dist/src/modules/v4/referral/referral.controller.d.ts +82 -0
  34. package/dist/src/modules/v4/referral/referral.controller.js +25 -0
  35. package/dist/src/modules/v4/referral/referral.model.d.ts +10 -0
  36. package/dist/src/modules/v4/referral/referral.model.js +12 -0
  37. package/dist/src/modules/v4/referral/referral.service.d.ts +216 -0
  38. package/dist/src/modules/v4/referral/referral.service.js +170 -0
  39. package/dist/src/modules/v4/reward/reward.controller.js +3 -3
  40. package/dist/src/modules/v4/reward/reward.repository.js +2 -2
  41. package/dist/src/modules/v4/reward/reward.service.js +1 -1
  42. package/dist/src/modules/v4/router.d.ts +84 -82
  43. package/dist/src/modules/v4/router.js +3 -1
  44. package/dist/src/modules/v4/token/token.controller.d.ts +16 -28
  45. package/dist/src/modules/v4/token/token.controller.js +2 -1
  46. package/dist/src/modules/v4/token/token.service.d.ts +5 -69
  47. package/dist/src/routes/v3/lostyield.js +1 -1
  48. package/dist/tsconfig.package.tsbuildinfo +1 -1
  49. package/package.json +1 -1
  50. package/dist/src/modules/v4/token/index.d.ts +0 -3
  51. package/dist/src/modules/v4/token/index.js +0 -3
@@ -34,7 +34,7 @@ export declare abstract class OpportunityService {
34
34
  name: string;
35
35
  status: "SOON";
36
36
  action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
37
- mainProtocol: "morpho" | "euler" | "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" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | undefined;
37
+ mainProtocol: "morpho" | "euler" | "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" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | undefined;
38
38
  depositUrl: any;
39
39
  tags: string[];
40
40
  }>;
@@ -46,20 +46,8 @@ export declare abstract class OpportunityService {
46
46
  name: string;
47
47
  status: "PAST" | "LIVE" | "SOON";
48
48
  action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
49
- tokens: ({
50
- symbol: string;
51
- name: string | null;
52
- id: string;
53
- icon: string;
54
- chainId: number;
55
- address: string;
56
- decimals: number;
57
- verified: boolean;
58
- isTest: boolean;
59
- } & {
60
- price?: number | null | undefined;
61
- })[];
62
- mainProtocol: "morpho" | "euler" | "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" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | undefined;
49
+ tokens: any[];
50
+ mainProtocol: "morpho" | "euler" | "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" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | undefined;
63
51
  depositUrl: any;
64
52
  tags: string[];
65
53
  }>;
@@ -83,7 +71,7 @@ export declare abstract class OpportunityService {
83
71
  verified: boolean;
84
72
  isTest: boolean;
85
73
  }[];
86
- mainProtocol: "morpho" | "euler" | "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" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | undefined;
74
+ mainProtocol: "morpho" | "euler" | "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" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | undefined;
87
75
  depositUrl: string | undefined;
88
76
  tags: string[];
89
77
  }>;
@@ -98,20 +86,8 @@ export declare abstract class OpportunityService {
98
86
  name: string;
99
87
  status: "PAST" | "LIVE" | "SOON";
100
88
  action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
101
- tokens: ({
102
- symbol: string;
103
- name: string | null;
104
- id: string;
105
- icon: string;
106
- chainId: number;
107
- address: string;
108
- decimals: number;
109
- verified: boolean;
110
- isTest: boolean;
111
- } & {
112
- price?: number | null | undefined;
113
- })[];
114
- mainProtocol: "morpho" | "euler" | "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" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | undefined;
89
+ tokens: any[];
90
+ mainProtocol: "morpho" | "euler" | "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" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | undefined;
115
91
  depositUrl: any;
116
92
  tags: string[];
117
93
  }>;
@@ -214,19 +190,7 @@ export declare abstract class OpportunityService {
214
190
  id: number;
215
191
  icon: string;
216
192
  };
217
- rewardToken: {
218
- symbol: string;
219
- name: string | null;
220
- id: string;
221
- icon: string;
222
- chainId: number;
223
- address: string;
224
- decimals: number;
225
- verified: boolean;
226
- isTest: boolean;
227
- } & {
228
- price?: number | null | undefined;
229
- };
193
+ rewardToken: Token;
230
194
  distributionChain: {
231
195
  name: string;
232
196
  id: number;
@@ -318,19 +282,7 @@ export declare abstract class OpportunityService {
318
282
  };
319
283
  id: string;
320
284
  depositUrl: string | undefined;
321
- tokens: ({
322
- symbol: string;
323
- name: string | null;
324
- id: string;
325
- icon: string;
326
- chainId: number;
327
- address: string;
328
- decimals: number;
329
- verified: boolean;
330
- isTest: boolean;
331
- } & {
332
- price?: number | null | undefined;
333
- })[];
285
+ tokens: Token[];
334
286
  chain: {
335
287
  name: string;
336
288
  id: number;
@@ -406,19 +358,7 @@ export declare abstract class OpportunityService {
406
358
  };
407
359
  id: string;
408
360
  depositUrl: string | undefined;
409
- tokens: ({
410
- symbol: string;
411
- name: string | null;
412
- id: string;
413
- icon: string;
414
- chainId: number;
415
- address: string;
416
- decimals: number;
417
- verified: boolean;
418
- isTest: boolean;
419
- } & {
420
- price?: number | null | undefined;
421
- })[];
361
+ tokens: Token[];
422
362
  chain: {
423
363
  name: string;
424
364
  id: number;
@@ -449,19 +389,7 @@ export declare abstract class OpportunityService {
449
389
  id: number;
450
390
  icon: string;
451
391
  };
452
- rewardToken: {
453
- symbol: string;
454
- name: string | null;
455
- id: string;
456
- icon: string;
457
- chainId: number;
458
- address: string;
459
- decimals: number;
460
- verified: boolean;
461
- isTest: boolean;
462
- } & {
463
- price?: number | null | undefined;
464
- };
392
+ rewardToken: Token;
465
393
  distributionChain: {
466
394
  name: string;
467
395
  id: number;
@@ -556,19 +484,7 @@ export declare abstract class OpportunityService {
556
484
  };
557
485
  id: string;
558
486
  depositUrl: string | undefined;
559
- tokens: ({
560
- symbol: string;
561
- name: string | null;
562
- id: string;
563
- icon: string;
564
- chainId: number;
565
- address: string;
566
- decimals: number;
567
- verified: boolean;
568
- isTest: boolean;
569
- } & {
570
- price?: number | null | undefined;
571
- })[];
487
+ tokens: Token[];
572
488
  chain: {
573
489
  name: string;
574
490
  id: number;
@@ -595,19 +511,7 @@ export declare abstract class OpportunityService {
595
511
  static formatResponseBase(opportunity: LightOpportunityFromDB): {
596
512
  id: string;
597
513
  depositUrl: string | undefined;
598
- tokens: ({
599
- symbol: string;
600
- name: string | null;
601
- id: string;
602
- icon: string;
603
- chainId: number;
604
- address: string;
605
- decimals: number;
606
- verified: boolean;
607
- isTest: boolean;
608
- } & {
609
- price?: number | null | undefined;
610
- })[];
514
+ tokens: Token[];
611
515
  chain: {
612
516
  name: string;
613
517
  id: number;
@@ -1,15 +1,15 @@
1
1
  import { NotFoundError } from "../../../errors";
2
+ import { TTLPresets } from "../cache/cache.model";
3
+ import { CacheService } from "../cache/cache.service";
2
4
  import { CampaignService } from "../campaign";
5
+ import { CampaignRepository } from "../campaign/campaign.repository";
6
+ import { TokenService } from "../token/token.service";
7
+ import { UserService } from "../user/user.service";
3
8
  import { log } from "../../../utils/logger";
4
9
  import { OpportunityAction, Prisma, Status } from "../../../../database/api/.generated";
5
10
  import { record } from "@elysiajs/opentelemetry";
6
11
  import { Campaign as CampaignEnum } from "@sdk";
7
12
  import moment from "moment";
8
- import { CacheService } from "../cache";
9
- import { TTLPresets } from "../cache/cache.model";
10
- import { CampaignRepository } from "../campaign/campaign.repository";
11
- import { TokenService } from "../token";
12
- import { UserService } from "../user";
13
13
  import { OpportunityRepository } from "./opportunity.repository";
14
14
  import { getAjnaMetadata } from "./subservices/getAjnaMetadata.service";
15
15
  import { getAmbientMetadata } from "./subservices/getAmbientMetadata.service";
@@ -18,6 +18,7 @@ import { getClammMetadata } from "./subservices/getClammMetadata.service";
18
18
  import { getCompoundMetadata } from "./subservices/getCompoundMetadata.service";
19
19
  import { getDolomiteMetadata } from "./subservices/getDolomiteMetadata.service";
20
20
  import { getEigenLayerMetadata } from "./subservices/getEigenLayerMetadata.service";
21
+ import { getEncompassingMetadata } from "./subservices/getEncompassingMetadata.service";
21
22
  import { getErc20Metadata } from "./subservices/getErc20Metadata.service";
22
23
  import { getErc20SnapshotMetadata } from "./subservices/getErc20SnapshotMetadata.service";
23
24
  import { getEulerMetadata } from "./subservices/getEulerMetadata.service";
@@ -96,6 +97,8 @@ export class OpportunityService {
96
97
  return getAmbientMetadata(chainId, campaignParams);
97
98
  case "UNISWAP_V4":
98
99
  return getUniswapV4Metadata(chainId, campaignParams);
100
+ case "ENCOMPASSING":
101
+ return getEncompassingMetadata(chainId, campaign.rewardTokenAddress, campaignParams);
99
102
  case "INVALID":
100
103
  return {
101
104
  name: "Invalid Campaigns",
@@ -1,5 +1,5 @@
1
+ import { TokenService } from "../../token/token.service";
1
2
  import { OpportunityAction } from "../../../../../database/api/.generated";
2
- import { TokenService } from "../../token";
3
3
  export const getAjnaMetadata = async (chainId, campaignSubType, params) => {
4
4
  try {
5
5
  const [collateral, quote] = await TokenService.getManyOrCreate([
@@ -1,5 +1,5 @@
1
+ import { TokenService } from "../../token/token.service";
1
2
  import { OpportunityAction } from "../../../../../database/api/.generated";
2
- import { TokenService } from "../../token";
3
3
  export const getBadgerMetadata = async (chainId, params) => {
4
4
  try {
5
5
  const [token] = await TokenService.getManyOrCreate([{ chainId, address: params.targetToken }]);
@@ -0,0 +1,3 @@
1
+ import type { ChainId, EncompassingCampaign } from "@sdk";
2
+ import type { OpportunityMetadata } from "../opportunity.model";
3
+ export declare const getEncompassingMetadata: (chainId: ChainId, rewardTokenAddress: string, params: EncompassingCampaign["campaignParameters"]) => Promise<OpportunityMetadata>;
@@ -0,0 +1,35 @@
1
+ import { log } from "../../../../utils/logger";
2
+ import { OpportunityAction } from "../../../../../database/api/.generated";
3
+ export const getEncompassingMetadata = async (chainId, rewardTokenAddress, params) => {
4
+ try {
5
+ const dataResponse = await fetch(params.dataUrl);
6
+ if (!dataResponse.ok)
7
+ throw new Error(`Response status: ${dataResponse.status}`);
8
+ const data = await dataResponse.json();
9
+ return {
10
+ action: OpportunityAction.DROP,
11
+ name: data.opportunityName ?? `Distribution of ${params.symbolRewardToken}`,
12
+ tokens: [
13
+ {
14
+ chainId,
15
+ address: rewardTokenAddress,
16
+ },
17
+ ],
18
+ mainProtocol: data.mainProtocol ?? undefined,
19
+ };
20
+ }
21
+ catch (err) {
22
+ log.error("failed to fetch data from dataUrl", err);
23
+ return {
24
+ action: OpportunityAction.DROP,
25
+ name: `Distribution of ${params.symbolRewardToken}`,
26
+ tokens: [
27
+ {
28
+ chainId,
29
+ address: rewardTokenAddress,
30
+ },
31
+ ],
32
+ mainProtocol: undefined,
33
+ };
34
+ }
35
+ };
@@ -9,7 +9,7 @@ export type Protocol = Resource<"Protocol", undefined, {
9
9
  numberOfLiveCampaigns?: number;
10
10
  opportunityLiveTags?: string[];
11
11
  }>;
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"];
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", "kyo", "sonex", "quickswap-algebra", "velodrome"];
13
13
  export type ProtocolId = (typeof protocolTypes)[number];
14
14
  export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
15
15
  id: import("@sinclair/typebox").TString;
@@ -78,6 +78,10 @@ const protocolTypes = [
78
78
  "oku",
79
79
  "hourglass",
80
80
  "veda",
81
+ "kyo",
82
+ "sonex",
83
+ "quickswap-algebra",
84
+ "velodrome",
81
85
  ];
82
86
  // ─── DTOs ────────────────────────────────────────────────────────────────────
83
87
  export const ProtocolResourceDto = t.Object({
@@ -1,7 +1,7 @@
1
+ import { ChainService } from "../chain/chain.service";
2
+ import { TokenService } from "../token/token.service";
1
3
  import { log } from "../../../utils/logger";
2
4
  import { AMM as AMMV3 } from "@sdk";
3
- import { ChainService } from "../chain";
4
- import { TokenService } from "../token";
5
5
  import { ProtocolRepository } from "./protocol.repository";
6
6
  // ─── Protocols Services ──────────────────────────────────────────────────────
7
7
  export class ProtocolService {
@@ -36,6 +36,10 @@ export class ProtocolService {
36
36
  [AMMV3.ThirdTrade]: "thirdtrade",
37
37
  [AMMV3.SyncswapV3]: "syncswap",
38
38
  [AMMV3.Neptune]: "neptune",
39
+ [AMMV3.KYO]: "kyo",
40
+ [AMMV3.Sonex]: "sonex",
41
+ [AMMV3.QuickswapAlgebraV1_2]: "quickswap-algebra",
42
+ [AMMV3.Velodrome]: "velodrome",
39
43
  }[amm];
40
44
  }
41
45
  static async findMany(query) {
@@ -0,0 +1,82 @@
1
+ import Elysia from "elysia";
2
+ export declare const ReferralController: Elysia<"/referral", false, {
3
+ decorator: {};
4
+ store: {};
5
+ derive: {};
6
+ resolve: {};
7
+ }, {
8
+ type: {};
9
+ error: {};
10
+ }, {
11
+ schema: {};
12
+ macro: {};
13
+ macroFn: {};
14
+ }, {
15
+ referral: {
16
+ code: {
17
+ get: {
18
+ body: unknown;
19
+ params: {};
20
+ query: {
21
+ chainId: number;
22
+ address: string;
23
+ referralKey: string;
24
+ };
25
+ headers: unknown;
26
+ response: {
27
+ 200: {
28
+ code: string;
29
+ referrer: boolean;
30
+ referredUsers: never[];
31
+ transaction: {
32
+ to: string;
33
+ data: `0x${string}`;
34
+ };
35
+ } | {
36
+ code: any;
37
+ referrer: boolean;
38
+ referredUsers: any;
39
+ transaction?: undefined;
40
+ };
41
+ };
42
+ };
43
+ };
44
+ };
45
+ } & {
46
+ referral: {
47
+ redeem: {
48
+ get: {
49
+ body: unknown;
50
+ params: {};
51
+ query: {
52
+ code: string;
53
+ chainId: number;
54
+ referralKey: string;
55
+ };
56
+ headers: unknown;
57
+ response: {
58
+ 200: {
59
+ code: string;
60
+ referrer: any;
61
+ transaction?: undefined;
62
+ } | {
63
+ code: string;
64
+ referrer: any;
65
+ transaction: {
66
+ to: string;
67
+ data: `0x${string}`;
68
+ };
69
+ };
70
+ };
71
+ };
72
+ };
73
+ };
74
+ }, {
75
+ derive: {};
76
+ resolve: {};
77
+ schema: {};
78
+ }, {
79
+ derive: {};
80
+ resolve: {};
81
+ schema: {};
82
+ }>;
@@ -0,0 +1,25 @@
1
+ import { throwOnUnsupportedChainId } from "../../../utils/throw";
2
+ import Elysia from "elysia";
3
+ import { ReferralCodeDto, ReferralRedeemCodeDto } from "./referral.model";
4
+ import { ReferralService } from "./referral.service";
5
+ // ─── Rewards Controller ──────────────────────────────────────────────────────
6
+ export const ReferralController = new Elysia({ prefix: "/referral", detail: { tags: ["Referral"] } })
7
+ // ─── Get Reward Breakdowns For Campaign Ids ──────────────────────────
8
+ .get("/code", async ({ query: { chainId, referralKey, address } }) => await ReferralService.getCodeOrTransaction(chainId, referralKey, address), {
9
+ query: ReferralCodeDto,
10
+ beforeHandle: ({ query: { chainId } }) => {
11
+ throwOnUnsupportedChainId(chainId);
12
+ },
13
+ detail: {
14
+ description: "Returns the transaction to register user as a referrer on-chain and some additional state",
15
+ },
16
+ })
17
+ .get("/redeem", async ({ query: { chainId, referralKey, code } }) => await ReferralService.getReferralTransaction(chainId, referralKey, code), {
18
+ query: ReferralRedeemCodeDto,
19
+ beforeHandle: ({ query: { chainId } }) => {
20
+ throwOnUnsupportedChainId(chainId);
21
+ },
22
+ detail: {
23
+ description: "Returns the transaction to redeem a referral code on-chain and some additional state",
24
+ },
25
+ });
@@ -0,0 +1,10 @@
1
+ export declare const ReferralCodeDto: import("@sinclair/typebox").TObject<{
2
+ chainId: import("@sinclair/typebox").TNumber;
3
+ referralKey: import("@sinclair/typebox").TString;
4
+ address: import("@sinclair/typebox").TString;
5
+ }>;
6
+ export declare const ReferralRedeemCodeDto: import("@sinclair/typebox").TObject<{
7
+ chainId: import("@sinclair/typebox").TNumber;
8
+ referralKey: import("@sinclair/typebox").TString;
9
+ code: import("@sinclair/typebox").TString;
10
+ }>;
@@ -0,0 +1,12 @@
1
+ import { t } from "elysia";
2
+ // ─── DTOs ────────────────────────────────────────────────────────────────────
3
+ export const ReferralCodeDto = t.Object({
4
+ chainId: t.Number(),
5
+ referralKey: t.String(),
6
+ address: t.String(),
7
+ });
8
+ export const ReferralRedeemCodeDto = t.Object({
9
+ chainId: t.Number(),
10
+ referralKey: t.String(),
11
+ code: t.String(),
12
+ });